Issues with libpdel
I've got a weird compilation issue that I've of yet been unable to resolve.
I'm trying to use the Packet Design Embedded Library to implement an XML-RPC server, and have had little luck in linking programs to it.
Compiling the source for the library went fine, and all required files were installed. Whenever I try to link my own programs against the library, however, I come up with this:
# gcc -Wall -lpthread -lssl -lcrypto -lexpat -lpdel xmlrpc_server.c -o xmlrpc_server
/tmp/ccWS7WRj.o(.text+0x44): In function `main':
: undefined reference to `structs_init'
/tmp/ccWS7WRj.o(.text+0x98): In function `main':
: undefined reference to `http_servlet_xmlrpc_create'
collect2: ld returned 1 exit status
If I examine the library, however, everything looks fine:
# nm -g /usr/local/lib/libpdel.a | grep http_servlet_xmlrpc_create
00000000 T http_servlet_xmlrpc_create
# nm -g /usr/local/lib/libpdel.a | grep structs_init
00000000 T structs_init
Just for reference purposes, though it might not be related:
gcc version 3.3.3 (Debian 20040401)
GNU ld version 2.14.90.0.7 20031029 Debian GNU/Linux
GNU ar 2.14.90.0.7 20031029 Debian GNU/Linux
GNU ranlib 2.14.90.0.7 20031029 Debian GNU/Linux
Any ideas as to what might be up? I'm pretty clueless here, and I'd prefer not to bug the author.
Update: is the fact that the address for both functions I'm trying to use point at 00000000 have anything to do with it? If so, why might that be? I believe that all the appropriate functions were put into the library by ar.
Update 2: this part is even more confusing. I've gotten it to compile by running gcc -c then running ld manually; running gcc with -v showed it trying to run
/usr/lib/gcc-lib/i486-linux/3.3.3/collec t2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o xmlrpc_server /usr/lib/gcc-lib/i486-linux/3.3.3/../../ ../crt1.o /usr/lib/gcc-lib/i486-linux/3.3.3/../../ ../crti.o /usr/lib/gcc-lib/i486-linux/3.3.3/crtbeg in.o -L/usr/lib/gcc-lib/i486-linux/3.3.3 -L/usr/lib/gcc-lib/i486-linux/3.3.3/../. ./.. -lpthread -lssl -lcrypto -lexpat -lpdel /tmp/ccnWuY5Q.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/gcc-lib/i486-linux/3.3.3/crtend.o /usr/lib/gcc-lib/i486-linux/3.3.3/../../ ../crtn.o
which sure enough, didn't work.
If I run that manually myself, it also fails. However, I found the following that did work:
# /usr/lib/gcc-lib/i486-linux/3.3.3/collec t2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o xmlrpc_server /usr/lib/gcc-lib/i486-linux/3.3.3/../../ ../crt1.o /usr/lib/gcc-lib/i486-linux/3.3.3/../../ ../crti.o /usr/lib/gcc-lib/i486-linux/3.3.3/crtbeg in.o -L/usr/lib/gcc-lib/i486-linux/3.3.3 -L/usr/lib/gcc-lib/i486-linux/3.3.3/../. ./.. -lpthread -lssl -lcrypto -lexpat -lpdel xmlrpc_server.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/gcc-lib/i486-linux/3.3.3/crtend.o /usr/lib/gcc-lib/i486-linux/3.3.3/../../ ../crtn.o -lpdel
Apparently, I need to have the -lpdel after the object file. Anybody out there have any idea why this seems to be required, and how to fix / enforce this without manually running gcc -c and ld?
Thanks in advance.
Update 3: Firstly, I apologize for posting so much.
I've been playing with gcc's -Xlinker option. If I supply -Xlinker -t, I find that ld seems to never find libpdel.a. If, however, I also add -Xlinker -lpdel, it is appended in the command line, and it seems to find the library and compile successfully.
Is this some sort of weird, obscure bug?
I'm trying to use the Packet Design Embedded Library to implement an XML-RPC server, and have had little luck in linking programs to it.
Compiling the source for the library went fine, and all required files were installed. Whenever I try to link my own programs against the library, however, I come up with this:
# gcc -Wall -lpthread -lssl -lcrypto -lexpat -lpdel xmlrpc_server.c -o xmlrpc_server
/tmp/ccWS7WRj.o(.text+0x44): In function `main':
: undefined reference to `structs_init'
/tmp/ccWS7WRj.o(.text+0x98): In function `main':
: undefined reference to `http_servlet_xmlrpc_create'
collect2: ld returned 1 exit status
If I examine the library, however, everything looks fine:
# nm -g /usr/local/lib/libpdel.a | grep http_servlet_xmlrpc_create
00000000 T http_servlet_xmlrpc_create
# nm -g /usr/local/lib/libpdel.a | grep structs_init
00000000 T structs_init
Just for reference purposes, though it might not be related:
gcc version 3.3.3 (Debian 20040401)
GNU ld version 2.14.90.0.7 20031029 Debian GNU/Linux
GNU ar 2.14.90.0.7 20031029 Debian GNU/Linux
GNU ranlib 2.14.90.0.7 20031029 Debian GNU/Linux
Any ideas as to what might be up? I'm pretty clueless here, and I'd prefer not to bug the author.
Update: is the fact that the address for both functions I'm trying to use point at 00000000 have anything to do with it? If so, why might that be? I believe that all the appropriate functions were put into the library by ar.
Update 2: this part is even more confusing. I've gotten it to compile by running gcc -c then running ld manually; running gcc with -v showed it trying to run
/usr/lib/gcc-lib/i486-linux/3.3.3/collec
which sure enough, didn't work.
If I run that manually myself, it also fails. However, I found the following that did work:
# /usr/lib/gcc-lib/i486-linux/3.3.3/collec
Apparently, I need to have the -lpdel after the object file. Anybody out there have any idea why this seems to be required, and how to fix / enforce this without manually running gcc -c and ld?
Thanks in advance.
Update 3: Firstly, I apologize for posting so much.
I've been playing with gcc's -Xlinker option. If I supply -Xlinker -t, I find that ld seems to never find libpdel.a. If, however, I also add -Xlinker -lpdel, it is appended in the command line, and it seems to find the library and compile successfully.
Is this some sort of weird, obscure bug?
