By using otool I can find and add all the library files to a "lib" folder for my project. I am having trouble making my unix file (c++) reference the folder.
Even though the file "libtensorflow.2.dylib" is in a folder "lib" beside the "myproject" app. I have tried also putting the libraries in the same folder as well, children, side by side folders.... Any ideas? Or even ways to debug?
dyld: Library not loaded: @rpath/libtensorflow.2.dylib
referenced from: /Users/anan/Downloads/myproject 2/myproject
Reason: image not found
Here is a look at my cmake
cmake_minimum_required(VERSION 2.8.12) project(myproject)
set(CMAKE_MACOSX_RPATH OFF)
# if (CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_STANDARD 17) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-L /lib -I /lib -I /usr/local/include -L /usr/local/lib -l tensorflow -Wall -Os -g ${CMAKE_CXX_FLAGS}")
# -I /usr/local/include -L /usr/local/lib -l tensorflow -std=c++17
message("CMAKE_COMPILER_IS_GNUCXX is True")
message("option is: ${CMAKE_CXX_FLAGS}") endif() #(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# endif (CMAKE_COMPILER_IS_GNUCXX)
find_package(PkgConfig)
pkg_check_modules(libavcodec REQUIRED libavcodec)
add_compile_definitions(${libavcodec_CFLAGS_OTHER})
add_executable(myproject myproject.cpp)
target_link_libraries(mypro "-framework Cocoa")
target_link_libraries(myproject "-framework IOKit")
target_link_libraries(myproject ${libavcodec_LIBRARIES})
include(GNUInstallDirs) install(
TARGETS myproject
RUNTIME DESTINATION ./bin
LIBRARY DESTINATION ./lib
ARCHIVE DESTINATION ./lib
COMPONENT Application
)
set(CMAKE_MACOSX_BUNDLE 1)
set(CMAKE_INSTALL_RPATH "@executable_path/lib")
set(CPACK_COMPONENTS_ALL Application)
set(CPACK_COMPONENT_APPLICATION_DISPLAY_NAME "Analysis")
set(CPACK_GENERATOR "TGZ")
include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
set(CPACK_PACKAGE_VERSION_MAJOR "${myproject_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${myproject_VERSION_MINOR}")
include(CPack)