Watch, Follow, &
Connect with Us

Welcome, Guest
Guest Settings
Help

Thread: Library not loaded libcgunwind.1.0.dylib



Permlink Replies: 2 - Last Post: Mar 27, 2017 4:51 AM Last Post By: Ivan Johansen Threads: [ Previous | Next ]
Ivan Johansen

Posts: 22
Registered: 3/17/00
Library not loaded libcgunwind.1.0.dylib
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 4, 2017 5:31 AM
I am trying to port a DLL to OS X. I have managed to create an so file, but when I try to load it I get this error:
OSError: dlopen(fmx.so, 6): Library not loaded: @rpath/libcgunwind.1.0.dylib
Referenced from: /Users/IvanJohansen/PAServer/scratch-dir/Ivan Johansen-Parallels OS X/fmx/fmx.so
Reason: image not found

I have tried to copy the libcgunwind.1.0.dylib file to the same directory as the .so file, but it didn't help. What do I need to do to get libcgunwind.1.0.dylib loaded?

Ivan Johansen
Ivan Johansen

Posts: 22
Registered: 3/17/00
Re: Library not loaded libcgunwind.1.0.dylib
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 7, 2017 1:48 PM   in response to: Ivan Johansen in response to: Ivan Johansen
Ivan Johansen wrote:
I have tried to copy the libcgunwind.1.0.dylib file to the same directory as the .so file, but it didn't help. What do I need to do to get libcgunwind.1.0.dylib loaded?

The command "otool -l <lib>" shows some information about there required files should be located, but that didn't help me.

For now I have solved the problem by copying libcgunwind.1.0.dylib to /src/lib, but to do that it is necessary to disable System Integrity Protection (SIP), so it is not an acceptable permanent solution.
Ivan Johansen

Posts: 22
Registered: 3/17/00
Re: Library not loaded libcgunwind.1.0.dylib
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 27, 2017 4:51 AM   in response to: Ivan Johansen in response to: Ivan Johansen
Ivan Johansen wrote:
I am trying to port a DLL to OS X. I have managed to create an so file, but when I try to load it I get this error:
OSError: dlopen(fmx.so, 6): Library not loaded: @rpath/libcgunwind.1.0.dylib
Referenced from: /Users/IvanJohansen/PAServer/scratch-dir/Ivan Johansen-Parallels OS X/fmx/fmx.so
Reason: image not found

I have tried to copy the libcgunwind.1.0.dylib file to the same directory as the .so file, but it didn't help. What do I need to do to get libcgunwind.1.0.dylib loaded?

Now I am answering myself because I like talking to myself.

otool -L fmx.so will show a list of all required libraries and where they should be located.
@rpath is just a list of paths stored in the library.
otool - l fmx.so will show a lot of information from the library. Look for LC_RPATH to see paths that are part of @rpath. Per default @rpath only contains @executable_path/.
This means that the loader will look for libcgunwind.1.0.dylib where the executable is found, which could be inside an .app-file.
install_name_tool -add_rpath @loader_path fmx.so will add @loader_path to @rpath, so the loader will also look at the same directory as fmx.so for the dependency files.

Ivan Johansen
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02