<div dir="ltr">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?<div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div><br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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. <br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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 :(<br></div><div><div><div class="gmail_extra"><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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.<div><br></div><div>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.</div><div><br></div><div>Where are you?</div><div><br></div></div><div><div><div class="gmail_extra"><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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?<br></div><div><div><div class="gmail_extra"><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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.<div><br></div><div>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.</div></div><div class="gmail_extra"><div class="gmail_quote"><span><br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div>Hi,<br><br></div>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:<br><div><br>Is my my mini program:<br>hello.scm: (display "hello") (newline)<br><br>Here is what happens when I try to use it.<br><br>>> gsc -c hello.scm<br>*** INFO -- loading syntax expander<br><br>>> gcc hello.c<br><br>cc hello.c<br>/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.3/../../../../lib64/crt1.o: In function `_start':<br>(.text+0x20): undefined reference to `main'<br>/tmp/ccpGbiFh.o: In function `___H__20_hello':<br>hello.c:(.text+0x8d): undefined reference to `___gstate0'<br>hello.c:(.text+0xd4): undefined reference to `___gstate0'<br>hello.c:(.text+0xee): undefined reference to `___G_display'<br>hello.c:(.text+0x132): undefined reference to `___G_display'<br>hello.c:(.text+0x144): undefined reference to `___gstate0'<br>hello.c:(.text+0x176): undefined reference to `___gstate0'<br>hello.c:(.text+0x194): undefined reference to `___G_newline'<br>hello.c:(.text+0x1d5): undefined reference to `___G_newline'<br>hello.c:(.text+0x1e7): undefined reference to `___gstate0'<br>/tmp/ccpGbiFh.o: In function `___setup_mod':<br>hello.c:(.text+0x25c): undefined reference to `___G__20_hello'<br>/tmp/ccpGbiFh.o: In function `___init_mod':<br>hello.c:(.text+0x26f): undefined reference to `___gstate0'<br>hello.c:(.text+0x281): undefined reference to `___G__20_hello'<br>/tmp/ccpGbiFh.o: In function `____20_hello':<br>hello.c:(.text+0x29b): undefined reference to `___S_hello'<br>collect2: error: ld returned 1 exit status<br><br>I tried using -link, -flat,-link -flat but no real difference.<br><br>What files need to be present before you can compile the code natively?<br><br></div></div>
<br></div></div><span>_______________________________________________<br>
Gambit-list mailing list<br>
<a href="mailto:Gambit-list@iro.umontreal.ca" target="_blank">Gambit-list@iro.umontreal.ca</a><br>
<a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br>
<br></span></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>