From: Julian St.
Subject: ECL linking problems.
Date: 
Message-ID: <86wufyq7h4.fsf@jmmr.no-ip.com>
Hello,

I have serious problems with linking C code to the ECL libraries on FreeBSD 5.

My try was:

cc -O -pipe -mcpu=pentiumpro `ecl-config --cflags` -c main.c
cc -O -pipe -mcpu=pentiumpro `ecl-config --cflags` `ecl-config --ldflags` -o ecltest main.o 

/home/blitz/src/own/c/ecltest/main.c:5: undefined reference to `cl_boot'
*** Error code 1


main.c itself contains the following:

#include <ecl.h>

int main(int argc, char *argv[])
{
        cl_boot(argc, argv); 

        return 0;
}

if I remove the cl_boot line then linking completes but the resulting
executable is only 20kb in size indicating that the ECL libraries were
"left out".

The output of ecl-config:

> ecl-config --ldflags
-L/usr/local/lib/ecl -lecl -lclos -llsp  -Wl,--export-dynamic -lgc -lcompat -lgmp -lm

> ecl-config --cflags
-g -O2 -fstrict-aliasing -Dfreebsd -I/usr/local/lib/ecl/h

I hope this is not as off-topic as it seems. :) Thanks in advance for
any help.

Regards,
Julian

-- 
                           Reboot America.

From: Juanjo
Subject: Re: ECL linking problems.
Date: 
Message-ID: <ab4b7d4.0306071344.5640a2e0@posting.google.com>
··········@web.de (Julian St.) wrote in message news:<··············@jmmr.no-ip.com>...
> Hello,
> 
> I have serious problems with linking C code to the ECL libraries on FreeBSD 5.
> My try was:
> 
> cc -O -pipe -mcpu=pentiumpro `ecl-config --cflags` -c main.c
> cc -O -pipe -mcpu=pentiumpro `ecl-config --cflags` `ecl-config --ldflags` -o ecltest main.o 
> /home/blitz/src/own/c/ecltest/main.c:5: undefined reference to `cl_boot'
> *** Error code 1

This error is due to the fact that, when invoking the C
compiler/linker, you put the libraries _before_ the code that uses the
libraries. The right way to do it:

cc -O -pipe -o ecltest main.o `ecl-config --cflags` `ecl-config
--ldflags`

Of course this fact has nothing with lisp to do }:-] And please doubt
not writing to the ECL mailing list when new problems arise.

Best wishes,

Juanjo
From: Julian St.
Subject: Re: ECL linking problems.
Date: 
Message-ID: <863cil1hdh.fsf@jmmr.no-ip.com>
····@arrakis.es (Juanjo) writes:

>> cc -O -pipe -mcpu=pentiumpro `ecl-config --cflags` `ecl-config --ldflags` -o ecltest main.o 
>> /home/blitz/src/own/c/ecltest/main.c:5: undefined reference to `cl_boot'
>> *** Error code 1
>
> This error is due to the fact that, when invoking the C
> compiler/linker, you put the libraries _before_ the code that uses the
> libraries. The right way to do it:
>
> cc -O -pipe -o ecltest main.o `ecl-config --cflags` `ecl-config
> --ldflags`

That indeed works. Thank you. I seriously thought that bsd.prog.mk
(the Makefile template I used) would do the right thing...

> Of course this fact has nothing with lisp to do }:-] And please doubt
> not writing to the ECL mailing list when new problems arise.

Ok.

> Best wishes,
>
> Juanjo

Regards,
Julian
-- 
                           Reboot America.