I'm baffled by an "undefined symbol" linking error I'm getting. I
created a library using ar and ranlib. Running nm clearly lists the
relevant symbols in the text section, but when I try to compile, it
complains that they are not there. Compiling works just fine on my
macbook, but when I try to compile in a Fedora linux box, I get
undefined symbol complaints. I've included the gcc output and the nm
output below.
Any help is very much appreciated!
Thanks,
Nick
-----
gcc -v -W -Wall -g -o clue-keygen -I/usr/local/include/pbc -I../
include -L/home/someguy/clue/lib -L/usr/local/lib -lgmp -lpbc -
lpbc_sig -lclue clue-keygen.c
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.4/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --
disable-checking --with-system-zlib --enable-__cxa_atexit --disable-
libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)
/usr/libexec/gcc/i386-redhat-linux/3.4.4/cc1 -quiet -v -I/usr/local/
include/pbc -I../include clue-keygen.c -quiet -dumpbase clue-keygen.c
-auxbase clue-keygen -g -W -Wall -version -o /tmp/cc3T1TTO.s
ignoring nonexistent directory "/usr/lib/gcc/i386-redhat-linux/
3.4.4/../../../../i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include/pbc
../include
/usr/local/include
/usr/lib/gcc/i386-redhat-linux/3.4.4/include
/usr/include
End of search list.
GNU C version 3.4.4 20050721 (Red Hat 3.4.4-2) (i386-redhat-linux)
compiled by GNU C version 3.4.4 20050721 (Red Hat 3.4.4-2).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-
heapsize=131072
as -V -Qy -o /tmp/cco8b3Nx.o /tmp/cc3T1TTO.s
GNU assembler version 2.15.92.0.2 (i386-redhat-linux) using BFD
version 2.15.92.0.2 20040927
/usr/libexec/gcc/i386-redhat-linux/3.4.4/collect2 --eh-frame-hdr -m
elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o clue-keygen /usr/lib/
gcc/i386-redhat-linux/3.4.4/../../../crt1.o /usr/lib/gcc/i386-redhat-
linux/3.4.4/../../../crti.o /usr/lib/gcc/i386-redhat-linux/3.4.4/
crtbegin.o -L/home/someguy/clue/lib -L/usr/local/lib -L/usr/lib/gcc/
i386-redhat-linux/3.4.4 -L/usr/lib/gcc/i386-redhat-linux/3.4.4 -L/usr/
lib/gcc/i386-redhat-linux/3.4.4/../../.. -lgmp -lpbc -lpbc_sig -
lclue /tmp/cco8b3Nx.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -
lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/i386-redhat-
linux/3.4.4/crtend.o /usr/lib/gcc/i386-redhat-linux/3.4.4/../../../
crtn.o
/tmp/cco8b3Nx.o(.text+0x150): In function `main':
/home/someguy/clue/utilities/clue-keygen.c:54: undefined reference to
`crypto_load_param_file'
/tmp/cco8b3Nx.o(.text+0x1ce):/home/someguy/clue/utilities/clue-
keygen.c:62: undefined reference to `bbs_gen'
/tmp/cco8b3Nx.o(.text+0x213):/home/someguy/clue/utilities/clue-
keygen.c:66: undefined reference to `crypto_serialize_keys'
collect2: ld returned 1 exit status
make: *** [clue-keygen] Error 1
-----
# nm /home/someguy/clue/lib/libclue.a
libclue.o:
U __assert_fail
0000009d T bbs_gen
00000000 T bbs_init_sys_param
00003799 T bbs_open
000023f6 T bbs_sign
00002d94 T bbs_verify
0000127b T crypto_deserialize_keys
000010e5 T crypto_initialize_keys
0000003c T crypto_load_param_file
000c3500 C crypto_precomputed
00000706 T crypto_serialize_keys
00000535 t element_add
000004b8 t element_clear
0000377b t element_cmp
00001a0b t element_from_bytes
00002d73 t element_from_hash
00000514 t element_init
0000063e t element_init_G1
0000061f t element_init_G2
000004f5 t element_init_GT
00000602 t element_init_Zr
000005c9 t element_invert
000010a3 t element_length_in_bytes
000023d5 t element_mul
000023b7 t element_neg
U element_pow2_mpz
00002278 t element_pow2_zn
U element_pow3_mpz
000022fc t element_pow3_zn
00000556 t element_pow_zn
000005e7 t element_random
00001085 t element_to_bytes
000005a8 t element_to_mpz
U fclose
U fopen
U fread
U free
U fwrite
U __gmpz_clear
U __gmpz_init
U hash_final
U hash_init
U hash_update
00000695 T itoa
0000065d T itoalen
U malloc
U memcpy
00000000 B next_precompute
000004d3 t pairing_apply
U pairing_init_inp_str
00001a29 T precompute_crypto
0000001a r __PRETTY_FUNCTION__.0
U printf
U stat
U strcpy
U strlen
00000004 B total_precompute