Peter Weilbacher | 24 May 2006 19:45

Linking with -lsocket

I am not sure if this is the group to also post GCC (as opposed to LIBC)
questions. If not, tell me where to go.

I was trying to build GnuPG 1.4.3 with the current GCC 3.3.5 the other 
day. following the instructions on Tobias Hürlimann's webpage
   http://www.tobiashuerlimann.de/software/GnuPG/?id=building&lang=en
When linking keyserver/gpgkeys_hkp.exe I get the message that several 
symbols cannot be found (see command and output below) because 
/lib/libsocket.a does not exist? Compiling while including 
$GCCDIR2/lib/libsocket.a on the command line works.

What could influence GCC to look for libsocket.a in /lib while it is 
really located in  m:/MOZCOMPILE/GCC335/lib? Why does it still find all 
the other libraries it needs for linking?
-- 
Greetings,                                                             ^
   Peter.

----------- output linking gpgkeys_hkp.exe ---------------
1. normal way

$ gcc -v -s -Zexe -Zmt -o gpgkeys_hkp.exe gpgkeys_hkp.o curl-shim.o 
ksutil.o -lsocket  -lbz2 -Le:/Tools ../cipher/libcipher.a 
./mpi/libmpi.a ../util/libutil.a  ../os2/gpgos2.a
Reading specs from 
m:/MozCompile/GCC335/lib/gcc-lib/i386-pc-os2-emx/3.3.5/specs
Configured with: D:/CODING/LIBC/0.6/src/gcc/configure --enable-clh 
--enable-threads=os2 --enable-shared=libgcc,bfd,opcodes --enable-nls 
--without-included-gettext 
--with-local-prefix=D:/CODING/LIBC/0.6/TOOLS/x86.os2/gcc/staged 
--prefix=/gcc --with-gnu-as --disable-libgcj --enable-languages=c,c++
Thread model: os2
gcc version 3.3.5 (Bird Build 2006-03-18 05:37)
 m:/MozCompile/GCC335/i386-pc-os2-emx/bin/ld.exe -Zexe -o 
gpgkeys_hkp.exe -s m:/MOZCOMPILE/GCC335/lib/crt0.o -Le:/Tools 
-Lm:/MozCompile/GCC335/lib/gcc-lib/i386-pc-os2-emx/3.3.5 
-Lm:/MozCompile/GCC335/lib/gcc-lib -Lm:/MOZCOMPILE/GCC335/lib/tcpipv4 
-Lm:/MOZCOMPILE/GCC335/lib -LP:/TOOLKIT/lib 
-Ly:/Compile/gnupg-1.4.3-os2-src/gnupg-1.4.3/keyserver 
-Lm:/MOZCOMPILE/GCC335/lib/gcc-lib/i386-pc-os2-emx/3.3.5 
-Lm:/MozCompile/GCC335/i386-pc-os2-emx/lib 
-Lm:/MOZCOMPILE/GCC335/i386-pc-os2-emx/lib -Lm:/MozCompile/GCC335/lib 
gpgkeys_hkp.o curl-shim.o ksutil.o -lsocket -lbz2 ../cipher/libcipher.a 
./mpi/libmpi.a ../util/libutil.a ../os2/gpgos2.a -lc_alias -lc_dll 
-los2 -lgcc_so_d -lc_alias -lc_dll -los2 -lgcc_so_d -lc_alias -lc_dll 
-los2 -lgcc_so_d -lc_alias -lc_dll -los2 -lgcc_so_d -lc_alias -lc_dll 
-los2
../util/libutil.a(srv.o): Undefined symbol ___res_query referenced from 
text segment
../util/libutil.a(srv.o): Undefined symbol ___dn_skipname referenced from
text segment
../util/libutil.a(srv.o): Undefined symbol ___dn_skipname referenced from
text segment
../util/libutil.a(srv.o): Undefined symbol ___dn_expand referenced from 
text segment
gcc: /lib/libsocket.a: No such file or directory

2. specifically including libsocket.a

$ gcc -v -s -Zexe -Zmt -o gpgkeys_hkp.exe gpgkeys_hkp.o curl-shim.o 
ksutil.o -lsocket  -lbz2 -Le:/Tools ../cipher/libcipher.a 
./mpi/libmpi.a ../util/libutil.a  ../os2/gpgos2.a 
m:/MOZCOMPILE/GCC335/lib/libsocket.a
Reading specs from 
m:/MozCompile/GCC335/lib/gcc-lib/i386-pc-os2-emx/3.3.5/specs
Configured with: D:/CODING/LIBC/0.6/src/gcc/configure --enable-clh 
--enable-threads=os2 --enable-shared=libgcc,bfd,opcodes --enable-nls 
--without-included-gettext 
--with-local-prefix=D:/CODING/LIBC/0.6/TOOLS/x86.os2/gcc/staged 
--prefix=/gcc --with-gnu-as --disable-libgcj --enable-languages=c,c++
Thread model: os2
gcc version 3.3.5 (Bird Build 2006-03-18 05:37)
gcc: /lib/libsocket.a: No such file or directory
Reading specs from 
m:/MozCompile/GCC335/lib/gcc-lib/i386-pc-os2-emx/3.3.5/specs
Configured with: D:/CODING/LIBC/0.6/src/gcc/configure --enable-clh 
--enable-threads=os2 --enable-shared=libgcc,bfd,opcodes --enable-nls 
--without-included-gettext 
--with-local-prefix=D:/CODING/LIBC/0.6/TOOLS/x86.os2/gcc/staged 
--prefix=/gcc --with-gnu-as --disable-libgcj --enable-languages=c,c++
Thread model: os2
gcc version 3.3.5 (Bird Build 2006-03-18 05:37)
Reading specs from 
m:/MozCompile/GCC335/lib/gcc-lib/i386-pc-os2-emx/3.3.5/specs
Configured with: D:/CODING/LIBC/0.6/src/gcc/configure --enable-clh 
--enable-threads=os2 --enable-shared=libgcc,bfd,opcodes --enable-nls 
--without-included-gettext 
--with-local-prefix=D:/CODING/LIBC/0.6/TOOLS/x86.os2/gcc/staged 
--prefix=/gcc --with-gnu-as --disable-libgcj --enable-languages=c,c++
Thread model: os2
gcc version 3.3.5 (Bird Build 2006-03-18 05:37)
 m:/MozCompile/GCC335/i386-pc-os2-emx/bin/ld.exe -Zexe -o 
gpgkeys_hkp.exe -s m:/MOZCOMPILE/GCC335/lib/crt0.o -Le:/Tools 
-Lm:/MozCompile/GCC335/lib/gcc-lib/i386-pc-os2-emx/3.3.5 
-Lm:/MozCompile/GCC335/lib/gcc-lib -Lm:/MOZCOMPILE/GCC335/lib/tcpipv4 
-Lm:/MOZCOMPILE/GCC335/lib -LP:/TOOLKIT/lib 
-Ly:/Compile/gnupg-1.4.3-os2-src/gnupg-1.4.3/keyserver 
-Lm:/MOZCOMPILE/GCC335/lib/gcc-lib/i386-pc-os2-emx/3.3.5 
-Lm:/MozCompile/GCC335/i386-pc-os2-emx/lib 
-Lm:/MOZCOMPILE/GCC335/i386-pc-os2-emx/lib -Lm:/MozCompile/GCC335/lib 
gpgkeys_hkp.o curl-shim.o ksutil.o -lsocket -lbz2 ../cipher/libcipher.a 
./mpi/libmpi.a ../util/libutil.a ../os2/gpgos2.a 
m:/MOZCOMPILE/GCC335/lib/libsocket.a -lc_alias -lc_dll -los2 -lgcc_so_d 
-lc_alias -lc_dll -los2 -lgcc_so_d -lc_alias -lc_dll -los2 -lgcc_so_d 
-lc_alias -lc_dll -los2 -lgcc_so_d -lc_alias -lc_dll -los2

Gmane