I tried to compile the new version: gambc-4.0b22.tar.gz on a Sun-Solaris machine with gcc --version 2.95.3
During compiling gsi, there are many messages like warning: implicit declaration of function `__builtin_expect'
And then at the final link step, it fails with undefined reference to `__builtin_expect'
-----------------------------
I tried to rebuilt the old version 4.0b20 by the same processes and it succeeded.
So, there might be something missing in the package in gambc-4.0b22.tar.gz
--HP
Afficher les réponses par date
On Apr 6, 2007, at 4:00 PM, HP Wei wrote:
I tried to compile the new version: gambc-4.0b22.tar.gz on a Sun-Solaris machine with gcc --version 2.95.3
This is a very old version of gcc.
During compiling gsi, there are many messages like warning: implicit declaration of function `__builtin_expect'
And then at the final link step, it fails with undefined reference to `__builtin_expect'
I tried to rebuilt the old version 4.0b20 by the same processes and it succeeded.
So, there might be something missing in the package in gambc-4.0b22.tar.gz
Something was added; versions of gcc more recent than 2.95.3 (they're now up to 4.1.2) have __builtin_expect built in, as it were, and Marc is using it in beta 22, but it appears that gambit.h checks only whether gcc is being used as the compiler, not whether a very old version of gcc is being used.
Try to change one line in include/gambit.h to be
[descartes:~/programs/gambc-4.0b22/include] lucier% rcsdiff gambit.h =================================================================== RCS file: RCS/gambit.h,v retrieving revision 1.1 diff -r1.1 gambit.h 1354c1354 < #ifdef __GNUC__ ---
#if __GNUC__ >= 3
Brad Lucier
On Apr 6, 2007, at 5:03 PM, Bradley Lucier wrote:
Try to change one line in include/gambit.h to be
[descartes:~/programs/gambc-4.0b22/include] lucier% rcsdiff gambit.h
RCS file: RCS/gambit.h,v retrieving revision 1.1 diff -r1.1 gambit.h 1354c1354
< #ifdef __GNUC__
#if __GNUC__ >= 3
Sorry, that won't work for non-gcc compilers, try
rcsdiff gambit.h =================================================================== RCS file: RCS/gambit.h,v retrieving revision 1.1 diff -r1.1 gambit.h 1354a1355
#if __GNUC__ >= 3
1356a1358
#endif
Can anyone tell me how I go about using a shared library compiled on a Sun-solaris with gambit.4.0b22 ?
Note: gsi and gsc were built with --enable-shared
Here is the process of building termite as shared lib. (1) download termite.tar.gz from the web site untar it to ~/gambit/current/termite
(2) cd ~/gambit/current gsc -link -o termite.c termite/termite.scm
(3) gcc -shared -fPIC -D___LIBRARY -D___SHARED termite.c -o libtermite.so
(4) mv libtermite.so to ~/gambit/current/lib
----------------------------------
Questions:
(a) in a gsi session, how do I use functions in libtermite.so ?
(b) what about in a compiled scm file which uses functions in termite ?
thanks HP
HP Wei:
Questions:
(a) in a gsi session, how do I use functions in libtermite.so ?
Not sure if it works in gsi, but can't you just do a (load "..../libtermite.so") and use the termite functions directly?
TJ
On 7-Apr-07, at 8:13 PM, HP Wei wrote:
Can anyone tell me how I go about using a shared library compiled on a Sun-solaris with gambit.4.0b22 ?
Note: gsi and gsc were built with --enable-shared
Here is the process of building termite as shared lib. (1) download termite.tar.gz from the web site untar it to ~/gambit/current/termite
(2) cd ~/gambit/current gsc -link -o termite.c termite/termite.scm
(3) gcc -shared -fPIC -D___LIBRARY -D___SHARED termite.c -o libtermite.so
(4) mv libtermite.so to ~/gambit/current/lib
Questions:
(a) in a gsi session, how do I use functions in libtermite.so ?
(b) what about in a compiled scm file which uses functions in termite ?
Why don't you simply compile Termite to a dynamically loadable file (i.e. termite.o1) and load that with a (load "termite")?
Alternatively you could build a shared library which includes the Gambit runtime system and Termite, and then use that as a base runtime system when linking applications which use Termite.
I have an example of how this can be done (including makefile) for the GLUT OpenGL library on Mac OS X. It is not Termite and not Solaris, but it may clarify how to build a library as a dynamically loadable file and as a shared library. The GLUT example is also interesting because it shows how to link to an existing non-trivial C library.
Marc
Thanks for Marc and TJ for their replies to my previous and an example from Marc from a real project.
As I look more into gambit-c system, I find more questions.
In ~~/examples/misc/signals.scm, there are these function-like stuff: ##interrupt-vector-set! ##os-getpid
In many other examples, I see ##namespace, ##include, ##time, ##gc etc...
Then, I could not find any info about these ##xyz in gambc-4.0b22/doc/gambit-c.html
Are they documented somewhere ??
thanks HP
HP Wei wrote:
Are they documented somewhere ??
I can't speak for Marc, but those are probably not meant to be documented. Those are "undocumented internals" :), or at least not been planned by him for public consumption. Albeit I agree that many of those are very useful. I think they should probably not have a place in the official manual, but it could help if the Gambit internals are better documented in the sources, and maybe the more useful functions/syntax identifyiers could be documented in the wiki.
Christian.