[gambit-list] Compiling a gambit program with XCode

Francois Magnan fmagnan at me.com
Wed Feb 18 09:31:37 EST 2015


Hi,

Ah… yes. XCode treated them as errors by default! 
Now compilation succeeds but at link time I get errors for all used gambit functions:

Undefined symbols for architecture x86_64:
  "___cleanup()", referenced from:
      gambit_cleanup() in cefsimple_mac.o
  "___release_scmobj(long)", referenced from:
      factorial(char*) in program.o
  "___propagate_error(long)", referenced from:
      factorial(char*) in program.o
  "___setup_params_reset(___setup_params_struct*)", referenced from:
      gambit_setup() in cefsimple_mac.o
…



Note that I tried to compile the program.c using the clang++ and clang because there are C++ files in the project. 
Here is the full link command generated by XCode:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -L/Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/Debug -L/usr/local/Gambit-C/lib -F/Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/Debug -filelist /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/cef.build/Debug/cefsimple.build/Objects-normal/x86_64/cefsimple.LinkFileList -mmacosx-version-min=10.6 -Wl,-search_paths_first -Wl,-ObjC -Wl,-pie -Wl,-search_paths_first -Wl,-headerpad_max_install_names /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/Debug/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/libcef_dll/Debug/libcef_dll_wrapper.a -lpthread -framework Cocoa -framework AppKit -lgambc -Xlinker -dependency_info -Xlinker /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/cef.build/Debug/cefsimple.build/Objects-normal/x86_64/cefsimple_dependency_info.dat -o /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/Debug/cefsimple.app/Contents/MacOS/cefsimple


What am I missing?
Thank you,
Francois

> On Feb 17, 2015, at 2:13 PM, Marc Feeley <feeley at iro.umontreal.ca> wrote:
> 
> All of those messages are warnings.  Just add a compile flag to remove the warnings (and not treat them as errors).  I don’t know what the flag is for clang.
> 
> Marc
> 
>> On Feb 17, 2015, at 12:30 PM, Francois Magnan <fmagnan at me.com> wrote:
>> 
>> Salut Marc,
>> 
>> I’m trying to integrate a Gambit-C program into the XCode workflow. I tried a minimal example:
>> 
>> ———— program.scm —————
>> 
>> (c-define (factorial n) (char-string) char-string "factorial" ""
>>  	(number->string (fact (string->number n))))
>> 
>> 
>> 
>> (define (fact n)
>> 	(if (= n 0)
>> 		1
>> 		(* n (fact (- n 1)))))
>> 
>> ———— program.scm —————
>> 
>> 
>> 
>> Then I call:
>> 
>> 	gsc -link program
>> 
>> and that generated program_.c and program.c
>> 
>> I then add those two files to my XCode project and then 
>> 
>> — Add the /usr/local/Gambit-C/include  to my headers search path
>> — Add the /usr/local/Gambit-C/lib to my libraries search path
>> — Add -lgambc as a linked flag
>> — Add  gambit_setup() and gambit_cleanup() functions and call then at the appropriate time
>> 
>> But when I compile the project I get a series of errors:
>> 
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:106:1: Variable '___result' is used uninitialized whenever 'if' condition is false
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:174:1: Unused variable '___u32_temp'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:174:1: Unused variable '___s32_temp'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:183:13: Unused label '___L__20_program'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:174:1: Unused variable '___u64_temp'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:174:1: Unused variable '___temp'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:174:1: Unused variable '___s64_temp'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:201:1: Unused variable '___s32_temp'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:201:1: Unused variable '___u64_temp'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:214:13: Unused label '___L_factorial'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:201:1: Unused variable '___s64_temp'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:201:1: Unused variable '___u32_temp'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:266:13: Unused label '___L_fact'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:244:1: Unused variable '___u64_temp'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:244:1: Unused variable '___s64_temp'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:244:1: Unused variable '___u32_temp'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:244:1: Unused variable '___s32_temp'
>> /Users/magnan/Desktop/cef_binary_3.2295.2032_macosx64/cefsimple/program.c:437:1: Unused variable ‘___ps'
>> 
>> 
>> 
>> What am I doing wrong? I used to do that technique for iOS apps before but now it broke. I am trying to build a MaxOSX app.
>> 
>> Thank you,
>> Francois Magnan
>> 
>> 
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20150218/eaa4b2e9/attachment.htm>


More information about the Gambit-list mailing list