Closed mmurooka closed 1 year ago
I intend to run tests without install like this:
cmake .. -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON
make -j6
ctest --output-on-failure -j
Does this work well?
No, I get the same error.
$ ctest --output-on-failure -j
Test project /home/mmurooka/src/hpipm-cpp/build
Start 1: d_ocp_qp_dim_wrapper
1/6 Test #1: d_ocp_qp_dim_wrapper .............***Failed 0.00 sec
/home/mmurooka/src/hpipm-cpp/build/test/d_ocp_qp_dim_wrapper: error while loading shared libraries: libblasfeo.so: cannot open shared object file: No such file or directory
Start 2: d_ocp_qp_sol_wrapper
2/6 Test #2: d_ocp_qp_sol_wrapper .............***Failed 0.00 sec
/home/mmurooka/src/hpipm-cpp/build/test/d_ocp_qp_sol_wrapper: error while loading shared libraries: libblasfeo.so: cannot open shared object file: No such file or directory
Start 3: d_ocp_qp_wrapper
3/6 Test #3: d_ocp_qp_wrapper .................***Failed 0.00 sec
/home/mmurooka/src/hpipm-cpp/build/test/d_ocp_qp_wrapper: error while loading shared libraries: libblasfeo.so: cannot open shared object file: No such file or directory
Start 4: d_ocp_qp_ipm_arg_wrapper
4/6 Test #4: d_ocp_qp_ipm_arg_wrapper .........***Failed 0.00 sec
/home/mmurooka/src/hpipm-cpp/build/test/d_ocp_qp_ipm_arg_wrapper: error while loading shared libraries: libblasfeo.so: cannot open shared object file: No such file or directory
Start 5: d_ocp_qp_ipm_ws_wrapper
5/6 Test #5: d_ocp_qp_ipm_ws_wrapper ..........***Failed 0.00 sec
/home/mmurooka/src/hpipm-cpp/build/test/d_ocp_qp_ipm_ws_wrapper: error while loading shared libraries: libblasfeo.so: cannot open shared object file: No such file or directory
Start 6: ocp_qp_ipm_solver
6/6 Test #6: ocp_qp_ipm_solver ................***Failed 0.00 sec
/home/mmurooka/src/hpipm-cpp/build/test/ocp_qp_ipm_solver: error while loading shared libraries: libblasfeo.so: cannot open shared object file: No such file or directory
0% tests passed, 6 tests failed out of 6
Total Test time (real) = 0.02 sec
The following tests FAILED:
1 - d_ocp_qp_dim_wrapper (Failed)
2 - d_ocp_qp_sol_wrapper (Failed)
3 - d_ocp_qp_wrapper (Failed)
4 - d_ocp_qp_ipm_arg_wrapper (Failed)
5 - d_ocp_qp_ipm_ws_wrapper (Failed)
6 - ocp_qp_ipm_solver (Failed)
Errors while running CTest
$ ldd test/d_ocp_qp_dim_wrapper
linux-vdso.so.1 (0x00007ffc511c8000)
libgtk3-nocsd.so.0 => /usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 (0x00007f0d522fe000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0d520df000)
libhpipm.so => /home/mmurooka/src/hpipm-cpp/external/hpipm-install/lib/libhpipm.so (0x00007f0d51da3000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f0d51a1a000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0d5167c000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0d51464000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0d51073000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0d50e6f000)
/lib64/ld-linux-x86-64.so.2 (0x00007f0d5279f000)
libblasfeo.so => not found
Can you run examples/example_mpc.cpp
after installing the shared library?
Examples are not built automatically, but must be built as an independent project, right? I got the following error.
$ cd hpipm-cpp/examples/
$ mkdir build && cd build
$ cmake ..
$ LANG=C make -j4
[ 50%] Linking CXX executable example_mpc
[ 50%] Linking CXX executable example_ocp_qp
/home/mmurooka/src/install/lib/libhpipm-cpp.a(d_ocp_qp_wrapper.cpp.o): In function `_GLOBAL__sub_I_00100_0__ZN5hpipm16d_ocp_qp_wrapperC2ERKSt10shared_ptrINS_20d_ocp_qp_dim_wrapperEE':
d_ocp_qp_wrapper.cpp:(.text.startup+0x8): undefined reference to `__gcov_init'
/home/mmurooka/src/install/lib/libhpipm-cpp.a(d_ocp_qp_wrapper.cpp.o): In function `_GLOBAL__sub_D_00100_1__ZN5hpipm16d_ocp_qp_wrapperC2ERKSt10shared_ptrINS_20d_ocp_qp_dim_wrapperEE':
d_ocp_qp_wrapper.cpp:(.text.exit+0x1): undefined reference to `__gcov_exit'
/home/mmurooka/src/install/lib/libhpipm-cpp.a(d_ocp_qp_wrapper.cpp.o):(.data.rel+0x20): undefined reference to `__gcov_merge_add'
/home/mmurooka/src/install/lib/libhpipm-cpp.a(d_ocp_qp_sol_wrapper.cpp.o): In function `_GLOBAL__sub_I_00100_0__ZN5hpipm20d_ocp_qp_sol_wrapperC2ERKSt10shared_ptrINS_20d_ocp_qp_dim_wrapperEE':
d_ocp_qp_sol_wrapper.cpp:(.text.startup+0x8): undefined reference to `__gcov_init'
/home/mmurooka/src/install/lib/libhpipm-cpp.a(d_ocp_qp_sol_wrapper.cpp.o): In function `_GLOBAL__sub_D_00100_1__ZN5hpipm20d_ocp_qp_sol_wrapperC2ERKSt10shared_ptrINS_20d_ocp_qp_dim_wrapperEE':
d_ocp_qp_sol_wrapper.cpp:(.text.exit+0x1): undefined reference to `__gcov_exit'
/home/mmurooka/src/install/lib/libhpipm-cpp.a(d_ocp_qp_sol_wrapper.cpp.o):(.data.rel+0x20): undefined reference to `__gcov_merge_add'
/home/mmurooka/src/install/lib/libhpipm-cpp.a(d_ocp_qp_ipm_ws_wrapper.cpp.o): In function `_GLOBAL__sub_I_00100_0__ZN5hpipm23d_ocp_qp_ipm_ws_wrapperC2ERKSt10shared_ptrINS_20d_ocp_qp_dim_wrapperEERKS1_INS_24d_ocp_qp_ipm_arg_wrapperEE':
d_ocp_qp_ipm_ws_wrapper.cpp:(.text.startup+0x58): undefined reference to `__gcov_init'
/home/mmurooka/src/install/lib/libhpipm-cpp.a(d_ocp_qp_ipm_ws_wrapper.cpp.o): In function `_GLOBAL__sub_D_00100_1__ZN5hpipm23d_ocp_qp_ipm_ws_wrapperC2ERKSt10shared_ptrINS_20d_ocp_qp_dim_wrapperEERKS1_INS_24d_ocp_qp_ipm_arg_wrapperEE':
d_ocp_qp_ipm_ws_wrapper.cpp:(.text.exit+0x1): undefined reference to `__gcov_exit'
/home/mmurooka/src/install/lib/libhpipm-cpp.a(d_ocp_qp_ipm_ws_wrapper.cpp.o):(.data.rel+0x20): undefined reference to `__gcov_merge_add'
/home/mmurooka/src/install/lib/libhpipm-cpp.a(ocp_qp_ipm_solver_statistics.cpp.o): In function `_GLOBAL__sub_I_00100_0__ZN5hpipm24OcpQpIpmSolverStatistics6resizeEm':
ocp_qp_ipm_solver_statistics.cpp:(.text.startup+0x58): undefined reference to `__gcov_init'
/home/mmurooka/src/install/lib/libhpipm-cpp.a(ocp_qp_ipm_solver_statistics.cpp.o): In function `_GLOBAL__sub_D_00100_1__ZN5hpipm24OcpQpIpmSolverStatis
.....
I added the CI in the branch https://github.com/mmurooka/hpipm-cpp/tree/ci and got the same error https://github.com/mmurooka/hpipm-cpp/actions/runs/3546136677/jobs/5954873737
Thank you for making the CI branch! I tested on two local machines and it works well on both machines, so I still don't get what is wrong. Do you have any idea to resolve this issue? Btw, I mistakenly set the default build of hpipm-cpp as static library. I will change it to build this library as shared library.
I tested on two local machines and it works well on both machines, so I still don't get what is wrong.
The error was reproduced in the docker environment by following commands.
docker run --rm -it ubuntu:20.04
# In the docker
apt-get update
apt-get install git cmake g++ libeigen3-dev
git clone https://github.com/mayataka/hpipm-cpp.git
cd hpipm-cpp
mkdir build
cd build
cmake .. -DBUILD_TESTS=ON
make -j4
ctest
Do you have any idea to resolve this issue?
I couldn't figure it out as far as a quick look at CMakeLists.txt (I'm not an expert in cmake anyway). I wonder if the following lines are related to the error.
Thank you for providing the docker example. I could reproduce the error withe the docker environment. I will take a look at this on my side.
@mmurooka
I decided to make the installations of blasfeo and hpipm as prerequisite of hpipm-cpp
.
Solving this issue would be really hard and I also found that even the building is successful, installation of blasfeo and hpipm to other locations, e.g., /usr/local/lib do not work correctly.
We need to manually install blasfeo and hpipm before building hpipm-cpp
but then there is no longer such a build issue.
Is this enough in your case?
Is this enough in your case?
Yes.
@mmurooka
Could you test fix/link_error
branch?
The instructions of blasfeo
and hpipm
installations are found in https://github.com/mayataka/hpipm-cpp/tree/fix/link_error
Thank you. I still get the same error. I did the following commands in the docker.
docker run --rm -it ubuntu:20.04
1 cd
2 apt-get update
3 apt-get install git cmake g++ libeigen3-dev
4 git clone https://github.com/giaf/blasfeo
5 git clone https://github.com/giaf/hpipm
6 cd blasfeo && mkdir build && cd build
7 cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBLASFEO_EXAMPLES=OFF
8 make install -j8
9 cd ../../hpipm && mkdir build && cd build
10 cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DHPIPM_TESTING=OFF
11 make install -j8
14 cd
15 git clone https://github.com/mayataka/hpipm-cpp
16 cd hpipm-cpp
18 git checkout fix/link_error
19 git log
21 mkdir build && cd build
22 cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON
23 make -j8
24 ctest # Failure
25 make install
26 ctest # Failure
27 ./test/ocp_qp_ipm_solver # Failure
# ./test/ocp_qp_ipm_solver: error while loading shared libraries: libblasfeo.so: cannot open shared object file: No such file or directory
Okay, now I found that setting LD_LIBRARY_PATH
is mandatory to use blasfeo
and hpipm
because of their CMake installation scripts.
For example, https://github.com/acados/acados also requires to set it for libblasfeo.so and libhpipm.so.
I could run the tests and examples on docker as
apt update
apt install git cmake g++ libeigen3-dev -y
git clone https://github.com/giaf/blasfeo
git clone https://github.com/giaf/hpipm
cd blasfeo && mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBLASFEO_EXAMPLES=OFF
make install -j8
cd ../../hpipm && mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DHPIPM_TESTING=OFF
make install -j8
cd ../..
export LD_LIBRARY_PATH=/opt/blasfeo/lib:/opt/hpipm/lib:$LD_LIBRARY_PATH
git clone https://github.com/mayataka/hpipm-cpp.git -b fix/link_error
cd hpipm-cpp
mkdir build
cd build
cmake .. -DBUILD_TESTS=ON
make install -j8
ctest
cd ../examples
mkdir build
cd build
cmake ..
make -j8
./example_ocp_qp
./example_mpc
Thank you, I can also do those commands successfully.
I'll close this issue. Btw, I'll appriciate it if you make the pull request of the CI branch!
Btw, I'll appriciate it if you make the pull request of the CI branch!
Thank you for the useful library.
I get the following error about loading the shared library when I build with tests and run them.
I set
${HOME}/src/install
forCMAKE_INSTALL_PREFIX
, and${HOME}/src/install/lib
is included inLD_LIBRARY_PATH
. If I manually add${HOME}/src/install/lib/hpipm-cpp
toLD_LIBRARY_PATH
, this library loading error does not happen, but I feel that it is not so general to impose this on all users. Is there a general solution by modifying CMakeLists.txt?For reference, I attach the
build/install_manifest.txt
file. install_manifest.txtWith the option
-DBUILD_SHARED_LIBS=ON
, I get the similar error.