On 30-04-2009, at 04:39, Allin Cottrell wrote:

> On Wed, 29 Apr 2009, Henrique wrote:
>
>>    I still can't use Gretl (build 2009-04-28). When I double click on
>> Gretl's icon the system gives me:
>>
>> Dyld Error Message:
>>  Library not loaded: /usr/local/lib/libgmp.3.dylib
>>  Referenced from:
>> /Applications/Gretl.app/Contents/Resources/bin/../lib/ 
>> libgretl-1.0.0.dylib
>>  Reason: image not found
>
> OK, let's try one more time.  I thought we could get rid of
> DYLD_LIBRARY_PATH, but I guess not yet.  There's a new build:
>

You can get rid of it. This page was helpful for me: 
www.cocoadev.com/index.pl?ApplicationLinking

But all references to dynamic libraries (not only those in an  
executable) have to be modified with the @executable_path thing.
So if libgretl uses libgmp then that reference too must be changed to  
use @executable_path.
Also references in all .so files will have to be changed.

It took some experimenting to get it all working but I think the  
script at the end of this message  will do the job of modifying all  
references to "private" dylib's into references with @executable_path.
The script must be run in the directory where the Gretl.app resides.
Change the environment variables SRCPATH as appropriate.

Berend

Script starts here:

TOOL=install_name_tool

GRETLRES=Gretl.app/Contents/Resources

SRCPATH=/Users/berendhasselman/tmp/gretl-i386/lib

# path to dylib relative to path of executable
# executable here is the thing in directory bin
# I hope!

DSTPATH=@executable_path/../lib

# change install name of libraries
$TOOL  -id ${DSTPATH}/libgretl-1.0.0.dylib ${GRETLRES}/lib/ 
libgretl-1.0.0.dylib
$TOOL  -id ${DSTPATH}/libgmp.3.4.4.dylib   ${GRETLRES}/lib/libgmp. 
3.dylib
$TOOL  -id ${DSTPATH}/libmpfr.1.1.2.dylib  ${GRETLRES}/lib/libmpfr. 
1.dylib

# change copied install names
$TOOL -change   ${SRCPATH}/libgretl-1.0.0.dylib ${DSTPATH}/ 
libgretl-1.0.0.dylib \
                 ${GRETLRES}/bin/gretl_x11

$TOOL -change   ${SRCPATH}/libgmp.3.dylib  ${DSTPATH}/libgmp.3.dylib  \
                 ${GRETLRES}/bin/gretl_x11

$TOOL -change   ${SRCPATH}/libgretl-1.0.0.dylib  ${DSTPATH}/ 
libgretl-1.0.0.dylib  \
                 ${GRETLRES}/bin/gretlcli

$TOOL -change   ${SRCPATH}/libgmp.3.dylib  ${DSTPATH}/libgmp.3.dylib \
                 ${GRETLRES}/bin/gretlcli

$TOOL -change   ${SRCPATH}/libgmp.3.dylib  ${DSTPATH}/libgmp.3.dylib \
                 ${GRETLRES}/lib/libgretl-1.0.0.dylib

$TOOL -change   ${SRCPATH}/libgmp.3.dylib  ${DSTPATH}/libgmp.3.dylib   \
                 ${GRETLRES}/lib/libmpfr.1.1.2.dylib

for d in ${GRETLRES}/lib/gretl-gtk2/*.so
do
     $TOOL -change ${SRCPATH}/libgmp.3.dylib       ${DSTPATH}/libgmp. 
3.dylib       $d
     $TOOL -change ${SRCPATH}/libgretl-1.0.0.dylib ${DSTPATH}/ 
libgretl-1.0.0.dylib $d
done

d=${GRETLRES}/lib/gretl-gtk2/mp_ols.so
$TOOL -change ${SRCPATH}/libmpfr.1.dylib ${DSTPATH}/libmpfr.1.dylib $d

Reply via email to