[gambit-list] Compilation problem; only one of two object files can be loaded

Per Eckerdal per.eckerdal at gmail.com
Wed Jul 7 12:22:53 EDT 2010


I'm compiling scheme to C, then C to .o then linking, in separate steps. The goal is to create a dynamically loadable object file (one that can be loaded by Gambit's load procedure).

I have this really odd problem: I have two dynamically loadable object files that are identical except for their names (so they are not byte-to-byte identical because the file names are embedded in the files). When I load one of them, it works, but when the other one is loaded, I get "Unknown error". This happens regardless of in which order I load them:

$ gsc 
Gambit v4.6.0
> (load "test.o1")
"/Users/per/prog/gambit/blackhole/test.o1"
> (load "test.o2")
*** ERROR IN (console)@2.1 -- Unknown error
(load "test.o2")
1> 
*** EOF again to exit

$ gsc 
Gambit v4.6.0
> (load "test.o2")
"/Users/per/prog/gambit/blackhole/test.o2"
> (load "test.o1")
*** ERROR IN (console)@2.1 -- Unknown error
(load "test.o1")
1> 

My guess is that I use incorrect compiler and/or linker flags somewhere. I had a similar issue where an object file was only loadable by the same gsc process that created it, which was because I didn't send "-D___DYNAMIC" to the C preprocessor.

The files are compiled using the exact same process, I copy-paste the commands that are used to invoke GCC at the end of the mail. Any pointers?

thanks,
/Per


The compilation and linking commands, for the two modules: (this is on OSX)

gcc    -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common -mieee-fp    -I"/usr/local/Gambit-C/include" -c -o "/Users/per/prog/gambit/github-modules/work/compile-tmp/1/test-rt.o" -D___DYNAMIC  test-rt.c
gcc    -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common -mieee-fp    -I"/usr/local/Gambit-C/include" -c -o "/Users/per/prog/gambit/github-modules/work/compile-tmp/1/test-ct.o" -D___DYNAMIC  test-ct.c
gcc    -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common -mieee-fp    -I"/usr/local/Gambit-C/include" -c -o "/Users/per/prog/gambit/github-modules/work/compile-tmp/1/test-vt.o" -D___DYNAMIC  test-vt.c
gcc    -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common -mieee-fp    -I"/usr/local/Gambit-C/include" -c -o "/Users/per/prog/gambit/github-modules/work/compile-tmp/1/test-mi.o" -D___DYNAMIC  test-mi.c
gcc    -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common -mieee-fp    -I"/usr/local/Gambit-C/include" -c -o "/Users/per/prog/gambit/github-modules/work/compile-tmp/1/test.o1.o" -D___DYNAMIC  test.o1.c
gcc    -bundle  -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common -mieee-fp   -flat_namespace -undefined suppress  -D___DYNAMIC -I"/usr/local/Gambit-C/include" -o "/Users/per/prog/gambit/blackhole/src/test.o1"     ../../github-modules/work/compile-tmp/1/test.o1.o ../../github-modules/work/compile-tmp/1/test-rt.o ../../github-modules/work/compile-tmp/1/test-ct.o ../../github-modules/work/compile-tmp/1/test-vt.o ../../github-modules/work/compile-tmp/1/test-mi.o   


gcc    -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common -mieee-fp    -I"/usr/local/Gambit-C/include" -c -o "/Users/per/prog/gambit/github-modules/work/compile-tmp/1/test-rt.o" -D___DYNAMIC  test-rt.c
gcc    -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common -mieee-fp    -I"/usr/local/Gambit-C/include" -c -o "/Users/per/prog/gambit/github-modules/work/compile-tmp/1/test-ct.o" -D___DYNAMIC  test-ct.c
gcc    -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common -mieee-fp    -I"/usr/local/Gambit-C/include" -c -o "/Users/per/prog/gambit/github-modules/work/compile-tmp/1/test-vt.o" -D___DYNAMIC  test-vt.c
gcc    -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common -mieee-fp    -I"/usr/local/Gambit-C/include" -c -o "/Users/per/prog/gambit/github-modules/work/compile-tmp/1/test-mi.o" -D___DYNAMIC  test-mi.c
gcc    -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common -mieee-fp    -I"/usr/local/Gambit-C/include" -c -o "/Users/per/prog/gambit/github-modules/work/compile-tmp/1/test.o2.o" -D___DYNAMIC  test.o2.c
gcc    -bundle  -no-cpp-precomp -Wno-unused -O1 -fno-math-errno -fschedule-insns2 -fno-trapping-math -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common -mieee-fp   -flat_namespace -undefined suppress  -D___DYNAMIC -I"/usr/local/Gambit-C/include" -o "/Users/per/prog/gambit/blackhole/src/test.o2"     ../../github-modules/work/compile-tmp/1/test.o2.o ../../github-modules/work/compile-tmp/1/test-rt.o ../../github-modules/work/compile-tmp/1/test-ct.o ../../github-modules/work/compile-tmp/1/test-vt.o ../../github-modules/work/compile-tmp/1/test-mi.o   



More information about the Gambit-list mailing list