pthread configure error



  • I'm trying to cross-compile Qt5.6 for RPi3 with Linaro toolchain.
    This is my configure command:

    
    ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -openssl -make libs -alsa -gui -widgets -no-eglfs -no-compile-examples -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi
    

    Several modules won't pass the configure stage (DBus and Pulseaudio) due to errors like this:

    
    PulseAudio auto-detection... ()
    /home/tech/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++ -c -pipe -marm -mfpu=vfp -mtune=arm1176jzf-s -march=armv6zk -mabi=aapcs-linux -mfloat-abi=hard --sysroot=/mnt/rasp-pi-rootfs -D_REENTRANT -O2 -std=gnu++0x -Wall -W -fPIC  -I. -isystem /mnt/rasp-pi-rootfs/usr/include/glib-2.0 -I/mnt/rasp-pi-rootfs/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I../../../mkspecs/devices/linux-rasp-pi-g++ -o pulseaudio.o pulseaudio.cpp
    /home/tech/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++ -Wl,-rpath-link,/mnt/rasp-pi-rootfs/opt/vc/lib -Wl,-rpath-link,/mnt/rasp-pi-rootfs/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/mnt/rasp-pi-rootfs/lib/arm-linux-gnueabihf -mfloat-abi=hard --sysroot=/mnt/rasp-pi-rootfs -Wl,-O1 -o pulseaudio pulseaudio.o   --sysroot=/mnt/rasp-pi-rootfs -L/mnt/rasp-pi-rootfs/usr/lib/arm-linux-gnueabihf -lpulse-mainloop-glib -lpulse -lglib-2.0 
    /home/tech/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../../../../arm-linux-gnueabihf/bin/ld: /mnt/rasp-pi-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gthread-posix.o): undefined reference to symbol 'pthread_getspecific@@GLIBC_2.4'
    /home/tech/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../../../../arm-linux-gnueabihf/bin/ld: note: 'pthread_getspecific@@GLIBC_2.4' is defined in DSO /mnt/rasp-pi-rootfs/lib/arm-linux-gnueabihf/libpthread.so.0 so try adding it to the linker command line
    /mnt/rasp-pi-rootfs/lib/arm-linux-gnueabihf/libpthread.so.0: could not read symbols: Invalid operation
    collect2: error: ld returned 1 exit status
    Makefile:181: set di istruzioni per l'obiettivo "pulseaudio" non riuscito
    make: *** [pulseaudio] Errore 1
    PulseAudio disabled.
    

    Of course the libpthread.so.0 is there, but the linker fails.
    Why? And how to fix?

    EDIT
    I mean: the error message says "how to fix"... "try to add it [-lpthread] to the linker command line." But WHY I need to change the linker command line of the Qt sources?



  • I confirm that adding the pthread library did the trick. But the question "why" is still there :)



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.