-
-
Notifications
You must be signed in to change notification settings - Fork 741
build phobos as .so #1240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build phobos as .so #1240
Conversation
Needs dlang/druntime#470 |
Remember to set export to something like this in order to use the shared library:
and build your app like this:
and it should link with the shared library. Linking with the static library is the default, and works as before. |
This is currently only for linux. |
Those instructions should be in the docs somewhere. |
Of course. But I don't want to spend time writing it all up unless we are sure this is the way we're going. Remember, nobody liked my last scheme :-) |
Mine wasn't the right either.
Another way to do this is to install phobos2.so and phobos.a and use the following link flags
BTW I hope we can get rid of the |
I'm fine with this pull request, so please merge when the autotester goes green. |
@@ -151,6 +152,7 @@ DDOC=$(DMD) | |||
# Set LIB, the ultimate target | |||
ifeq (,$(findstring win,$(OS))) | |||
LIB = $(ROOT)/libphobos2.a | |||
LIBSO = $(ROOT)/libphobos2so.so |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an unusual convention. How about just leaving it to the extension? LIBSO = $(ROOT)/libphobos2.so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that, it doesn't work to have both libphobos2.a and libphobos2.so. There's no linker switch to force picking one or the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is: bracket the -lphobos
part with -Bstatic
and -Bdynamic
(those are linker flags. If you pass them to gcc you have to prepend -Wl,
)
Example:
gcc -Wl,-Bstatic -lphobos -Wl,-Bdynamic
(-Bdynamic is default)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move forward with what we have in the interest of time. I'll pull.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My reading of -Bdynamic was it didn't have pervasive support.
Build phobos as .so as well as .a