0

I'm trying to build libnice. But compilation fails with the following errors:

stun/libstun.a.p/stunhmac.c.o: In function `stun_sha1':
libnice/build/../stun/stunhmac.c:125: undefined reference to `gnutls_hmac_get_len'
libnice/build/../stun/stunhmac.c:126: undefined reference to `gnutls_hmac_init'
libnice/build/../stun/stunhmac.c:128: undefined reference to `gnutls_hmac'
libnice/build/../stun/stunhmac.c:129: undefined reference to `gnutls_hmac'
libnice/build/../stun/stunhmac.c:130: undefined reference to `gnutls_hmac'
libnice/build/../stun/stunhmac.c:140: undefined reference to `gnutls_hmac_deinit'
libnice/build/../stun/stunhmac.c:137: undefined reference to `gnutls_hmac'
stun/libstun.a.p/stunhmac.c.o: In function `stun_hash_creds':
libnice/build/../stun/stunhmac.c:202: undefined reference to `gnutls_hash_init'
libnice/build/../stun/stunhmac.c:203: undefined reference to `gnutls_hash'
libnice/build/../stun/stunhmac.c:204: undefined reference to `gnutls_hash'
libnice/build/../stun/stunhmac.c:205: undefined reference to `gnutls_hash'
libnice/build/../stun/stunhmac.c:206: undefined reference to `gnutls_hash'
libnice/build/../stun/stunhmac.c:207: undefined reference to `gnutls_hash'
libnice/build/../stun/stunhmac.c:209: undefined reference to `gnutls_hash_deinit'
stun/libstun.a.p/rand.c.o: In function `nice_RAND_nonce':
libnice/build/../stun/rand.c:59: undefined reference to `gnutls_rnd'
collect2: error: ld returned 1 exit status

The command that fails is the following:

arm-linux-gnueabihf-cc  -o tests/nice-test-bsd tests/nice-test-bsd.p/test-bsd.c.o \
-L/sysroot/staging/lib -L/sysroot/usr/lib \
-Wl,--as-needed -Wl,--no-undefined -mthumb -march=armv7-a -mtune=cortex-a9 \
-mlittle-endian -mfloat-abi=hard -mfpu=neon -Wa,-mimplicit-it=thumb \
-Wl,-rpath-link=/sysroot/lib -Wl,-rpath-link=/sysroot/usr/lib \
-Wl,-rpath,/sysroot/lib/usr/lib -Wl,-rpath-link,/sysroot/usr/lib \
-Wl,--start-group \
    agent/libagent.a stun/libstun.a socket/libsocket.a random/libnice-random.a \
    /sysroot/usr/lib/libgio-2.0.so /sysroot/usr/lib/libgobject-2.0.so \
    /sysroot/usr/lib/libglib-2.0.so /sysroot/usr/lib/libgthread-2.0.so \
    -pthread \
    /sysroot/usr/lib/libgnutls.so \
    -lm \
-Wl,--end-group

So libgnutls is included to the link command, but symbols inside it are still cannot be found. However if I move socket/libsocket.a to the beginning of the -Wl,--start-group, the compilation succeeds.

I thought that the order of archives inside --start-group ... --end-group doesn't matter. But it seems it does. Why is it so?

anton_rh
  • 7,250
  • 5
  • 40
  • 66

0 Answers0