TadasBaltrusaitis / OpenFace

OpenFace – a state-of-the art tool intended for facial landmark detection, head pose estimation, facial action unit recognition, and eye-gaze estimation.
Other
6.98k stars 1.86k forks source link

Could not find OpenBLAS #714

Open Shaunlipy opened 5 years ago

Shaunlipy commented 5 years ago

I am compiling it on my Jetson Nano. I have openblas installed at:

libopenblas.so.0 (libc6,AArch64) => /usr/lib/aarch64-linux-gnu/libopenblas.so.0 libopenblas.so (libc6,AArch64) => /usr/lib/aarch64-linux-gnu/libopenblas.so

But when I execute the "Cmake -D ..."

I still got error:

-- Could not find OpenBLAS include, defaulting to using OpenFace vended ones -- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off CMake Error at cmake/modules/FindOpenBLAS.cmake:103 (MESSAGE): Could not find OpenBLAS Call Stack (most recent call first): CMakeLists.txt:14 (find_package)

Should I link the openblas somehow?

sziraqui commented 5 years ago

Compile openblas from source. The package of Ubuntu repos do not have lapacke.h

pi-null-mezon commented 5 years ago

Small addition to @sziraqui's suggestion (by the way it works for me), to build OpenFace on ARM you will also need to comment section with x86 SIMD options in CMakeLists.txt:

if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
    execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
    if (GCC_VERSION VERSION_LESS 4.7)
        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -msse -msse2 -msse3")
    else ()
        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -msse -msse2 -msse3")
    endif ()
else ()
    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -msse -msse2 -msse3")
endif ()
jensentobias commented 3 years ago

An addition to the original question and @sziraqui ' comment

Ive been successful with installing based on Ubuntu repros

sudo apt-get install liblapack-dev liblapacke-dev libopenblas-dev # not sure this is necessary

And then in cmake/modules/FindOpenBLAS.cmake add the two lines

/usr/include/aarch64-linux-gnu/

and

/usr/lib/aarch64-linux-gnu/

in the include and lib search paths.

As a side note. I got errors with dlib-19.13:

...
undefined reference to `pthread_create'
...
cannot find -lpthreads
...
undefined reference to `sgesv'
...

But I was successful with dlib-19.22. And got a working OpenFace installation after removing the arguments for SSE SIMD as suggested by pi-null-meazon

chenyu77 commented 6 months ago

jetson@tegra-ubuntu:~/OpenFace/build$ make Scanning dependencies of target LandmarkDetector [ 2%] Building CXX object lib/local/LandmarkDetector/CMakeFiles/LandmarkDetector.dir/src/CCNF_patch_expert.cpp.o g++-8: error: unrecognized command line option ‘-msse’; did you mean ‘-fdse’? g++-8: error: unrecognized command line option ‘-msse2’ g++-8: error: unrecognized command line option ‘-msse3’ lib/local/LandmarkDetector/CMakeFiles/LandmarkDetector.dir/build.make:62: recipe for target 'lib/local/LandmarkDetector/CMakeFiles/LandmarkDetector.dir/src/CCNF_patch_expert.cpp.o' failed make[2]: [lib/local/LandmarkDetector/CMakeFiles/LandmarkDetector.dir/src/CCNF_patch_expert.cpp.o] Error 1 CMakeFiles/Makefile2:85: recipe for target 'lib/local/LandmarkDetector/CMakeFiles/LandmarkDetector.dir/all' failed make[1]: [lib/local/LandmarkDetector/CMakeFiles/LandmarkDetector.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2

I encountered the following problem when compiling the project, I would like to ask how to solve it ah

brmarkus commented 6 months ago

Have a look into "https://github.com/TadasBaltrusaitis/OpenFace/issues/479", same errors reported when compiling on a Jetson device (no SSE CPU instructions?)

maqduni commented 3 months ago

Response from Copilot

This error indicates that CMake is unable to locate the OpenBLAS library. To resolve this, you need to ensure that OpenBLAS is installed on your system and that CMake can find it.

Here is a step-by-step plan to resolve this issue:

  1. Install OpenBLAS: Ensure that OpenBLAS is installed on your system. You can install it using a package manager.

  2. Set OpenBLAS Environment Variables: Set the environment variables to help CMake locate OpenBLAS.

  3. Configure CMake: Modify your CMakeLists.txt or provide the necessary paths when running CMake.

Step 1: Install OpenBLAS

For macOS, you can use Homebrew to install OpenBLAS:

brew install openblas

Step 2: Set OpenBLAS Environment Variables

Set the environment variables to point to the OpenBLAS installation. You can add these lines to your shell configuration file (e.g., .bashrc, .zshrc):

export OpenBLAS_HOME=$(brew --prefix openblas)
export OpenBLAS_INCLUDE_DIR=$OpenBLAS_HOME/include
export OpenBLAS_LIB_DIR=$OpenBLAS_HOME/lib

Step 3: Configure CMake

Modify your CMakeLists.txt to include the paths to OpenBLAS:

set(OpenBLAS_INCLUDE_DIR $ENV{OpenBLAS_INCLUDE_DIR})
set(OpenBLAS_LIB_DIR $ENV{OpenBLAS_LIB_DIR})

find_package(OpenBLAS REQUIRED)

include_directories(${OpenBLAS_INCLUDE_DIR})
link_directories(${OpenBLAS_LIB_DIR})

target_link_libraries(your_target_name ${OpenBLAS_LIBRARIES})

Alternatively, you can provide the paths directly when running CMake:

cmake -DOpenBLAS_INCLUDE_DIR=$OpenBLAS_INCLUDE_DIR -DOpenBLAS_LIB_DIR=$OpenBLAS_LIB_DIR ..

This should help CMake locate the OpenBLAS library and resolve the error.

brmarkus commented 3 months ago

I am compiling it on my Jetson Nano

Response from Copilot

Step 1: Install OpenBLAS

For macOS, you can use Homebrew to install OpenBLAS:

Does Jetson Nano run macOS?

maqduni commented 3 months ago

I am compiling it on my Jetson Nano

Response from Copilot

Step 1: Install OpenBLAS

For macOS, you can use Homebrew to install OpenBLAS:

Does Jetson Nano run macOS?

I missed that part. I was experiencing the same issue on macOS and thought this might be helpful.

brmarkus commented 3 months ago

It definitly will be helpful for others!!