gpr icon indicating copy to clipboard operation
gpr copied to clipboard

"Library not loaded: @rpath/libgpr.dylib" when running tests/example

Open bramp opened this issue 4 years ago • 2 comments

cmake .
make

then

$ ./all-tests
dyld[97154]: Library not loaded: @rpath/libgpr.dylib
  Referenced from: /Users/bramp/gpr/all-tests
  Reason: tried: '/usr/local/lib/libgpr.dylib' (no such file), '/usr/lib/libgpr.dylib' (no such file)
Abort trap: 6

Same issue with ./parse-gcode.

I don't understand dynamic linkers enough, but this is on a Mac.

bramp avatar Jan 27 '22 05:01 bramp

Hmmm I normally run on Mac and I don't see this problem. Where is libgpr.dylib installed when you build?

dillonhuff avatar Jan 27 '22 06:01 dillonhuff

To be clear, I didn't do make install, just make.

$ find .

./CMakeFiles
./CMakeFiles/parse-gcode.dir
./CMakeFiles/parse-gcode.dir/DependInfo.cmake
./CMakeFiles/parse-gcode.dir/compiler_depend.ts
./CMakeFiles/parse-gcode.dir/compiler_depend.make
./CMakeFiles/parse-gcode.dir/depend.make
./CMakeFiles/parse-gcode.dir/cmake_clean.cmake
./CMakeFiles/parse-gcode.dir/link.txt
./CMakeFiles/parse-gcode.dir/progress.make
./CMakeFiles/parse-gcode.dir/build.make
./CMakeFiles/parse-gcode.dir/flags.make
./CMakeFiles/parse-gcode.dir/src
./CMakeFiles/parse-gcode.dir/src/main.cpp.o
./CMakeFiles/parse-gcode.dir/src/main.cpp.o.d
./CMakeFiles/cmake.check_cache
./CMakeFiles/3.22.1
./CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin
./CMakeFiles/3.22.1/CMakeDetermineCompilerABI_C.bin
./CMakeFiles/3.22.1/CompilerIdC
./CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.c
./CMakeFiles/3.22.1/CompilerIdC/CMakeCCompilerId.o
./CMakeFiles/3.22.1/CompilerIdC/tmp
./CMakeFiles/3.22.1/CompilerIdCXX
./CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.o
./CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp
./CMakeFiles/3.22.1/CompilerIdCXX/tmp
./CMakeFiles/3.22.1/CMakeCXXCompiler.cmake
./CMakeFiles/3.22.1/CMakeCCompiler.cmake
./CMakeFiles/3.22.1/CMakeSystem.cmake
./CMakeFiles/CMakeOutput.log
./CMakeFiles/CMakeError.log
./CMakeFiles/all-tests.dir
./CMakeFiles/all-tests.dir/DependInfo.cmake
./CMakeFiles/all-tests.dir/compiler_depend.ts
./CMakeFiles/all-tests.dir/test
./CMakeFiles/all-tests.dir/test/parser_tests.cpp.o.d
./CMakeFiles/all-tests.dir/test/main.cpp.o
./CMakeFiles/all-tests.dir/test/parser_tests.cpp.o
./CMakeFiles/all-tests.dir/test/main.cpp.o.d
./CMakeFiles/all-tests.dir/compiler_depend.make
./CMakeFiles/all-tests.dir/depend.make
./CMakeFiles/all-tests.dir/cmake_clean.cmake
./CMakeFiles/all-tests.dir/link.txt
./CMakeFiles/all-tests.dir/progress.make
./CMakeFiles/all-tests.dir/build.make
./CMakeFiles/all-tests.dir/flags.make
./CMakeFiles/Makefile.cmake
./CMakeFiles/gpr.dir
./CMakeFiles/gpr.dir/DependInfo.cmake
./CMakeFiles/gpr.dir/compiler_depend.ts
./CMakeFiles/gpr.dir/compiler_depend.make
./CMakeFiles/gpr.dir/depend.make
./CMakeFiles/gpr.dir/cmake_clean.cmake
./CMakeFiles/gpr.dir/link.txt
./CMakeFiles/gpr.dir/progress.make
./CMakeFiles/gpr.dir/build.make
./CMakeFiles/gpr.dir/flags.make
./CMakeFiles/gpr.dir/src
./CMakeFiles/gpr.dir/src/parser.cpp.o.d
./CMakeFiles/gpr.dir/src/parser.cpp.o
./CMakeFiles/gpr.dir/src/gcode_program.cpp.o.d
./CMakeFiles/gpr.dir/src/gcode_program.cpp.o
./CMakeFiles/CMakeTmp
./CMakeFiles/progress.marks
./CMakeFiles/TargetDirectories.txt
./CMakeFiles/CMakeDirectoryInformation.cmake
./CMakeFiles/Makefile2
./Makefile
./cmake_install.cmake
./parse-gcode
./README.md
./.gitignore
./libgpr.dylib
./all-tests
./CMakeCache.txt

Interestingly, after posting this bug, I created my own CMakeLists.txt in a parent directory

project(app)

cmake_minimum_required (VERSION 2.8.12)

set (CMAKE_CXX_STANDARD 11)
add_subdirectory(gpr)
add_executable(app main.cpp)
target_link_libraries(app gpr)

and that does run successfully, while using your library.

bramp avatar Jan 27 '22 06:01 bramp