I'm trying to use rpath to link in some libraries for an app. Some of the rpaths work others don't.
I have two dynamic libraries I'm linking to libgunrock and libtd both in different directories.
My link like looks like the following:
gcc -L/Users/aterrel/workspace/apps/gunrock/build/lib/ -Wl,-rpath -Wl,/Users/aterrel/workspace/apps/gunrock/build/lib/ -lgunrock -L/Users/aterrel/workspace/apps/xdata/xlang/thunderdome -Wl,-rpath -Wl,/Users/aterrel/workspace/apps/xdata/xlang/thunderdome -ltd app-c-gunrock-bokeh.o -o app
The load paths are correct. The relavant parts of the otool -l app:
Load command 16
cmd LC_RPATH
cmdsize 64
path /Users/aterrel/workspace/apps/gunrock/build/lib/ (offset 12)
Load command 17
cmd LC_RPATH
cmdsize 72
path /Users/aterrel/workspace/apps/xdata/xlang/thunderdome (offset 12)
Load command 18
Yet I still get the error:
dyld: Library not loaded: libtd.dylib
Referenced from: /Users/aterrel/workspace/apps/xdata/xlang/webgraph/apps/c-gunrock-bokeh/./app
Reason: image not found
Trace/BPT trap: 5
If I run with DYLD_LIBRARY_PATH=/Users/aterrel/workspace/apps/xdata/xlang/thunderdome app works fine.
I don't understand why libgunrock.dylib is loaded fine but libtd.dylib is not.
Related
I am using omnet++ v.6.0 (on MacBook pro with an m1 processor) and the debugger gives me the following error:
Could not determine GDB version using command: lldbmi2 --version dyld
[4595]: Library not loaded: # rpath / LLDB.framework / LLDB
Referenced from:
/Users/gerald/Desktop/TESI/omnetpp-6.0/tools/macos.x86_64/bin/lldbmi2
Reason: tried:
'/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB'
(no such file),
'/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/LLDB'
(no such file ), '/Library/Frameworks/LLDB.framework/LLDB' (no such
file), '/System/Library/Frameworks/LLDB.framework/LLDB' (no such file)
Can you please help me to solve it?
I had installed the Image::Magick Module (ImageMagick 7.0.9-25 OSX 10.14.6)
For installing I use this documentation:
https://imagemagick.org/script/perl-magick.php
On running every Image::Magick script I got a OSX warning:
dyld: warning, LC_RPATH #executable_path/../lib in /usr/local/opt/openexr/lib/libIlmImf-2_4.24.dylib being ignored in restricted program because of #executable_path
dyld: warning, LC_RPATH #executable_path/../lib in /usr/local/opt/ilmbase/lib/libImath-2_4.24.dylib being ignored in restricted program because of #executable_path
dyld: warning, LC_RPATH #executable_path/../lib in /usr/local/opt/ilmbase/lib/libHalf-2_4.24.dylib being ignored in restricted program because of #executable_path
dyld: warning, LC_RPATH #executable_path/../lib in /usr/local/opt/ilmbase/lib/libIexMath-2_4.24.dylib being ignored in restricted program because of #executable_path
dyld: warning, LC_RPATH #executable_path/../lib in /usr/local/opt/ilmbase/lib/libIex-2_4.24.dylib being ignored in restricted program because of #executable_path
dyld: warning, LC_RPATH #executable_path/../lib in /usr/local/opt/ilmbase/lib/libIlmThread-2_4.24.dylib being ignored in restricted program because of #executable_path
What the meaning of the warning?
How can fix it?
Using the new Xcode 8 GM build on the GM of macOS Sierra, I've recompiled a Qt 5.7 C++ project and I'm getting the following error message when trying to launch the app:
Reason: no suitable image found. Did find:
/path/to/my/lib/libio_core.dylib:
malformed mach-o image: symbol table underruns __LINKEDIT
This doesn't occur on debug builds, only release. Does anyone have an idea as to what this means and how to go about fixing it?
Update:
This actually has nothing to do with Xcode 8. Building the same code with Xcode 7.3.1 results in the same outcome. It seems some apps that ran just fine on El Capitan won't run on Sierra and fail with the above error.
Update 2: Details about the symbol table in my binary:
Load command 5
cmd LC_SYMTAB
cmdsize 24
symoff 0
nsyms 0
stroff 12760
strsize 8
Turns out this was caused by Qt. Qt 5.7.0 calls strip with no arguments when performing the install task on libs. With macOS Sierra this results in a dylib with an empty symtab.
This bug will be fixed in Qt 5.7.1. In the meantime, just make sure you call strip with -S -x for dynamic libraries.
I am seeing a similar error and I have just figured it out in my case. I hope what I found will help you too.
So, basically, as far as I can tell, this happens when your binary has an empty symbol table (there might be other cases, though). You can check this by running objdump -private-headers <library>:
<...>
Load command 4
cmd LC_SYMTAB
cmdsize 24
symoff 0
nsyms 0 <-- no symbols, oops
stroff 4104
strsize 8
<...>
Linker believes that if the symbol table is empty (nsyms 0) it is ok to say that the offset of the table into the file is zero (symoff 0). So, strictly speaking, it claims that the table starts right at the beginning of the binary.
Apparently, the new version of dyld from 10.12 Sierra performs a check that previous versions did not perform: it makes sure that the symbols table is entirely within the __LINKEDIT segment. Well, in our case the symbol table clearly violates this constraint and dyld does not care that it is empty.
I would call this an Apple’s bug: their linker creates malformed binaries and doesn’t bother to even issue a warning. If I were Apple, I would modify the condition in dyld to ignore the symbol table constraint if the symbol table is empty.
There is only one workaround I can see: add a dummy symbol to your reexport library.
I want to try out RInside for Mac OSX. I downloaded RInside from source using Terminal and then went into the /inst/examples/standard and tried to run make, as indicated in the answer to this thread: RInside on Mac OS X
However, the first error I received was fatal error: 'RInside.h' file not found. I manually found this file and put it into the /inst/examples/standard directory and ran make again. I received another fatal error for another .h file so I manually found the requisite file and inserted it into this standard directory. Anyway, after doing that a few more times, all dependencies were taken care of, then I ran make again and received the following very strange error:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I also tried using clang++ -stdlib=libstdc++ in place of g++ (since RInside on Mac OS X says that g++ won't work), but it did not help either (i.e., I received the same architecture errors).
I am stuck here...
UPDATE:
As per Dirk Eddelbuettel's advice, I tried installing XTools (Run Windows X System on OSX), but I received the following error: "Xtools.pkg" is damaged and can't be opened. You should eject the disk image."
I am concerned that running a simple "hello world" script as provided on the RInside webpage (http://dirk.eddelbuettel.com/code/rinside.html) can be this convoluted on the Mac as to demand external installs and miscellaneous configurations. Hence, there must be a more straightforward way to run RInside on the Mac OS X.
I don't know what happened but suddenly all my git commands won't work no more, this is the error message I get.
$ git show
dyld: lazy symbol binding failed: Symbol not found: _iconv_open
Referenced from: /usr/local/bin/git
Expected in: /Applications/MAMP/Library/lib//libiconv.2.dylib
dyld: Symbol not found: _iconv_open
Referenced from: /usr/local/bin/git
Expected in: /Applications/MAMP/Library/lib//libiconv.2.dylib
Any help is appreciated, thanks!
Additional info:
When I check the libiconv.2.dylib file it gives me this output:
$ file /usr/lib/libiconv.2.dylib
/usr/lib/libiconv.2.dylib: Mach-O universal binary with 2 architectures
/usr/lib/libiconv.2.dylib (for architecture i386): Mach-O dynamically linked shared library i386
/usr/lib/libiconv.2.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
Which I understand should be 3 architectures, How would I add the third one?
EDIT:
these are the links inside /Applications/MAMP/Library/lib/
-rwxrwxr-x 1 mm admin 1194 Jan 22 10:52 libgettextsrc.la
-rwxrwxr-x 1 nm admin 2241972 Jan 22 11:00 libiconv.2.dylib
lrwxr-xr-x 1 nm admin 16 Mar 1 10:06 libiconv.dylib -> libiconv.2.dylib
I also had DYLD_LIBRARY_PATH set to my XAMPP location. I managed to fix it by also adding usr/lib back to DYLD-DYLD_LIBRARY_PATH in the .bash_profile
export DYLD_LIBRARY_PATH=/usr/lib/:$DYLD_LIBRARY_PATH
Finally figured it out, I had DYLD_LIBRARY_PATH enabled in my .bash_profile, the path was set to the mamp folder, so that git checks there first for the library.
I had a similar problem where git wouldn't work and I got this same error. I was running Mountain Lion. I decided to run all my updates to see if that would help anything. (Mavericks was a free upgrade, so I did that.) After completing my OS updates, I tried git again and got a message "xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download command line developer tools." I selected download in the dialog box, install the xcode tools and tried it again and it worked like a charm!