Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pthreads issue on ARM64 #12

Open
Koesters opened this issue Apr 9, 2021 · 1 comment
Open

Pthreads issue on ARM64 #12

Koesters opened this issue Apr 9, 2021 · 1 comment

Comments

@Koesters
Copy link

Koesters commented Apr 9, 2021

Not sure how to proceed

System:

Linux NanoPC-T4 4.4.179 #41 SMP Fri Feb 5 21:23:14 CST 2021 aarch64 aarch64 aarch64 GNU/Linux

cat /mnt/nvme/summon-fpga-tools/build/CMakeFiles/CMakeError.log
Determining if the pthread_create exist failed with the following output:
Change Dir: /mnt/nvme/summon-fpga-tools/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_842c9/fast"
/usr/bin/make -f CMakeFiles/cmTC_842c9.dir/build.make CMakeFiles/cmTC_842c9.dir/build
make[1]: Entering directory '/mnt/nvme/summon-fpga-tools/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_842c9.dir/CheckSymbolExists.c.o
/usr/bin/cc -o CMakeFiles/cmTC_842c9.dir/CheckSymbolExists.c.o -c /mnt/nvme/summon-fpga-tools/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_842c9
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_842c9.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_842c9.dir/CheckSymbolExists.c.o -o cmTC_842c9
CMakeFiles/cmTC_842c9.dir/CheckSymbolExists.c.o: In function main': CheckSymbolExists.c:(.text+0x14): undefined reference to pthread_create'
CheckSymbolExists.c:(.text+0x18): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_842c9.dir/build.make:97: recipe for target 'cmTC_842c9' failed
make[1]: *** [cmTC_842c9] Error 1
make[1]: Leaving directory '/mnt/nvme/summon-fpga-tools/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_842c9/fast' failed
make: *** [cmTC_842c9/fast] Error 2

File /mnt/nvme/summon-fpga-tools/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
(void)argv;
#ifndef pthread_create
return ((int*)(&pthread_create))[argc];
#else
(void)argc;
return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /mnt/nvme/summon-fpga-tools/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_8de9d/fast"
/usr/bin/make -f CMakeFiles/cmTC_8de9d.dir/build.make CMakeFiles/cmTC_8de9d.dir/build
make[1]: Entering directory '/mnt/nvme/summon-fpga-tools/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_8de9d.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_8de9d.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.10/Modules/CheckFunctionExists.c
Linking C executable cmTC_8de9d
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8de9d.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_8de9d.dir/CheckFunctionExists.c.o -o cmTC_8de9d -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_8de9d.dir/build.make:97: recipe for target 'cmTC_8de9d' failed
make[1]: *** [cmTC_8de9d] Error 1
make[1]: Leaving directory '/mnt/nvme/summon-fpga-tools/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_8de9d/fast' failed
make: *** [cmTC_8de9d/fast] Error 2

Checks for PThread

https://stackoverflow.com/questions/31948521/building-error-using-cmake-cannot-find-lpthreads

pi@NanoPC-T4:/mnt/nvme/summon-fpga-tools/build/CMakeFiles$ find /lib -name "*pthread*"
/lib/aarch64-linux-gnu/libpthread-2.27.so
/lib/aarch64-linux-gnu/libpthread.so.0
/lib/arm-linux-gnueabihf/libpthread-2.27.so
/lib/arm-linux-gnueabihf/libpthread.so.0

pi@NanoPC-T4:/mnt/nvme/summon-fpga-tools/build/CMakeFiles$ nm /lib/aarch64-linux-gnu/libpthread.so.0 | grep "pthread_create"
0000000000007350 t __pthread_create_2_1
0000000000007350 T pthread_create@@GLIBC_2.17
pi@NanoPC-T4:/mnt/nvme/summon-fpga-tools/build/CMakeFiles$ sudo apt install libc6-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libc6-dev is already the newest version (2.27-3ubuntu1.4).
libc6-dev set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

pi@NanoPC-T4:/mnt/nvme/summon-fpga-tools/build/CMakeFiles$ cd

pi@NanoPC-T4:~$ mkdir test

pi@NanoPC-T4:~$ cd test/

pi@NanoPC-T4:~/test$ cat CMakeLists.txt

cmake_minimum_required (VERSION 2.8.7)
find_package(Threads)

pi@NanoPC-T4:~/test$ cmake .

-- The C compiler identification is GNU 10.1.0
-- The CXX compiler identification is GNU 10.1.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/test

pi@NanoPC-T4:~/test$ sudo apt-get install libboost-all-dev

Reading package lists... Done
Building dependency tree
Reading state information... Done
libboost-all-dev is already the newest version (1.65.1.0ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

@esden
Copy link
Member

esden commented Sep 22, 2021

Thank you for bringing up this issue.

Unfortunately I don't have an ARM64 platform to test on. But I think you should raise this issue with the respective project that uses pthreads. The logs you provided unfortunately don't say what tool it is trying to build. It seems like an issue within Cmake?

That said, if it is a problem within a tool that summon-arm-toolchain is building the right place to report and resolve the bug is in the up stream project itself. Unless we can change the script in some subtle way to avoid the issue.

Also as this issue is already few months old. Did you try build the tools since then? I know that oss-cad-suite does build an ARM64 artifact so it should be possible to build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants