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.

2015-02-11 10:10 GMT+05:30 Colin Gilbert <colingilbert86@gmail.com>:
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