orangepi-xunlong / wiringOP

wiringPi for Orange Pi
GNU Lesser General Public License v3.0
394 stars 189 forks source link

cross-compiling error undefine reference to `pthread_join@GLIBC_2.34' #102

Open develop-RD opened 6 months ago

develop-RD commented 6 months ago
  1. I install wiringOP c git

https://github.com/orangepi-xunlong/wiringOP/tree/next

  1. Looked at the examples:
INCLUDE = -I/usr/local/include
LDFLAGS = -L/usr/local/lib
LDLIBS    = -lwiringPi -lwiringPiDev -lpthread -lm -lcrypt -lrt
  1. Download include and lib on host machine, set relevant parade in eclipse.

But when assembling I see the following errors:

arm-linux-gnueabihf-gcc -L"/root/project/test_gpio/lib" -L"/root/project/test_gpio/global_lib" -o "test_gpio" ./src/test_gpio.o    "/root/project/test_gpio/lib/libwiringPi.so" -lwiringPi -lwiringPiDev -lpthread -lm -lcrypt -lrt
/root/project/test_gpio/lib/libwiringPi.so: undefined reference to `pthread_join@GLIBC_2.34'
/root/project/test_gpio/lib/libwiringPi.so: undefined reference to `fcntl@GLIBC_2.28'
/root/project/test_gpio/lib/libwiringPi.so: undefined reference to `shm_open@GLIBC_2.34'
/root/project/test_gpio/lib/libwiringPi.so: undefined reference to `crypt@XCRYPT_2.0'
/root/project/test_gpio/lib/libwiringPi.so: undefined reference to `pow@GLIBC_2.29'
/root/project/test_gpio/lib/libwiringPi.so: undefined reference to `pthread_cancel@GLIBC_2.34'
/root/project/test_gpio/lib/libwiringPi.so: undefined reference to `pthread_create@GLIBC_2.34'
collect2: error: ld returned 1 exit status
  1. Later I found information about dynamic linking. I removed libwiringPi.so. Executed the command ln -s libwiringPi.so.2.52 libwiringPi.so Thus creating a new link, but it did not help

  2. The final console output looks like this:

Building file: ../src/gp_test.c
Invoking: Cross GCC Compiler
aarch64-linux-gnu-gcc -pthread -I"/home/user/project/blink_gpio/wiringOP/wiringPi" -O0 -g3 -c -fmessage-length=0 -MMD -MP -MF"src/gp_test.d" -MT"src/gp_test.o" -o "src/gp_test.o" "../src/gp_test.c"
Finished building: ../src/gp_test.c

Building target: gp_test

Invoking: Cross GCC Linker
aarch64-linux-gnu-gcc -L/home/user/project/lib -o "gp_test" ./src/gp_test.o    -lwiringPi -lwiringPiDev -lpthread -lm -lcrypt -lrt
/home/user/project/lib/libwiringPi.so: undefined reference to `pthread_join@GLIBC_2.34'
/home/user/project/lib/libwiringPi.so: undefined reference to `shm_open@GLIBC_2.34'
/home/user/project/lib/libwiringPi.so: undefined reference to `crypt@XCRYPT_2.0'
/home/user/project/lib/libwiringPi.so: undefined reference to `pow@GLIBC_2.29'
/home/user/project/lib/libwiringPi.so: undefined reference to `pthread_cancel@GLIBC_2.34'
/home/user/project/lib/libwiringPi.so: undefined reference to `pthread_create@GLIBC_2.34'
collect2: error: ld execution completed with return code 1
make: *** [makefile:43: gp_test] Ошибка 1
"make all" terminated with exit code 2. Build might be incomplete.