Sure. I think the solution is really simple. So what is it you want to do, you have a file xyz.scm that you want to compile to >1 target platforms?
If so, just to the GAMBC_CC_VERBOSE thing I suggested to get the gcc + ld commands for your local platform. Then just adapt those for your respective target platforms.
To then get the full set of C files for xyz.scm, do (compile-file "xyz.scm") and then I think (link-incremental "mylinkfile.c" '("xyz")) in the same directory, and the full set of C files for your program will bemylinkfile.c + xyz.c . To compile those, gcc needs -I with your Gambit-C/include directory, and ld needs something like -lgsc , and maybe some define is needed - again the GAMBC_CC_VERBOSE thing clarifies that.
I believe compile-file corresponds to the -c gsc option, and perhaps link-incremental is the -incremental option. Note that the link file production procedure requires both the total set of C file inputs, and the output filename for the link file, so (at least) two arguments.
However, I wanted to express my gratitude for this quick reply; it will
definitely be a pleasure to write an article about this problem's solution, if I find the solution. Now, I am confident that this is a problem that interests a number of people here and I eagerly await your replies.
As far as gambit is concerned, I poked around the internet and kept on
trying a few more incantations. Presently, I have a deadline so "real work" has to take priority :(
Alvaro (CC) knows how to do this. He's in Europe. I believe he will be
able to respond to you the next 3-4 hours.
Colin, when you know the answer, please write it up on the wiki. The reason you are experiencing this now is because others before you did not write it up.
Where are you?
I tried various other variations. No dice. It's a shame such an option
isn't immediately apparent, as Gambit's biggest usecase is embeddding. :( Could the Mark give us an answer?
When you figured the answer, please write it up on the wiki for
instance a new page "How file compilation to C and to binary and link files and linking fit together". I believe your issue is either not having gambit.h included, or not having gambc linked in, or having your link file situation messed up - basically when compiling to binary or dylib (dylib is what |load| takes as binary file input), Gambit will produce a link file for properly exporting identifiers, and when you try to compile without one, you get every possible error. There are examples in the manual.
The Gambit command line arguments for compilation e.g "-c" map internally to compile-file-to-c etc., other to link-incremental etc., so there are always double ways to do these things.
Hi,
Pardon the silly noob question, but I've been trying to use Gambit to quickly write up a small submodule, and then use each target's native compiler to embed it into the build. Unfortunately, I am getting link errors:
Is my my mini program: hello.scm: (display "hello") (newline)
Here is what happens when I try to use it.
>> gsc -c hello.scm *** INFO -- loading syntax expander
>> gcc hello.c
cc hello.c /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.3/../../../../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' /tmp/ccpGbiFh.o: In function `___H__20_hello': hello.c:(.text+0x8d): undefined reference to `___gstate0' hello.c:(.text+0xd4): undefined reference to `___gstate0' hello.c:(.text+0xee): undefined reference to `___G_display' hello.c:(.text+0x132): undefined reference to `___G_display' hello.c:(.text+0x144): undefined reference to `___gstate0' hello.c:(.text+0x176): undefined reference to `___gstate0' hello.c:(.text+0x194): undefined reference to `___G_newline' hello.c:(.text+0x1d5): undefined reference to `___G_newline' hello.c:(.text+0x1e7): undefined reference to `___gstate0' /tmp/ccpGbiFh.o: In function `___setup_mod': hello.c:(.text+0x25c): undefined reference to `___G__20_hello' /tmp/ccpGbiFh.o: In function `___init_mod': hello.c:(.text+0x26f): undefined reference to `___gstate0' hello.c:(.text+0x281): undefined reference to `___G__20_hello' /tmp/ccpGbiFh.o: In function `____20_hello': hello.c:(.text+0x29b): undefined reference to `___S_hello' collect2: error: ld returned 1 exit status
I tried using -link, -flat,-link -flat but no real difference.
What files need to be present before you can compile the code natively?
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Afficher les réponses par date