Skip to content
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

Shared library support for Linux #664

Merged
merged 23 commits into from Jul 7, 2014
Merged

Conversation

dnadlinger
Copy link
Member

There is still a bit more work to be done due to a bogus module collision check in druntime and an unresolved issue with the multithreaded fiber test in core.thread.

Should be ready now. This brings shared libraries to the same level of passing tests as regular master.

Now, we don't even attempt to build threadasm.S on CMake
versions older than 2.8.5 anyway.
The separation between core.*, gc.* and rt.* is frequently
violated today anyway to the point of meaninglessness, and
supporting a split runtime would cause a bit of a headache
for shared library build.
_Dmain is no longer referenced in druntime directly; instead,
we generate the C main() in __entrypoint and invoke _d_run_main
with _Dmain as parameter.
The extra paths were hardcoded (and depended upon in other
places) anyway, so just spell them out for clarity.
This is necessary for shared libraries linked only against
druntime to be possible. The library name has changed to
libphobos2-ldc (added '2') to avoid confusion.

See Github issue ldc-developers#416.
We need to refactor our code to avoid it eventually,
see GitHub ldc-developers#658.
Having the compilation step separate from the actual library
creation lets us reuse it for the new static unittest builds.
…efaultlib.

This is necessary as the only point of having -defaultlib
and -debuglib is to enable the user to customize the defaults
set in the configuration, for example to avoid linking to
Phobos.

GitHub: Fixes ldc-developers#416.
GitHub: Fixes ldc-developers#601.
The variable was empty when not building with MSVC anyway.
This way, the user can override any defaults defined in the
config file.
rebuild was somewhat widely used in the old D1 days, but now
is dead. Proof: The file was broken for a long time (note the
double -I-I), but not a single person complained. So even if
anybody still uses it, they are using a custom config file
already anyway.
@dnadlinger dnadlinger changed the title WIP: Shared library support for Linux. Shared library support for Linux Jul 4, 2014
@dnadlinger
Copy link
Member Author

@redstar, @Trass3r: Could you please test if this messes up the Windows build? I'd like the unit test build changes to go in as soon as possible (i.e. once Travis is back at the same state as master), as they will be very annoying to maintain. That being said, we probably don't want to ship the next release with BUILD_SHARED_LIBS=ON just yet, as there is a few important fixes to ship in 2.066.

@Trass3r
Copy link
Contributor

Trass3r commented Jul 4, 2014

Will test next week.

@dnadlinger
Copy link
Member Author

Okay, hopefully the Travis tests are now exactly at the same point as they were before (resp. are on master).

@dnadlinger
Copy link
Member Author

@redstar: Should be ready to go in now, with BUILD_SHARED_LIBS=ON giving the same test results as static libraries. d895c7f and 3563225 (maybe 7c474f3) should be the only changes affecting users on a default build.

This is not only much cleaner than the old hack that depended
on the tested modules not being linked in a second time from
the druntime/Phobos static libraries, but the hack obviously
also doesn't work for shared libraries.

Also unify the naming scheme and adapt the Travis config to
respect it.
This way, the user doesn't have to set LD_LIBRARY_PATH to be
able to run the test suite. We don't want to do this in the
install config, though, as rpath has security implications.
This brings the testsuite for druntime/Phobos as shared libraries
to the same level as when built against static libraries.
--as-needed seems to be on by default on Ubuntu 12.04 LTS
(GNU ld (GNU Binutils for Ubuntu) 2.22). This leads to
libphobos2-ldc-unittest.so not being linked it all, and thus
the modules to test not being found.
We still hit the 50 minute timeout otherwise. The
implementation, ..., well, I'd rather not talk about this.
@dnadlinger
Copy link
Member Author

Okay, I hope this now also "passes" (i.e., fails the same way as master) the build on Travis. Finally. Sigh.

@redstar
Copy link
Member

redstar commented Jul 7, 2014

@klickverbot Really great work!!!!

redstar added a commit that referenced this pull request Jul 7, 2014
Shared library support for Linux
@redstar redstar merged commit 3ccaec3 into ldc-developers:master Jul 7, 2014
@dnadlinger dnadlinger deleted the shared branch July 7, 2014 07:30
redstar pushed a commit that referenced this pull request Sep 27, 2014
Convert x.classinfo to typeid(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants