[CMake] Installation corrupts library on OS X
Peter Eastman
peastman at stanford.edu
Tue Oct 14 15:10:36 EDT 2014
Hi Clint,
In my case, it wasn't anything like that. I was only specifying /usr/local/cuda/lib once. More specifically, my CMakeLists.txt specified
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${CUDA_LIBRARIES})
where CUDA_LIBRARIES is
/usr/local/cuda/lib/libcudart.dylib-Wl,-rpath-Wl,/usr/local/cuda/lib
This library also linked against another of my libraries, that also happened to link against CUDA. So that's why it was getting referenced twice: once directly, and once indirectly via a second library.
In any case, it's not clear to me why CMake is calling "install_name_tool -delete_rpath". Everything works fine without doing that. And when you do it, that breaks things.
Peter
On Oct 14, 2014, at 11:06 AM, Clinton Stimpson <clinton at elemtech.com> wrote:
> Here's a simple way to reproduce from the command line:
>
> echo "void foo() {}" > lib.c
> gcc -dynamiclib -o libtest.dylib -Wl,-rpath,/usr/lib -Wl,-rpath,/usr/lib lib.c
> install_name_tool -delete_rpath /usr/lib libtest.dylib
> otool -L libtest.dylib
> # gives me the error: "load command 13 size zero (can't advance to other
> load commands)"
>
> At install time, CMake will call "install_name_tool -delete_rpath ... " as
> needed.
>
> I can't get into Apple's bug tracker. I don't know why. When I try to log
> in, it comes back with a generic error and it asks me to email them with
> details about the error.
>
> When I do the same on Linux, the GNU linker will consolidate the duplicate
> paths.
>
> Thanks!
>
> Clint
More information about the CMake
mailing list