Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 149 - using libgdruntime.so and libgphobos2.so
Summary: using libgdruntime.so and libgphobos2.so
Status: RESOLVED FIXED
Alias: None
Product: GDC
Classification: Unclassified
Component: gdc (show other bugs)
Version: 4.9.x
Hardware: x86 Linux
: --- enhancement
Assignee: Iain Buclaw
URL:
Depends on:
Blocks:
 
Reported: 2014-08-12 07:08 CEST by Ketmar Dark
Modified: 2016-09-17 08:18 CEST (History)
2 users (show)

See Also:


Attachments
patch to build and use libgdruntime.so and libgphobos2.so (9.50 KB, patch)
2014-08-12 07:08 CEST, Ketmar Dark
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ketmar Dark 2014-08-12 07:08:57 CEST
Created attachment 73 [details]
patch to build and use libgdruntime.so and libgphobos2.so

a made a quick-and-dirty patch to build and use libgdruntime.so and libgphobos2.so.

this is not a ready-to-use patch, and virtually nothing was tested with it (just some my toy projects). also i'm suck at autotools, so --enable-shared flag does nothing at all: .so files will be build and installed uncoditionally.

but i made -static-libphobos to work as expected (i.e. using libgphobos2.a).

the patch uncoditionally adds -lcurl, 'cause libgphobos2.so wants it. this, of course, sux and should be fixed.

i'm pretty sure that -fPIC will not work too (see bug #100 — i'm not sure if anything was changed from that time).

the patch was made against current gdc-4.9 git branch.


anyway, feel free to play with it. somebody has to start this work and it happened that i have a free evening to write something we can play with. there is a huge amount of work before this will become usable, of course.
Comment 1 Johannes Pfau 2014-08-12 09:11:49 CEST
Looks like we had the same idea:
https://github.com/D-Programming-GDC/GDC/pull/83
Comment 2 Ketmar Dark 2014-08-12 09:40:05 CEST
wow. i definetely should take a look at your work.

for now i found that GC is completely broken in my case (and it does alot of allocations which are absent in -static-libphobos variant). i'm not yet familiar with D runtime, so i don't know what i missed here. perhaps i'll be able to figure it from your PR.

alas, i have no github account (and i don't want to register on github), and this makes thing unnecessary compilcated. ah, i don't yet have alot of time to work on this anyway. but nevertheless i hope to sort out the things eventually. ;-)
Comment 3 Ketmar Dark 2014-08-12 17:16:05 CEST
2Johannes Pfau:

ah. seems that we are trying to do slightly different things. i'm not trying to do 'general' shared library support. what i want to do is to allow gdc to use only runtime and phobos as shared objects. this seems to be the independent goal, with it's own set of complications.

so your work on general .so support will nicely complement this one. keep it up! ;-)
Comment 4 Ketmar Dark 2014-08-12 18:24:25 CEST
seems that GC frees list of active threads and then core.thread uses it.

sure, i missed some call that should anchor that list.

sorry for making chat here, but i have no other place to discuss such things.
Comment 5 Johannes Pfau 2014-08-13 09:28:31 CEST
These changes in the pull request include support for plugins, but they also provide what you want: Phobos and druntime as shared libraries for normal dynamic linking.

Your GC problem is that the GC can't find the data segment in the shared libraries (same for TLS). See https://github.com/jpf91/GDC/commit/1dc78aa2bd9764e653364f952c7985f81b5d94a0
Comment 6 Ketmar Dark 2014-08-13 19:34:17 CEST
ah. project shut down. Johannes Pfau did it.
Comment 7 Iain Buclaw 2016-09-17 08:18:41 CEST
Phobos is now built as a shared library in master.