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

Could NOT find Threads (missing: Threads_FOUND) on Raspberry 4 and F200 #2

Closed
shoomilka opened this issue May 20, 2022 · 9 comments
Closed

Comments

@shoomilka
Copy link

Required Info
Camera Model F200
Firmware Version -
Operating System & Version Raspberry Pi OS (bullseye)
Kernel Version (Linux Only) 5.15.32-v8+
Build System Makefile

I'm installing on Raspberry 400 driver for F200 and doing command cmake .. -DBUILD_EXAMPLES=true -DCMAKE_BUILD_TYPE=Release -DFORCE_LIBUVC=true, I received an error:

-- Info: REALSENSE_VERSION_STRING=1.12.1
CMake Error at /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
  Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
  /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.18/Modules/FindThreads.cmake:234 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:173 (find_package)

Can you help me to fix that?

@congvmit
Copy link
Collaborator

Hello @shoomilka
It's been a long time since I started this project. So I am not sure the solution I found can work for you or not.
You can check the solution from this link:
IntelRealSense/librealsense#10041 (comment)

@shoomilka
Copy link
Author

Hi, @congvmit ! Thank you for the idea but it didn't help(((( I now saw that the error looks the next: Looking for pthread.h - not found. I checked the locate function for this .h file and it said that there are two files with this name. But I cannot understand why compiler doesn't see it...

@congvmit
Copy link
Collaborator

@shoomilka Have you tried this solution?
alicevision/geogram#2 (comment)

I think your problem is quite common. You may find the solutions from other repositories, I believe.

@shoomilka
Copy link
Author

@congvmit , now I received an output:

shoomilka@raspberrypi:~/real/librealsense_for_arm/build $ cmake .. -DBUILD_EXAMPLES=true -DCMAKE_BUILD_TYPE=Release -DFORCE_LIBUVC=true
-- Info: REALSENSE_VERSION_STRING=1.12.1
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") 
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE  
-- Checking for one of the modules 'libusb-1.0'
CMake Warning (dev) at /usr/share/cmake-3.18/Modules/FindOpenGL.cmake:305 (message):
  Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
  available.  Run "cmake --help-policy CMP0072" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  FindOpenGL found both a legacy GL library:

    OPENGL_gl_LIBRARY: /usr/lib/aarch64-linux-gnu/libGL.so

  and GLVND libraries for OpenGL and GLX:

    OPENGL_opengl_LIBRARY: /usr/lib/aarch64-linux-gnu/libOpenGL.so
    OPENGL_glx_LIBRARY: /usr/lib/aarch64-linux-gnu/libGLX.so

  OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
  compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
  examples/CMakeLists.txt:24 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found OpenGL: /usr/lib/aarch64-linux-gnu/libOpenGL.so   
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    FORCE_LIBUVC


-- Build files have been written to: /home/shoomilka/real/librealsense_for_arm/build

I think I can ignore this warning (maybe I'm wrong), so I decided to do the next:

shoomilka@raspberrypi:~/real/librealsense_for_arm/build $ make -j3
Scanning dependencies of target realsense
[  1%] Building CXX object CMakeFiles/realsense.dir/src/context.cpp.o
[  2%] Building CXX object CMakeFiles/realsense.dir/src/device.cpp.o
[  3%] Building CXX object CMakeFiles/realsense.dir/src/archive.cpp.o
c++: error: unrecognized command-line option ‘-mfpu=neon’
c++: error: unrecognized command-line option ‘-mfpu=neon’
c++: error: unrecognized command-line option ‘-mfloat-abi=hard’
c++: error: unrecognized command-line option ‘-mfpu=neon’
make[2]: *** [CMakeFiles/realsense.dir/build.make:95: CMakeFiles/realsense.dir/src/context.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
c++: error: unrecognized command-line option ‘-mfloat-abi=hard’
make[2]: *** [CMakeFiles/realsense.dir/build.make:108: CMakeFiles/realsense.dir/src/device.cpp.o] Error 1
c++: error: unrecognized command-line option ‘-mfloat-abi=hard’
make[2]: *** [CMakeFiles/realsense.dir/build.make:82: CMakeFiles/realsense.dir/src/archive.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:208: CMakeFiles/realsense.dir/all] Error 2
make: *** [Makefile:149: all] Error 2

Now looking for the solution on this.

Thank you for the last message - it very helped.

@shoomilka
Copy link
Author

I think the reason is the net lines of code in CMakeLists.txt:

if(${MACHINE} MATCHES "arm-linux-gnueabihf")
      set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS}   -mfpu=neon -mfloat-abi=hard -ftree-vectorize")
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -mfloat-abi=hard -ftree-vectorize")
    elseif(${MACHINE} MATCHES "aarch64-linux-gnu")
      set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS}   -mstrict-align -ftree-vectorize")
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mstrict-align -ftree-vectorize")
    else(${MACHINE} MATCHES "arm-linux-gnueabihf")
      set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS}   -mssse3")
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3")
    endif(${MACHINE} MATCHES "arm-linux-gnueabihf")

I have aarch64, not arm, as I understand.

@shoomilka
Copy link
Author

I replaced

# Add for ARM
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon -mfloat-abi=hard -ftree-vectorize -latomic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -mfloat-abi=hard -ftree-vectorize -latomic")

with the next:

# Add for Aarch
set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS}   -mstrict-align -ftree-vectorize")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mstrict-align -ftree-vectorize")

and it begin to work!

@congvmit
Copy link
Collaborator

@shoomilka It's very nice to hear that.

@shoomilka
Copy link
Author

Unit tests run with the next output:
test cases: 14 | 2 passed | 12 failed
assertions: 184 | 171 passed | 13 failed

pyrealsense is not for aarch64, so I will make it from sources later. I hope I found an instruction for this.

@congvmit
Copy link
Collaborator

@shoomilka The pre-built pyrealsense is not for aarch64, you must re-compile and build from the source.
You can find the source code from this link: https://github.com/toinsson/pyrealsense

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