c - Mac gcc trying to link against old, nonexistent library -
i'm writing simple c program uses taglib library. had installed library in /usr/local , compiled , linked program against it. i've since removed library , attempting link against compiled version of library in location. problem when compile program now, compiles cleanly, when attempting run it, program looking library used exist in /usr/local/lib instead of new location. example, code , new taglib library in /users/mdi/code/tag.
i'm compiling program this:
cc main.c -wall -i./taglib/bindings/c -o tag -l./taglib/bindings/c/.libs -ltag_c
like said, compile completes no errors or warnings. when attempting run binary, error:
dyld: library not loaded: /usr/local/lib/libtag_c.0.dylib referenced from: /users/mdi/code/tag/./tag reason: image not found trace/bpt trap
running 'otool -l' on binary shows this:
tag: /usr/local/lib/libtag_c.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libsystem.b.dylib (compatibility version 1.0.0, current version 125.2.1)
why still trying use taglib library no longer exists in /usr/local/lib , more importantly, how fix this?
i don't develop on mac, believe problem library isn't located in default dynamic link path. varies on platform, /usr/local/lib common 1 amongst them, , that's why it's showing path linking @ runtime.
you can change default search path shard libraries, i'm uncertain of how on mac. should able set environment variable dyld_library_path within session force dyld search other directories before searching default directories.
%> export dyld_library_path=/path/to/your/library:$dyld_library_path
adding directories default search path @ system level better environment variable solution above, i'm unaware of how on mac.
edit:
after little searching, found link you'll find helpful.
Comments
Post a Comment