Undefined reference to _d_throw

Mike Wey mike-wey at example.com
Sun Nov 3 03:23:38 PST 2013


On 11/02/2013 10:08 PM, Jacob Carlborg wrote:
> On 2013-11-02 21:12, Steve Teale wrote:
>
>> CodeBlocks is supervising the compilation. I had added the libraries to
>> its recipe in the wrong order:
>>
>> pthread
>> m
>> phobos2
>>
>> The opposite way round it links OK, bu there's still something strange
>> going on. When I try to run it, it fails with:
>>
>> ./compo: error while loading shared libraries: libphobos2.so.0.2: cannot
>> open shared object file: No such file or directory
>>
>> This is true, there is no such file. In /usr/lib/i386-linux-gnu there's
>> only libphobos2.so - a real file - which in my understanding should be a
>> link to an actual shared library file.
>>
>> Is there a working shared Phobos library in 2.063, or is this a .deb
>> file error. If I have /usr/lib/i386-linux-gnu/libphobos.a instead of
>> phobos2, the program links and at least attempts to run. It may crash
>> later, but that's my fault.
>>
>> This is not just a CodeBlocks thing. I made a simple makefile instead
>> that links the libraries in the right order. That links, but also fails
>> with the missing Phobos shared library error.
>
> Shared libraries are quite a new thing in D. I'm pretty sure it's
> supposed to link with the static library by default. Usually you can
> force linking with a static library by doing
> -L-l:/path/to/staticlibrary.a. Note the colon in the beginning of the
> path. Although I don't know if you can do that with Phobos. It seems
> like CodeBlocks is doing something strange here.
>

You could try putting:

:libphobos2.a

in the list of libraries for CodeBlocks, as it doesn't require the full 
path.

-- 
Mike Wey


More information about the Digitalmars-d mailing list