Subproject links against dynamic library when building both despite -Ddefault_library=static
See original GitHub issueMinimal example: https://github.com/Myaamori/meson_mwe/tree/master/default_options_override
This is a simple project that calls a subproject in which default_options: ['default_library=both']
is specified.
Build with:
meson -Ddefault_library=static build
ninja -v -C build default_options_override
Meson will link against the shared version of the library when it should opt for the static.
Python version: 3.8.2 Meson version: 0.56.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
CMake: how create a single shared library from all static ...
I would like to link these static libraries in a single shared library at the top_project level. The information I gathered so far...
Read more >Subprojects - The Meson Build system
A subproject example. Usually dependencies consist of some header files plus a library to link against. To declare this internal dependency use ...
Read more >Building And Using Static And Shared "C" Libraries
Shared libraries (also called dynamic libraries) are linked into the program in two stages. First, during compile time, the linker verifies that all...
Read more >Dynamic linking best practices - begriffs.com
In this article we'll learn how to build shared libraries and install them properly on several platforms. For guidance, we'll examine the ...
Read more >How to make a subproject export a link directory of a library ...
(static linking with dynamic loading) FreeImage (built as a shared library). I can correctly build perceptualdiff on its own.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Right, the general issue here has nothing to do with preferring static or shared and everything to do with subprojects currently being very suboptimal for people wishing to bundle fallback dependencies – this, and several other issues, are due to subprojects being optimized for meta-projects that build and install a collection of projects at once.
This does need fixing, subproject fallback dependencies should default to static and also default to not installing the static library or headers etc.
Nothing, and setting the subproject to
static
will fix the issue with freetype specifically—I don’t particularly care about the shared library when linking statically. The problem is more that I don’t think I should have to go set thedefault_library
manually for every single subproject that is building both by default. A lot of the time I want to link against the shared version, but for release builds on Windows I essentially want to say “link statically or die”. Barring that, “link statically when both options are available” would be an improvement over the status quo.