dyld: Library not loaded, Mac, wxWidgets

General questions regarding the usage of CodeLite
EricRFMA
CodeLite Curious
Posts: 4
Joined: Fri Oct 24, 2014 10:39 pm
Genuine User: Yes
IDE Question: C++
Contact:

dyld: Library not loaded, Mac, wxWidgets

Post by EricRFMA »

Hello...

I just started using Codelite, and am currently running Weekly Build - Oct 23, 2014 - CodeLite 7.0, under Mac OS 10.9.5.

I have a simple project... in fact I haven't modified it since I created it. It's a "Simple Executable (wxWidgets enabled)" project.

It builds fine, but when I try to run it I get:

Code: Select all

dyld: Library not loaded: /usr/local/opt/wxmac/lib/libwx_osx_cocoau_xrc-3.0.dylib
  Referenced from: /Volumes/Projects/Graph_Processing/Debug/./Graph_Processing
  Reason: image not found
If I do an "otool -L" on the executable, sure enough there's:

Code: Select all

/usr/local/opt/wxmac/lib/libwx_osx_cocoau_xrc-3.0.dylib (compatibility version 2.0.0, current version 2.0.0)
However, I don't have a /usr/local/opt/wxmac directory.

Here's the kicker... the link line looks like this (decomposed for your viewing pleasure):

Code: Select all

/Applications/Xcode.app/Contents/Developer/usr/bin/g++ 
-o ./Debug/Graph_Processing @"Graph_Processing.txt"
-L.  
-L/usr/local/Cellar/wxmac/3.0.1/lib  
-framework IOKit
-framework Carbon
-framework Cocoa
-framework AudioToolbox
-framework System
-framework OpenGL
-framework QuickTime
-lwx_osx_cocoau_xrc-3.0
-lwx_osx_cocoau_webview-3.0
-lwx_osx_cocoau_html-3.0
-lwx_osx_cocoau_qa-3.0
-lwx_osx_cocoau_adv-3.0
-lwx_osx_cocoau_core-3.0
-lwx_baseu_xml-3.0
-lwx_baseu_net-3.0
-lwx_baseu-3.0
There's no mention of /usr/local/opt/wxmac anywhere.

And, in fact, there is a /usr/local/Cellar/wxmac/3.0.1/lib directory which does contain the "missing" dylib (and all the other wx dylibs) which is on the command line.

If I enter the link line directly at a shell prompt, and run the result, the same thing happens. It also happens if I compile from the command-line as well.

Here's the entire build log:

Code: Select all

/bin/sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/make -j24 -e -f  Makefile'
----------Building project:[ Graph_Processing - Debug ]----------
/Applications/Xcode.app/Contents/Developer/usr/bin/g++   -c  "/Projects/Graph_Processing/main.cpp" -g -O0 -Wall -I/usr/local/Cellar/wxmac/3.0.1/lib/wx/include/osx_cocoa-unicode-3.0 -I/usr/local/Cellar/wxmac/3.0.1/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__   -o ./Debug/main.cpp.o -I.
/Applications/Xcode.app/Contents/Developer/usr/bin/g++  -o ./Debug/Graph_Processing @"Graph_Processing.txt" -L.   -L/usr/local/Cellar/wxmac/3.0.1/lib   -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -framework QuickTime -lwx_osx_cocoau_xrc-3.0 -lwx_osx_cocoau_webview-3.0 -lwx_osx_cocoau_html-3.0 -lwx_osx_cocoau_qa-3.0 -lwx_osx_cocoau_adv-3.0 -lwx_osx_cocoau_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0
ld: warning: ignoring file /System/Library/Frameworks//QuickTime.framework/QuickTime, file was built for i386 which is not the architecture being linked (x86_64): /System/Library/Frameworks//QuickTime.framework/QuickTime
0 errors, 0 warnings
For good measure, I did an 'nm -a' on main.cpp.o and there's no mention of /usr/local/opt/wxmac anywhere.

I don't know what else to try... can someone advise?

Thanks!

Regards,
Eric
:?:
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: dyld: Library not loaded, Mac, wxWidgets

Post by eranif »

First some comments:
- On OSX - use clang{++} and not g++

There is a good chance that the missing file is symblinked from another file

Try this:

ls -l on the folder: "/usr/local/Cellar/wxmac/3.0.1/lib"

BTW:
Is this a self built wxWidgets?
If its not, then there is a good chance that the packages of wxWidgets did not ran 'install_name_tool' on the output, so the original paths from the builder kept in the binaries you are using.

Try running:
"otool -L" on one of the wxWidgets libraries and see if any library is referencing this path

Eran
Make sure you have read the HOW TO POST thread
EricRFMA
CodeLite Curious
Posts: 4
Joined: Fri Oct 24, 2014 10:39 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: dyld: Library not loaded, Mac, wxWidgets

Post by EricRFMA »

Thanks for your reply, Eran!

I switched to clang++ as recommended

The library is symlinked, which I already had noticed:

Code: Select all

-r--r--r--  1 eric  wheel   3758436 Oct 24 05:42 libwx_baseu-3.0.0.1.0.dylib
lrwxr-xr-x  1 eric  wheel        27 Sep 24 01:30 libwx_baseu-3.0.0.dylib -> libwx_baseu-3.0.0.1.0.dylib
lrwxr-xr-x  1 eric  wheel        23 Sep 24 01:30 libwx_baseu-3.0.dylib -> libwx_baseu-3.0.0.dylib
.
.
.
It makes it easy to change versions and maintain a file with a higher level version. Not sure how this would enter in to the problem.

However, you hit the nail on the head:

Code: Select all

libwx_osx_cocoau_xrc-3.0.dylib
	/usr/local/opt/wxmac/lib/libwx_osx_cocoau_xrc-3.0.dylib (compatibility version 2.0.0, current version 2.0.0)
I didn't build wx myself. I installed it using homebrew.

It doesn't make sense why it would reference /usr/local/opt. Do you have any ideas? I'll look into it in the meantime.

Thanks!

-Eric
EricRFMA
CodeLite Curious
Posts: 4
Joined: Fri Oct 24, 2014 10:39 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: dyld: Library not loaded, Mac, wxWidgets

Post by EricRFMA »

It turns out I had a weird hodgepodge of wx installed. I nuked it all, reinstalled wxmac via homebrew, and now, no problem.

Thanks again!

-Eric
Post Reply