[m-users.] Fwd: Beginner question: How to use an installed library

Julien Fischer jfischer at opturion.com
Mon Sep 7 18:53:24 AEST 2015


Hi,

The problem that Dirk encountered is actually a general "gotcha" with 
Mercury shared libraries on OS X: altering the value of 
--install-prefix after the .dylib files have been generated may result
in a broken library installation -- the install prefix has to be set
consistently across the entire build.

I'll add a paragraph to the user's guide describing the problem and
the possible resolutions.

Julien.

On Mon, 7 Sep 2015, Dirk Ziegemeyer wrote:

> Fyi - I forgot to set the m-users list in cc.
>
> Julien had an idea that solved my problem.
>
> Dirk
>
>> Anfang der weitergeleiteten Nachricht:
>>
>> Von: Dirk Ziegemeyer <dirk at ziegemeyer.de>
>> Betreff: Aw: [m-users.] Beginner question: How to use an installed library
>> Datum: 5. September 2015 19:57:36 MESZ
>> An: Julien Fischer <juliensf at gmail.com>
>>
>>
>>> Am 05.09.2015 um 10:22 schrieb Julien Fischer <juliensf at gmail.com>:
>>>
>>> I have an idea of what my have happened here, namely that that the installation prefix was not set when
>>> the .dylib file was generated and the install name burned into it.  When you built the library did you do:
>>>
>>>     $ make INSTALL_PREFIX=/foo/bar/baaz
>>>     $ make INSTALL_PREFIX=/foo/bar/baaz install
>>
>> No.
>>
>>> or
>>>
>>>    $ make
>>>    $ make INSTALL_PREFIX=/foo/bar/baaz install
>>>
>>
>> Yes.
>>
>>> The difference is that with the latter the install name for the .dylib file will be set to the default installation
>>> directory even though it will be installed in /foo/bar/baaz by the install target.  You can check this by running
>>> 'otool -L' on the .dylib file and seeing what the install name for the dylib file itself is.
>>
>> Otool-output is:
>> $ otool -L libmercury_csv.dylib
>> libmercury_csv.dylib:
>> 	/usr/local/mercury-rotd-2015-02-20/lib/mercury/lib/hlc.gc/libmercury_csv.dylib (compatibility version 0.0.0, current version 0.0.0)
>> 	/usr/local/mercury-rotd-2015-02-20/lib/mercury/lib/hlc.gc/libmer_std.dylib (compatibility version 0.0.0, current version 0.0.0)
>> 	/usr/local/mercury-rotd-2015-02-20/lib/mercury/lib/hlc.gc/libmer_rt.dylib (compatibility version 0.0.0, current version 0.0.0)
>> 	/usr/local/mercury-rotd-2015-02-20/lib/mercury/lib/libgc.dylib (compatibility version 0.0.0, current version 0.0.0)
>> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
>>
>>
>> The issue is solved now after typing:
>> $ make INSTALL_PREFIX=/foo/bar/baaz
>> $ make INSTALL_PREFIX=/foo/bar/baaz install
>>
>>
>> Otool now prints:
>> $ otool -L libmercury_csv.dylib
>> libmercury_csv.dylib:
>> 	/Users/dirk/temp/mercury_csv/lib/mercury/lib/hlc.gc/libmercury_csv.dylib (compatibility version 0.0.0, current version 0.0.0)
>> 	/usr/local/mercury-rotd-2015-02-20/lib/mercury/lib/hlc.gc/libmer_std.dylib (compatibility version 0.0.0, current version 0.0.0)
>> 	/usr/local/mercury-rotd-2015-02-20/lib/mercury/lib/hlc.gc/libmer_rt.dylib (compatibility version 0.0.0, current version 0.0.0)
>> 	/usr/local/mercury-rotd-2015-02-20/lib/mercury/lib/libgc.dylib (compatibility version 0.0.0, current version 0.0.0)
>> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
>>
>> Thank you very much.
>>
>> Dirk
>
> _______________________________________________
> users mailing list
> users at lists.mercurylang.org
> https://www.mercurylang.org/lists/listinfo/users
>



More information about the users mailing list