public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* static lib problem
@ 2004-05-25 10:47 De Leeuw Guy
  2004-05-25 12:09 ` Eljay Love-Jensen
  0 siblings, 1 reply; 4+ messages in thread
From: De Leeuw Guy @ 2004-05-25 10:47 UTC (permalink / raw)
  To: gcc-help

Hello,
I'm a new user of gcc and I have a little problem when I try to link
with a static library

Building library :
==================
gcc -DCOMP_OS=3 -o Linux/gdtsf.o -I/usr/include -I/usr/local/include 
-I../../hdr -c ../../srcLassie/gdtsf.c
gcc -DCOMP_OS=3 -o Linux/gdtypes.o -I/usr/include -I/usr/local/include 
-I../../hdr -c ../../srcLassie/gdtypes.c
ar -rs Linux/liblassiec.a Linux/*.o;


Building object :
=================
gcc -c -DCOMP_OS=3 -I/usr/include -I/usr/local/include  -I../../hdr -o
Linux/crlf.o ../../srcExe/crlf.c

Building executable :
=====================
ld -o Linux/crlf Linux/crlf.o -L/lib -L/usr/lib
-L../../libLassiec/Unix/Linux -Bstatic -llassiec -lisam -lc_nonshared

[guy@pcGDL Unix]$ ld -o Linux/crlf Linux/crlf.o -L/lib -L/usr/lib
-L../../libLassiec/Unix/Linux -Bstatic -llassiec -lisam -lc_nonshared
ld: warning: cannot find entry symbol _start; defaulting to
0000000008048094
Linux/crlf.o(.text+0x31): In function `main':
: undefined reference to `printf'
Linux/crlf.o(.text+0x41): In function `main':
: undefined reference to `printf'
...
...
...

Wich libraries are mising ?

I try also :
ld -o Linux/crlf Linux/crlf.o -L/lib -L/usr/lib
-L../../libLassiec/Unix/Linux -Bstatic -llassiec -lisam -lc_nonshared
-Bdynamic -lresolv
ld: warning: cannot find entry symbol _start; defaulting to
0000000008048310

HERE THE PROBLEM :
==================
[guy@pcGDL Unix]$ Linux/crlf
bash: Linux/crlf: No such file or directory
[guy@pcGDL Unix]$

[guy@pcGDL Unix]$ ll Linux/crlf*
-rwxr-xr-x  1 guy guy 4002 mai 25 12:41 Linux/crlf*
-rw-r--r--  1 guy guy 2720 mai 25 12:23 Linux/crlf.o
[guy@pcGDL Unix]$

[guy@pcGDL Unix]$ file Linux/crlf
Linux/crlf: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), not stripped
[guy@pcGDL Unix]$

[guy@pcGDL Unix]$ ldd Linux/crlf
/usr/bin/ldd: line 1: Linux/crlf: No such file or directory
[guy@pcGDL Unix]$

Version :
=========
[guy@pcGDL guy]$ gcc -v
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib
--with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info
--enable-shared --enable-threads=posix --disable-checking
--enable-long-long --enable-__cxa_atexit --enable-clocale=gnu
--enable-languages=c,c++,ada,f77,objc,java,pascal
--host=i586-mandrake-linux-gnu --with-system-zlib
Thread model: posix
gcc version 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
[guy@pcGDL guy]$

[guy@pcGDL guy]$ ld -v
GNU ld version 2.14.90.0.7 20031029
[guy@pcGDL guy]$


Thanks in advance for your help
Guy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: static lib problem
  2004-05-25 10:47 static lib problem De Leeuw Guy
@ 2004-05-25 12:09 ` Eljay Love-Jensen
  2004-05-25 12:27   ` De Leeuw Guy
  0 siblings, 1 reply; 4+ messages in thread
From: Eljay Love-Jensen @ 2004-05-25 12:09 UTC (permalink / raw)
  To: De Leeuw Guy, gcc-help

Hi Guy,

Try this for Building the executable (all one line):
gcc -o Linux/crlf Linux/crlf.o
-L../../libLassiec/Unix/Linux -Wl,-Bstatic -llassiec -lisam -lc_nonshared

HTH,
--Eljay

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: static lib problem
  2004-05-25 12:09 ` Eljay Love-Jensen
@ 2004-05-25 12:27   ` De Leeuw Guy
  2004-05-25 13:16     ` Eljay Love-Jensen
  0 siblings, 1 reply; 4+ messages in thread
From: De Leeuw Guy @ 2004-05-25 12:27 UTC (permalink / raw)
  To: Eljay Love-Jensen; +Cc: gcc-help

Hello and many thanks, work now ;-))
But what is the problem ???

Guy

Le mar 25/05/2004 à 14:08, Eljay Love-Jensen a écrit :
> Hi Guy,
> 
> Try this for Building the executable (all one line):
> gcc -o Linux/crlf Linux/crlf.o
> -L../../libLassiec/Unix/Linux -Wl,-Bstatic -llassiec -lisam -lc_nonshared
> 
> HTH,
> --Eljay
-- 
G. De Leeuw
IT Manager
Eurofer ASBL
211, rue du noyer
1000 Brussels
email: G.De_Leeuw@eurofer.be
www : http://www.eurofer.org
Phone : +32 2 738 79 40


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: static lib problem
  2004-05-25 12:27   ` De Leeuw Guy
@ 2004-05-25 13:16     ` Eljay Love-Jensen
  0 siblings, 0 replies; 4+ messages in thread
From: Eljay Love-Jensen @ 2004-05-25 13:16 UTC (permalink / raw)
  To: De Leeuw Guy; +Cc: gcc-help

Hi Guy,

 >But what is the problem ???

The problem was that you were using "ld" directly, instead of "gcc".

To see how gcc invoked ld "under the covers", do this...

gcc -v -o Linux/crlf Linux/crlf.o
-L../../libLassiec/Unix/Linux -Wl,-Bstatic -llassiec -lisam -lc_nonshared

HTH,
--Eljay

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-05-25 13:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-25 10:47 static lib problem De Leeuw Guy
2004-05-25 12:09 ` Eljay Love-Jensen
2004-05-25 12:27   ` De Leeuw Guy
2004-05-25 13:16     ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).