I want to compile apib on my ubuntu 13.04 box but I am having issues with pthread lib. This is the error that I get :

$ colormake -j 5
cd src && make all
make[1]: Entering directory `/home/monkey/bin/apib-1_0/src'
gcc -std=gnu99 -pedantic -Wall -Wno-deprecated-declarations -g -O2 -I. -I/usr/include/apr-1.0 -DHAVE_CONFIG_H -D_GNU_SOURCE   -c -o apib_cpu.o apib_cpu.c
gcc -std=gnu99 -pedantic -Wall -Wno-deprecated-declarations -g -O2 -I. -I/usr/include/apr-1.0 -DHAVE_CONFIG_H -D_GNU_SOURCE   -c -o apib_iothread.o apib_iothread.c
gcc -std=gnu99 -pedantic -Wall -Wno-deprecated-declarations -g -O2 -I. -I/usr/include/apr-1.0 -DHAVE_CONFIG_H -D_GNU_SOURCE   -c -o apib_lines.o apib_lines.c
gcc -std=gnu99 -pedantic -Wall -Wno-deprecated-declarations -g -O2 -I. -I/usr/include/apr-1.0 -DHAVE_CONFIG_H -D_GNU_SOURCE   -c -o apib_main.o apib_main.c
gcc -std=gnu99 -pedantic -Wall -Wno-deprecated-declarations -g -O2 -I. -I/usr/include/apr-1.0 -DHAVE_CONFIG_H -D_GNU_SOURCE   -c -o apib_oauth.o apib_oauth.c
gcc -std=gnu99 -pedantic -Wall -Wno-deprecated-declarations -g -O2 -I. -I/usr/include/apr-1.0 -DHAVE_CONFIG_H -D_GNU_SOURCE   -c -o apib_reporting.o apib_reporting.c
gcc -std=gnu99 -pedantic -Wall -Wno-deprecated-declarations -g -O2 -I. -I/usr/include/apr-1.0 -DHAVE_CONFIG_H -D_GNU_SOURCE   -c -o apib_priorityq.o apib_priorityq.c
gcc -std=gnu99 -pedantic -Wall -Wno-deprecated-declarations -g -O2 -I. -I/usr/include/apr-1.0 -DHAVE_CONFIG_H -D_GNU_SOURCE   -c -o apib_url.o apib_url.c
gcc -std=gnu99 -pedantic -Wall -Wno-deprecated-declarations -g -O2 -I. -I/usr/include/apr-1.0 -DHAVE_CONFIG_H -D_GNU_SOURCE   -c -o apib_mon.o apib_mon.c
gcc -std=gnu99 -pedantic -Wall -Wno-deprecated-declarations -o ../apibmon  apib_mon.o apib_lines.o apib_cpu.o -lapr-1
/usr/bin/ld: apib_mon.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
/usr/bin/ld: note: 'pthread_create@@GLIBC_2.2.5' is defined in DSO /lib/x86_64-linux-gnu/libpthread.so.0 so try adding it to the linker command line
/lib/x86_64-linux-gnu/libpthread.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[1]: *** [../apibmon] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/home/monkey/bin/apib-1_0/src'
make: *** [all] Error 2

Whereas all needed libraries are installed:

$ dpkg -l  | grep apr && dpkg -l | grep libssl
ii  libapr1                                   1.4.6-3ubuntu1                             amd64        Apache Portable Runtime Library
ii  libapr1-dev                               1.4.6-3ubuntu1                             amd64        Apache Portable Runtime Library - Development Headers
ii  libaprutil1                               1.4.1-3                                    amd64        Apache Portable Runtime Utility Library
ii  libaprutil1-dbd-sqlite3                   1.4.1-3                                    amd64        Apache Portable Runtime Utility Library - SQLite3 Driver
ii  libaprutil1-dev                           1.4.1-3                                    amd64        Apache Portable Runtime Utility Library - Development Headers
ii  libaprutil1-ldap                          1.4.1-3                                    amd64        Apache Portable Runtime Utility Library - LDAP Driver
ii  libssl-dev                                1.0.1c-4ubuntu8.1                          amd64        SSL development libraries, header files and documentation
ii  libssl-doc                                1.0.1c-4ubuntu8.1                          all          SSL development documentation documentation
ii  libssl1.0.0:amd64                         1.0.1c-4ubuntu8.1                          amd64        SSL shared libraries
ii  libssl1.0.0:i386                          1.0.1c-4ubuntu8.1                          i386         SSL shared libraries

In Makefile :

APR_LIBS = -L/lib/x86_64-linux-gnu/ -lm -lcrypto -lpthread -lssl -lapr-1 -laprutil-1
  • it looks like a spell-checking error, because "could not read symbols" - you could inform the coders at gnu.org resp. at gcc and glibc ?! – dschinn1001 Jun 16 '13 at 13:04

OK, I have found it - there was an error in Makefile

APR_ONLY_LIBS did not have libthread linked :

APR_ONLY_LIBS = -lapr-1

So I changed it to :

APR_ONLY_LIBS = -lapr-1 -lpthread

If you came here cause of an ant build problem, just include pthread.

<property name="client.lib.path" value="/usr/local/lib"/> #this filepath
<property name="client.lib.list" value="fltk,pthread,stdc++"/> #this line
<libset dir="${client.lib.path}" libs="${client.lib.list}"/> #variable here with file path mentioned above
  • Welcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on AskUbuntu.) – David Foerster Oct 21 '16 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.