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

Description

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-2.9.1.0.0.dylib
  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. (http://lists.apple.com/archives/xcode-users/2009/aug/msg00165.html) Apparently, dynamic libraries have an "install name" that is used when dynamically linking from other software. libwx_osx_cocoau-2.9.1.0.0.dylib 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-2.9.1.0.0.dylib 
/opt/local/lib/wx-devel/libwx_osx_cocoau-2.9.1.0.0.dylib:
/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-2.9.1.0.0.dylib

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-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_osx_cocoau-2.9.1.0.0.dylib

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-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_baseu-2.9.1.0.0.dylib
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_baseu_net-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_baseu_net-2.9.1.0.0.dylib
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_baseu_xml-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_baseu_xml-2.9.1.0.0.dylib
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_adv-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_osx_cocoau_adv-2.9.1.0.0.dylib
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_aui-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_osx_cocoau_aui-2.9.1.0.0.dylib
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_core-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_osx_cocoau_core-2.9.1.0.0.dylib
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_gl-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_osx_cocoau_gl-2.9.1.0.0.dylib
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_html-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_osx_cocoau_html-2.9.1.0.0.dylib
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_media-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_osx_cocoau_media-2.9.1.0.0.dylib
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_propgrid-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_osx_cocoau_propgrid-2.9.1.0.0.dylib
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_qa-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_osx_cocoau_qa-2.9.1.0.0.dylib
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_ribbon-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_osx_cocoau_ribbon-2.9.1.0.0.dylib
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_richtext-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_osx_cocoau_richtext-2.9.1.0.0.dylib
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_stc-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_osx_cocoau_stc-2.9.1.0.0.dylib
sudo /usr/bin/install_name_tool -id /opt/local/lib/wx-devel/libwx_osx_cocoau_xrc-2.9.1.0.0.dylib /opt/local/lib/wx-devel/libwx_osx_cocoau_xrc-2.9.1.0.0.dylib


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.

#!/bin/sh
OLD_DIR="/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"

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

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.