conda dev env on OS X: libnnpdf.dylib not linking correctly
Created by: wilsonmr
I was trying to set up a dev env on my mac for the first time in quite a long time, if ever. I saw that nnfit isn't linking to libnnpdf.dylib correctly, seems to be similar to #98 (closed) which was supposedly fixed by #152
nnfit
dyld: Library not loaded: @rpath/libnnpdf.dylib
Referenced from: /Users/michael/anaconda3/envs/vpdev/bin/nnfit
Reason: image not found
Abort trap: 6
I found this: https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling
and modified the top level CMakeLists.txt
to (reverting #152 and adding a bit):
cmake_minimum_required (VERSION 3.0.2)
# Disable the use of RPATHS - we probably are not
# that interested in relocatable binaries and it
# causes a lot of trouble on macOS
#SET(CMAKE_SKIP_RPATH TRUE)
# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
which then correctly linked the libraries. Seems to be the opposite to what @nhartland found. Curious about the behaviour other Mac users i.e @nhartland @voisey see.
Also as a side note: getting the conda compilers to work on Mac required me to download MacOSX10.9.sdk and then export CONDA_BUILD_SYSROOT
to it's location, although it mentions this on the anaconda compilers page it took me a while to figure out, perhaps this could be added to VP2 dev install guide?