April 06, 2013 status of shared libs | ||||
---|---|---|---|---|
| ||||
is there a roadmap for druntime/phobos support of shared libraries? just built dmd from master, and I still can't coax out a 64 bit .so |
April 06, 2013 Re: status of shared libs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ellery Newcomer | On 4/5/2013 7:18 PM, Ellery Newcomer wrote: > is there a roadmap for druntime/phobos support of shared libraries? > > just built dmd from master, and I still can't coax out a 64 bit .so awaiting: https://github.com/D-Programming-Language/phobos/pull/1240 |
April 06, 2013 Re: status of shared libs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 04/05/2013 07:22 PM, Walter Bright wrote:
> On 4/5/2013 7:18 PM, Ellery Newcomer wrote:
>> is there a roadmap for druntime/phobos support of shared libraries?
>>
>> just built dmd from master, and I still can't coax out a 64 bit .so
>
> awaiting:
>
> https://github.com/D-Programming-Language/phobos/pull/1240
goody
|
April 06, 2013 Re: status of shared libs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 2013-04-06 04:22, Walter Bright wrote: > awaiting: > > https://github.com/D-Programming-Language/phobos/pull/1240 Everything in druntime is done? -- /Jacob Carlborg |
April 07, 2013 Re: status of shared libs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 04/05/2013 07:22 PM, Walter Bright wrote:
> On 4/5/2013 7:18 PM, Ellery Newcomer wrote:
>> is there a roadmap for druntime/phobos support of shared libraries?
>>
>> just built dmd from master, and I still can't coax out a 64 bit .so
>
> awaiting:
>
> https://github.com/D-Programming-Language/phobos/pull/1240
trying out the spiffy new shared lib support, I get this:
dmd -unittest -fPIC -defaultlib=phobos2so -shared test1.d -oflibtest1.so
gcc test1.c `pwd`/libtest1.so -L/usr/lib64/dmd/ -L/usr/lib/dmd/ -o test1.x
/lib64/libphobos2so.so: undefined reference to `_Dmain'
collect2: error: ld returned 1 exit status
_Dmain? wat?
|
April 07, 2013 Re: status of shared libs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ellery Newcomer | On 4/6/2013 7:15 PM, Ellery Newcomer wrote:
> dmd -unittest -fPIC -defaultlib=phobos2so -shared test1.d -oflibtest1.so
> gcc test1.c `pwd`/libtest1.so -L/usr/lib64/dmd/ -L/usr/lib/dmd/ -o test1.x
> /lib64/libphobos2so.so: undefined reference to `_Dmain'
> collect2: error: ld returned 1 exit status
>
>
> _Dmain? wat?
_Dmain is the mangled name for main() in your program.
|
April 07, 2013 Re: status of shared libs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ellery Newcomer | On 2013-04-07 04:15, Ellery Newcomer wrote: > trying out the spiffy new shared lib support, I get this: > > dmd -unittest -fPIC -defaultlib=phobos2so -shared test1.d -oflibtest1.so > gcc test1.c `pwd`/libtest1.so -L/usr/lib64/dmd/ -L/usr/lib/dmd/ -o test1.x > /lib64/libphobos2so.so: undefined reference to `_Dmain' > collect2: error: ld returned 1 exit status > > > _Dmain? wat? It's declared in druntime and therefore expected to be included: https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dmain2.d#L348 I think it needs weak linkage or similar. I don't know if it's possible to do in D, but in C it can be done like this: https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dylib_fixes.c Don't know if that is compiled and linked. There probably needs to be a way to exclude the C main function as well. -- /Jacob Carlborg |
April 07, 2013 Re: status of shared libs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On 04/07/2013 10:21 AM, Jacob Carlborg wrote:
> On 2013-04-07 04:15, Ellery Newcomer wrote:
> I think it needs weak linkage or similar. I don't know if it's possible
> to do in D, but in C it can be done like this:
>
> https://github.com/D-Programming-Language/druntime/blob/master/src/rt/dylib_fixes.c
>
>
Yes, druntime should only weakly link against _Dmain.
|
April 07, 2013 Re: status of shared libs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 04/06/2013 04:22 AM, Walter Bright wrote:
> On 4/5/2013 7:18 PM, Ellery Newcomer wrote:
>> is there a roadmap for druntime/phobos support of shared libraries?
>>
>> just built dmd from master, and I still can't coax out a 64 bit .so
>
> awaiting:
>
> https://github.com/D-Programming-Language/phobos/pull/1240
I see it's been added :-)
Are there any extra flags that need to be added to dmd.conf for this to work successfully? On my system I find that the shared library is not found when running programs built against it:
error while loading shared libraries: libphobos2so.so: cannot load shared
object file: no such file or directory
I can get round this by exporting /opt/dmd/lib to LD_LIBRARY_PATH but if I recall right, this is a frowned-upon way of identifying where shared libraries are to be found ...
|
April 07, 2013 Re: status of shared libs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | Am Sun, 07 Apr 2013 18:36:04 +0200 schrieb Joseph Rushton Wakeling <joseph.wakeling@webdrake.net>: > On 04/06/2013 04:22 AM, Walter Bright wrote: > > On 4/5/2013 7:18 PM, Ellery Newcomer wrote: > >> is there a roadmap for druntime/phobos support of shared libraries? > >> > >> just built dmd from master, and I still can't coax out a 64 bit .so > > > > awaiting: > > > > https://github.com/D-Programming-Language/phobos/pull/1240 > > I see it's been added :-) > > Are there any extra flags that need to be added to dmd.conf for this to work successfully? On my system I find that the shared library is not found when running programs built against it: > > error while loading shared libraries: libphobos2so.so: cannot load > shared object file: no such file or directory > > I can get round this by exporting /opt/dmd/lib to LD_LIBRARY_PATH but if I recall right, this is a frowned-upon way of identifying where shared libraries are to be found ... > In theory: Add the .so directory to /etc/ld.so.conf, run ldconfig http://linux.die.net/man/8/ldconfig But: This usually requires proper version information in the .so library and a properly set soname. I doubt anyone has looked into that yet. |
Copyright © 1999-2021 by the D Language Foundation