Opened 10 years ago

Closed 9 years ago

#27744 closed defect (fixed)

wxWidgets-devel lib has incorrect install name

Reported by: singingwolfboy@… Owned by: jyrkiwahlstedt
Priority: Normal Milestone:
Component: ports Version: 1.9.2
Keywords: Cc: bfulgham@…, macports@…, anddam (Andrea D'Amore)
Port: wxWidgets-devel


I'm developing a new port that relies on a lib installed by wxWidgets-devel, and I'm getting this error when I try to run it:

dbaumgold:src baumgold$ ./bitcoin 
dyld: Library not loaded: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_graphics_wxWidgets-devel/work/wxWidgets-2.9.1/build/lib/libwx_osx_cocoau-
  Referenced from: /opt/local/var/macports/build/_Users_baumgold_Dropbox_ports_crypto_bitcoin/work/bitcoin-0.3.19/src/./bitcoin
  Reason: image not found
Trace/BPT trap

A quick google search revealed that this seems to be the fault of the wxWidgets-devel port. ( Apparently, dynamic libraries have an "install name" that is used when dynamically linking from other software. libwx_osx_cocoau- has an incorrect install name, at least on my system:

dbaumgold:bitcoin-0.3.19 baumgold$ otool -D /opt/local/lib/wx-devel/libwx_osx_cocoau- 

This should be fixed so that other applications can build and run against this library. Other libraries in this port may have the same issue, but I haven't tested.

For reference, I'm running 10.6.5 on an Intel Macbook Pro.

Change History (11)

comment:1 Changed 10 years ago by singingwolfboy@…

The following command seems to fix it:

sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau- /opt/local/lib/wx-devel/libwx_osx_cocoau-

comment:2 Changed 10 years ago by bfulgham@…

Cc: bfulgham@… added

Cc Me!

comment:3 Changed 10 years ago by macports@…

I have the same problem, and would add that even the wxrc binary installed with this library fails to run because of this.

If, like me, you've installed the nonmonolithic variant, then you'll need a few more commands to get all the libs:

sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_baseu- /opt/local/lib/wx-devel/libwx_baseu-
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_baseu_net- /opt/local/lib/wx-devel/libwx_baseu_net-
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_baseu_xml- /opt/local/lib/wx-devel/libwx_baseu_xml-
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_adv- /opt/local/lib/wx-devel/libwx_osx_cocoau_adv-
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_aui- /opt/local/lib/wx-devel/libwx_osx_cocoau_aui-
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_core- /opt/local/lib/wx-devel/libwx_osx_cocoau_core-
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_gl- /opt/local/lib/wx-devel/libwx_osx_cocoau_gl-
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_html- /opt/local/lib/wx-devel/libwx_osx_cocoau_html-
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_media- /opt/local/lib/wx-devel/libwx_osx_cocoau_media-
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_propgrid- /opt/local/lib/wx-devel/libwx_osx_cocoau_propgrid-
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_qa- /opt/local/lib/wx-devel/libwx_osx_cocoau_qa-
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_ribbon- /opt/local/lib/wx-devel/libwx_osx_cocoau_ribbon-
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_richtext- /opt/local/lib/wx-devel/libwx_osx_cocoau_richtext-
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_stc- /opt/local/lib/wx-devel/libwx_osx_cocoau_stc-
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_xrc- /opt/local/lib/wx-devel/libwx_osx_cocoau_xrc-

comment:4 Changed 10 years ago by macports@…

Actually, just discovered those commands don't entirely fix the nonmonolithic variant, because the libs themselves link to each other, and I'm not sure how to fix the static full path to the incorrect install names in these already-built libs. Perhaps someone else knows more about this to make a working workaround!

comment:5 Changed 10 years ago by macports@…

Cc: macports@… added

Cc Me!

comment:6 Changed 10 years ago by pixilla (Bradley Giesbrecht)

I submitted a patch in #26410.
I also submitted a patch upstream where they claimed to be looking at it. I seem to recall the wx folks were short on developers on Mac.

comment:7 Changed 10 years ago by l2g@…

I'm unable to get past the install phase even with the latest patches attached to this ticket. This is what seems to make it choke:

/opt/local/var/macports/build/_Users_larry_work_macports_dports_graphics_wxWidgets-devel/work/wxWidgets-2.9.1/build/change-install-names /opt/local/var/macports/build/_Users_larry_work_macports_dports_graphics_wxWidgets-devel/work/destroot/opt/local/lib /opt/local/var/macports/build/_Users_larry_work_macports_dports_graphics_wxWidgets-devel/work/destroot/opt/local/bin /opt/local/lib /opt/local/var/macports/build/_Users_larry_work_macports_dports_graphics_wxWidgets-devel/work/wxWidgets-2.9.1/build/lib
Usage: install_name_tool [-change old new] ... [-rpath old new] ... [-add_rpath new] ... [-delete_rpath old] ... [-id name] input
make: *** [install] Error 1

comment:8 Changed 10 years ago by l2g@…

Oh, I'm on Snow Leopard. That might be important. :-)

comment:9 Changed 10 years ago by macports@…

Okay so here's a script that should fix either variant (monolithic or nonmonolithic). This is similar to the one I posted before but now fixes links between libs properly. Again, just a workaround, not a solution for the actual port (sorry, not really my expertise!)

Should be run using sudo and in in the /opt/local/lib/wx-devel/ directory.


for i in *.0.0.dylib
    for j in *.0.0.dylib
        install_name_tool -change "$OLD_DIR/$j" "$PWD/$j" "$i"

comment:10 Changed 9 years ago by anddam (Andrea D'Amore)

Cc: and.damore@… added

Cc Me!

comment:11 Changed 9 years ago by pixilla (Bradley Giesbrecht)

Resolution: fixed
Status: newclosed

Fixed r79389

Note: See TracTickets for help on using tickets.