more fun with ubuntu

Ellery Newcomer ellery-newcomer at utulsa.edu
Sun May 26 08:18:18 PDT 2013


On 05/26/2013 08:10 AM, Ellery Newcomer wrote:
> On 05/26/2013 07:55 AM, Jesse Phillips wrote:
>> On Sunday, 26 May 2013 at 05:01:10 UTC, Ellery Newcomer wrote:
>>> I have a project here which fails on link on ubuntu 12.10.
>>>
>>> It give undefined reference errors for functions in libdl and libutil.
>>> For some reason, ld won't cooperate unless you pass -ldl -lutil at the
>>> end of the command string. Holy Ubuntu!
>>>
>>> I can't seem to get dmd to do this though. Any suggestions?
>>>
>>> I am using the beta, but apparently this is a thing with ubuntu.
>>
>> It is not uncommon to request the libraries needed to build your app.
>> Dmd passes a couple/one for phobos dependencies, but other libraries
>> need to be reqested.
>
> I am doing that.
>
> I think the problem is libpython2.7.a requires libdl and libutil, and ld
> requires -ldl and -lutil be positioned after libpython2.7.a, but dmd
> very stubbornly arranges them before libpython2.7.a in the call to gcc.


dmd -unittest -property -debug -gc  -version=Python_2_7_Or_Later 
-version=Python_2_6_Or_Later -version=Python_2_5_Or_Later 
-version=Python_2_4_Or_Later -L-ldl 
/usr/lib/python2.7/config/libpython2.7.a  object_.d -ofobject_.x 
-I../../infrastructure/  -L-ldl -L-lutil -v


dmd turns the above into:

gcc object_.o -o object_.x -g -m64 -ldl -ldl -lutil 
-L/usr/lib/x86_64-linux-gnu -L/usr/lib/i386-linux-gnu -Xlinker 
--no-warn-search-mismatch -Xlinker --export-dynamic 
/usr/lib/python2.7/config/libpython2.7.a -l:libphobos2.a -lpthread -lm -lrt

which fails, but


gcc object_.o -o object_.x -g -m64 -ldl -ldl -lutil 
-L/usr/lib/x86_64-linux-gnu -L/usr/lib/i386-linux-gnu -Xlinker 
--no-warn-search-mismatch -Xlinker --export-dynamic 
/usr/lib/python2.7/config/libpython2.7.a -l:libphobos2.a -lpthread -lm 
-lrt -ldl -lutil

works.


More information about the Digitalmars-d-learn mailing list