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
Conversation
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.
@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. |
Will test next week. |
Okay, hopefully the Travis tests are now exactly at the same point as they were before (resp. are on master). |
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.
Okay, I hope this now also "passes" (i.e., fails the same way as master) the build on Travis. Finally. Sigh. |
@klickverbot Really great work!!!! |
Shared library support for Linux
Convert x.classinfo to typeid(x)
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 incore.thread
.Should be ready now. This brings shared libraries to the same level of passing tests as regular
master
.