osx - Dylib ok at link time but not at runtime -
i have problem linking correctly project. project build cmake.
have problem linking correctly project. project build cmake.
linking seems fine, run time throws error.
the command use link:
$ /usr/bin/clang -wl,-search_paths_first -wl,-headerpad_max_install_names cmakefiles/project.dir/src/conf.c.o cmakefiles/project.dir/src/tun-compat.c.o cmakefiles/project.dir/src/compress.c.o cmakefil\ es/project.dir/src/mc.c.o cmakefiles/project.dir/src/hexdump.c.o cmakefiles/project.dir/src/server.c.o cmakefiles/project.dir/sys/unix/log.c.o cmakefiles/project.dir/sys/unix/imsg.c.o cmakefiles/project.dir/\ sys/unix/imsg-buffer.c.o cmakefiles/project.dir/sys/unix/toto.c.o cmakefiles/project.dir/sys/unix/toto.c.o cmakefiles/project.dir/sys/unix/util.c.o cmakefiles/project.dir/sys/unix/conf.c.o cmakefile\ s/project.dir/sys/unix/tntsocket.c.o -o bin/project /opt/local/lib/libevent_openssl.dylib /opt/local/lib/libevent_core.dylib /usr/lib/libz.dylib /opt/local/lib/libyajl.dylib /opt/local/lib/libtapcfg.dylib
the error get:
$ ./bin/project dyld: library not loaded: build/libtapcfg.dylib referenced from: /users/antoine/project/./bin/project reason: image not found zsh: trace trap ./bin/project
additional infos:
$ dyldinfo -dylibs bin/projectattributes dependent dylibs /opt/local/lib/libevent_openssl-2.0.5.dylib /opt/local/lib/libevent_core-2.0.5.dylib /usr/lib/libz.1.dylib /opt/local/lib/libyajl.2.dylib build/libtapcfg.dylib /usr/lib/libsystem.b.dylib
it looks black magic me. linker able find symbols, end changing path of library if can't see difference in way handled in linking command...
the lib location /opt/local/lib/libtapcfg.dylib
$ ls -lhf /opt/local/lib/libtapcfg.dylib -rwxr-xr-x 1 root admin 20k 14 jui 18:05 /opt/local/lib/libtapcfg.dylib*
maybe problem come lib linking ?
the issue how built , installed libtapcfg.
you seem have copied local directory /opt/local/lib , file system path not match stored in library.
either leave lib in local path or when building tell linker end or copy /usr/local/lib hard coded in linker. see apple developer's note on dynamic libraries
you should put things in /opt/local when using macports means of port. in case create local portfile not have , macports standard work put correct information in library make work /opt/local/lib
Comments
Post a Comment