Hello, I'm trying out the example instructions for bundling multiple source files into something that can be loaded with `load', but it appears a symbol is missing: (this is on linux)
% gsc -flat -o foo.c m2 m3 % gcc -shared -fPIC -D___DYNAMIC m1.c m2.c m3.c foo.c -o foo.o1 -I/usr/local/Gambit-C/include % gsi foo *** ERROR IN ##main -- /tmp/foo.o1: undefined symbol: ____20_foo_2e_o1 (load "foo")
And a thank you to all the Gambit authors.
Peter
Afficher les réponses par date
Hello, I'm trying out the example instructions for bundling multiple source files into something that can be loaded with `load', but it appears a symbol is missing: (this is on linux)
% gsc -flat -o foo.c m2 m3 % gcc -shared -fPIC -D___DYNAMIC m1.c m2.c m3.c foo.c -o foo.o1 -I/usr/local/Gambit-C/include % gsi foo *** ERROR IN ##main -- /tmp/foo.o1: undefined symbol: ____20_foo_2e_o1 (load "foo")
The documentation is out of sync. Now you have to explicitly add the ".oN" extension of the generated shared library in the name of the C file. That is you should do this:
% gsc -flat -o foo.o1.c m2 m3 % gcc -shared -fPIC -D___DYNAMIC m1.c m2.c m3.c foo.o1.c -o foo.o1 -I/usr/local/Gambit-C/include
This is necessary to allow multiple versions of a module to be loaded at the same time on some systems.
Marc
On Sun, 24 Oct 2004, Marc Feeley wrote:
The documentation is out of sync. Now you have to explicitly add the ".oN" extension of the generated shared library in the name of the C file. That is you should do this:
% gsc -flat -o foo.o1.c m2 m3 % gcc -shared -fPIC -D___DYNAMIC m1.c m2.c m3.c foo.o1.c -o foo.o1 -I/usr/local/Gambit-C/include
This is necessary to allow multiple versions of a module to be loaded at the same time on some systems.
Perhaps I'm wrong in thinking that nothing need be changed to do this on OS X (except changing -shared to -dynamic), but I get a slightly different error with the suggested fix:
% gsc -flat -o foo.o1.c foo % gcc -dynamic -fPIC -D___DYNAMIC foo.c foo.o1.c -o foo.o1 -lgambc -I/usr/local/Gambit-C/include ld: Undefined symbols: _main
[Note that you need to subscribe to gambit-list to post a message there...]
The documentation is out of sync. Now you have to explicitly add the ".oN" extension of the generated shared library in the name of the C file. That is you should do this:
% gsc -flat -o foo.o1.c m2 m3 % gcc -shared -fPIC -D___DYNAMIC m1.c m2.c m3.c foo.o1.c -o foo.o1 -I/usr/local/Gambit-C/include
This is necessary to allow multiple versions of a module to be loaded at the same time on some systems.
Perhaps I'm wrong in thinking that nothing need be changed to do this on OS X (except changing -shared to -dynamic), but I get a slightly different error with the suggested fix:
% gsc -flat -o foo.o1.c foo % gcc -dynamic -fPIC -D___DYNAMIC foo.c foo.o1.c -o foo.o1 -lgambc -I/usr/local/Gambit-C/include ld: Undefined symbols: _main
No, on Mac OS X you need the "-bundle" option. For example:
% uname -srmp Darwin 7.5.0 Power Macintosh powerpc % gcc -bundle -D___DYNAMIC m1.c m2.c m3.c foo.o1.c -o foo.o1 % gsi foo.o1 ((2 . 2) (4 . 4) (8 . 8) (16 . 16))
Marc