I am trying to build an executable that uses several dylibs in the execution path. This works for some, but for one it doesn’t and I do not understand why.
otool -L
shows the following:
<code>@rpath/libtuio.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/liburg_library.dylib (compatibility version 0.0.0, current version 0.0.0)
/libIrrlicht.dylib (compatibility version 1.0.0, current version 1.0.0)
</code>
<code>@rpath/libtuio.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/liburg_library.dylib (compatibility version 0.0.0, current version 0.0.0)
/libIrrlicht.dylib (compatibility version 1.0.0, current version 1.0.0)
</code>
@rpath/libtuio.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/liburg_library.dylib (compatibility version 0.0.0, current version 0.0.0)
/libIrrlicht.dylib (compatibility version 1.0.0, current version 1.0.0)
The library it does not work for is libIrrlicht
, which, I think, should also have @rpath/
in front of it, but I do not know how to make CMake do that.
Linker command generated by CMake:
<code>/usr/bin/clang++ -g -arch arm64
[...]
-Wl,-rpath,@loader_path/
[...]
bin/libtuio.dylib
bin/liburg_library.dylib
[...]
external/lib_mac_arm/libIrrlicht.dylib
</code>
<code>/usr/bin/clang++ -g -arch arm64
[...]
-Wl,-rpath,@loader_path/
[...]
bin/libtuio.dylib
bin/liburg_library.dylib
[...]
external/lib_mac_arm/libIrrlicht.dylib
</code>
/usr/bin/clang++ -g -arch arm64
[...]
-Wl,-rpath,@loader_path/
[...]
bin/libtuio.dylib
bin/liburg_library.dylib
[...]
external/lib_mac_arm/libIrrlicht.dylib
The obvious difference is that libtuio
and liburg_library
are compiled in the process, while libIrrlicht
is precompiled and supplied – but copied to the executable folder post-build.