我正在尝试编译program,这取决于GLib的libgthread。该库安装在我的机器(Ubuntu 12.04)中,pkg-config
找到它:
$ pkg-config --libs gthread-2.0
-pthread -lgthread-2.0 -lrt -lglib-2.0
我尝试使用此输出运行configure
设置$CFLAGS
:
$ CFLAGS=`pkg-config --libs gthread-2.0` ./configure
但它不起作用:
$ 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
我也尝试设置$LDFLAGS
:
$ LDFLAGS=`pkg-config --libs gthread-2.0` ./configure
并得到了同样的错误。
我该怎么办?
答案 0 :(得分:1)
要设置的正确变量是$LIBS
:
$ LIBS=`pkg-config --libs gthread-2.0` ./configure