ldd: warning: you do not have execution permission for `libYYY.a` not a dynamic executable

2.7k Views Asked by At

I'm running CMake by this command:

cmake -DCMAKE_PREFIX_PATH=deps/build/destdir/usr/local -DBoost_NO_BOOST_CMAKE=ON ..

But, this error is received:

ldd: warning: you do not have execution permission for
`/home/m3/repos/cpp-service/deps/build/destdir/usr/local/lib/libopenvdb.a'

    not a dynamic executable

Call Stack (most recent call first):
/usr/local/lib64/cmake/OpenVDB/FindOpenVDB.cmake:550 (get_prerequisites) linux.cmake:29 (find_package)
CMakeLists.txt:28 (include)

Screenshot

Problem

I think the problem is due to the fact that I have libopenvdb.a installed in two paths:

  1. /usr/local/lib64/ inside my system filesystem
  2. deps/build/destdir/usr/local/lib/ inside my source code tree

I intend to use the OpenVDB inside my source code tree, not the system one. I don't have enough CMake expertise. How can I avoid such conflicts?

1

There are 1 best solutions below

2
On BEST ANSWER

As @U.W. commented, the CMake file was problematic.

In my CMake file I had such statements:

list(APPEND CMAKE_MODULE_PATH "/usr/local/lib64/cmake/OpenVDB/")
find_package(OpenVDB REQUIRED)

target_link_libraries(
   ${PROJECT_NAME} PUBLIC 
                         OpenVDB::openvdb)

The error got resovled by replacing the above statements with these ones:

list(
  APPEND CMAKE_MODULE_PATH
  "/home/m3/repos/cpp-service/deps/build/destdir/usr/local/lib/cmake/OpenVDB")
set(OPENVDB_USE_STATIC_LIBS ON)
find_package(OpenVDB REQUIRED)

target_link_libraries(
  ${PROJECT_NAME} PUBLIC 
                         OpenVDB::openvdb)