Enable shared linking#1133
Conversation
|
Having the additional option of shared linking is good, in general.
At least this PR seems to clean up the cmake scripts a bit, so ⏩ |
|
I couldn't compile this branch on my Mac with clang. So far I found two problems
|
| ) | ||
|
|
||
| if(METIS_FOUND) | ||
| target_link_libraries(MathLib INTERFACE metis) |
There was a problem hiding this comment.
use ${METIS_LIBRARY} ✅
|
@norihiro-w The undefined symbols and INTERFACE vs PRIVATE/PUBLIC is easily fixable. The circular dependencies are more difficult, I'm working. I suggest to fix the first point, but leave the circular dependencies for further PRs. |
|
Build finished. |
| */ | ||
|
|
||
| #include "BiCGStab.h" | ||
| #include "../Sparse/CRSMatrix.h" |
There was a problem hiding this comment.
Do we allow .. in an include path? ✅
|
Before this PR is forgotten I propose following compromise: Static linking is removed for all but circularly dependent libraries until we are working on the resolution of those circular dependencies. When a circular dependency is broken, the STATIC flag must be removed. Further I propose to change one (or multiple) of the jenkins linux builds to dynamic linking, such that any new circular library dependencies can be recognized early on. |
| set( CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem" CACHE STRING "" FORCE ) | ||
| endif() | ||
|
|
||
| # When static libraries are going to be used in other libraries position |
There was a problem hiding this comment.
static libraries
I thought, this commit is about shared libs. (I'm not an expert, so maybe I'm simply confused)
There was a problem hiding this comment.
"... in other libraries..." means the shared libraries which are dependent on the static libraries.
Comment improvements are welcome.
There was a problem hiding this comment.
When static libraries are used in some shared libraries it is required that
also the static libraries have position independent code.
✅
|
I have added a Linux-PRs-dynamic test on jenkins building a debug config with shared libs. Currently testing, so if some of your PRs rise a red flag for Linux-PRs-dynamic ignore it for now. |
|
Ready for merge?! |
|
Jenkins: OGS-6/Gui/Win-PRs failed: https://svn.ufz.de:8443/job/OGS-6/job/Gui/job/Win-PRs/1673/ |
|
Rebased on ufz/master. It's ready if the tests are all green. Maybe one more time "Jenkins ... this please."... |
|
Jenkins: OGS-6/Gui/Win-PRs failed: https://svn.ufz.de:8443/job/OGS-6/job/Gui/job/Win-PRs/1674/ |
When building shared libraries -DBUILD_SHARED_LIBS=On must be passed to the cmake invokation. Otherwise the default static linking applies. This reduces the compile time, which is especially interesting for the debug builds.
This adds -fPIC to gcc/clang.
|
OpenGeoSys development has been moved to GitLab. |
Fixing metis linkage;Remove STATIC from add_library().With this changes and configuring the build for debug and with
-DBUILD_SHARED_LIBS=Onthe compile + linking time for the ogs target (from scratch, no ccache) reduces (for that particular branch endJunction/M2 with dynamic eigen matrices) from 3:45 to 2:55.The default build process should not change with this PR, because the static linking is chosen by default.
Update: On another machine there is no change, unfortunately, which I don't understand yet.