[gambit-list] Compiling with C libraries?

Jeremie Lasalle Ratelle pouexmachinax at gmail.com
Mon Mar 17 18:18:15 EDT 2008


-lm -ldl -lutil

On Mon, Mar 17, 2008 at 5:10 PM, David St-Hilaire <sthilaid at iro.umontreal.ca>
wrote:

> Hello!
>
> I'm trying to compile a simple file which uses a bit of math and list
> functions.
> As far as I can remember, I never used other libraries than -lgambit when
> compiling the generated .c files, but now, it seems that I need to add
> also -lm
> to include the C math library... If I don't I get something like:
>
> gcc -I/opt/gambit-c/current/include -o question3 scm-lib.c Question3.c
> Question3_.c -lgambc -lutil -L/opt/gambit-c/current/lib
> /tmp/ccitDGGo.o: In function `___H_standard_2d_deviation':
> scm-lib.c:(.text+0xcfa4): undefined reference to `sqrt'
> /tmp/cc7ItBpa.o: In function `___H_standard_2d_deviation':
> Question3.c:(.text+0xd1c3): undefined reference to `sqrt'
> /opt/gambit-c/current/lib/libgambc.a(setup.o): In function `___setup':
> setup.c:(.text+0x199d): undefined reference to `fabs'
> setup.c:(.text+0x19bd): undefined reference to `floor'
> setup.c:(.text+0x19e7): undefined reference to `ceil'
> setup.c:(.text+0x1a11): undefined reference to `exp'
> ...
> os_dyn.c:(.text+0x80): undefined reference to `dlclose'
> /opt/gambit-c/current/lib/libgambc.a(os_dyn.o): In function
> `___dynamic_load':
> os_dyn.c:(.text+0x296): undefined reference to `dlopen'
> os_dyn.c:(.text+0x2ad): undefined reference to `dlsym'
> os_dyn.c:(.text+0x2c6): undefined reference to `dlerror'
> os_dyn.c:(.text+0x2f8): undefined reference to `dlclose'
> ...
> /opt/gambit-c/current/lib/libgambc.a(_num.o): In function
> `___H__20___num':
> _num.c:(.text+0x1d7bb): undefined reference to `exp'
> _num.c:(.text+0x1d820): undefined reference to `exp'
> _num.c:(.text+0x1d9c2): undefined reference to `exp'
> _num.c:(.text+0x1de92): undefined reference to `log'
> _num.c:(.text+0x1e0fb): undefined reference to `log'
> _num.c:(.text+0x1e2bd): undefined reference to `log'
> _num.c:(.text+0x1e4af): undefined reference to `sin'
> ...
> collect2: ld returned 1 exit status
> make: *** [question3] Error 1
>
>
> As you can see, there is also some other missing library (using dlopen,
> etc...)
> which I don't know of... If I add -lm on my compilation line, then I
> remove all
> the math related errors, but I still get those related to dlopen, etc...
>
> What's going on? Is this normal? I'm pretty sure that I never had to
> compile
> with -lm before. I also compile with -lutil because Marc told me to, but
> I'm not
> sure I understand why either...
>
> Thanks! ^_^
>
> David
>
>
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20080317/b7988765/attachment.htm>


More information about the Gambit-list mailing list