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

error while loading shared libraries: libosqp.so #150

Open
Julius-ZCJ opened this issue Nov 19, 2023 · 3 comments
Open

error while loading shared libraries: libosqp.so #150

Julius-ZCJ opened this issue Nov 19, 2023 · 3 comments

Comments

@Julius-ZCJ
Copy link

Hello, developer:
I get this error:error while loading shared libraries: libosqp.so: cannot open shared object file: No such file or directory

This is my cmakelist.txt:

cmake_minimum_required(VERSION 3.23)
project(learn_ws)

set(CMAKE_CXX_STANDARD 17)

find_package(Eigen3 REQUIRED)
find_package(osqp REQUIRED)
find_package(OsqpEigen REQUIRED)


set(SOURCES
        ${CMAKE_CURRENT_SOURCE_DIR}/src/eigen_learning.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/src/osqp_learning.cpp
    )
set(HEADERS
        ${CMAKE_CURRENT_SOURCE_DIR}/include/eigen_learning.h
        ${CMAKE_CURRENT_SOURCE_DIR}/include/osqp_learning.h
)


include_directories(
        include
        ${CMAKE_CURRENT_SOURCE_DIR}/include
)
include_directories(${EIGEN3_INCLUDE_DIR})


add_executable(learn_ws main.cpp  ${HEADERS} ${SOURCES})
target_link_libraries(learn_ws
        osqp         #####链接osqp库,因为OsqpEigen需要osqp库
        OsqpEigen    #####链接OsqpEigen库
#        /usr/local/lib/libOsqpEigen.so
#        /usr/local/lib/libosqp.so
)

but when I add "/usr/local/lib/libosqp.so" in target_link_libraries, this error is fix, I want to know why, and how to use this lib just need add code " find_package(osqp REQUIRED)" in cmakelist.txt, rather than "/usr/local/lib/libosqp.so"

@siddharthdeore
Copy link

@Julius-ZCJ,
I recommend updating the target_link_libraries section in your CMakeLists.txt file as follows:

target_link_libraries(learn_ws PUBLIC OsqpEigen::OsqpEigen)

@traversaro
Copy link
Member

Indeed, @Julius-ZCJ can you try @siddharthdeore fix? Thanks!

@traversaro
Copy link
Member

@Julius-ZCJ did you tried the proposed fix? Thanks!

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

3 participants