Reputation: 27090
I am trying to compile a program which depends upon GLib's libgthread. The library is installed in my machine (Ubuntu 12.04) and pkg-config
finds it:
$ pkg-config --libs gthread-2.0
-pthread -lgthread-2.0 -lrt -lglib-2.0
I tried to run configure
setting $CFLAGS
with such output:
$ CFLAGS=`pkg-config --libs gthread-2.0` ./configure
but it did not work:
$ make
[...]
gcc -g -O2 -I/include -I/home/adam/fs//include -I/usr/include/libxml2 -pthread -lgthread-2.0 -lrt -lglib-2.0 -o ama [...] -lxml2
ama-ama.o: In function `main':
/home/adam/software/ama/src/ama.c:89: undefined reference to `g_thread_init'
collect2: ld returned 1 exit status
make[2]: ** [ama] Erro 1
make[2]: Saindo do diretório `/home/adam/software/ama/src'
make[1]: ** [all-recursive] Erro 1
make[1]: Saindo do diretório `/home/adam/software/ama'
make: ** [all] Erro 2
I tried to set $LDFLAGS
, too:
$ LDFLAGS=`pkg-config --libs gthread-2.0` ./configure
and got the same error.
What should I do?
Upvotes: 1
Views: 227
Reputation: 27090
The correct variable to set is $LIBS
:
$ LIBS=`pkg-config --libs gthread-2.0` ./configure
Upvotes: 1