Don't add dependencies recursively while linking#1545
Don't add dependencies recursively while linking#1545jpakkane merged 4 commits intomesonbuild:masterfrom centricular:dont-link-recursively
Conversation
|
It appears that with this patch in the gtk4 meson build, the static gdk backend libs are no longer linked into the static lib libgdk.a now. They were passed to |
|
We really want this in as soon as possible. This may be the last chance to change this before we have too many users. |
|
Apparently we don't have a test for exe -> static -> static, only one for exe -> static-> shared. We should add one. |
|
Yeah, it's on my TODO list for this PR. |
|
FWIW, I'm building systemd with meson with this patch, and it seems to work nicely. |
|
I should have some time to work on this tomorrow. If we have enough tests for various corner-cases, we could merge this for 0.40, and fix any breakage in a point release? |
|
This message is posted to every outstanding merge request. We have transitioned from Github wiki to our new documentation system that generates all documentation directly from the Git repo. This means that from now on every merge request must come with corresponding documentation changes. If your MR requires documentation changes, do the necessary changes to files in If your MR adds a new feature, add a description to the release notes in If this commit is just a bugfix with no functional changes, you don't need to do anything. Thank you |
Linking dynamically against libudev will fail once mesonbuild/meson#1545 is merged and apparently already triggers a link failure on s390x. Make libshared provide by the udev symbols by including libudev_sources into libshared. This will cause those files to be compiled twice, but it actually reduces the installed size and is closer to what the autotools build system is doing. Closes systemd#5828
Linking dynamically against libudev will fail once mesonbuild/meson#1545 is merged and apparently already triggers a link failure on s390x. Make libshared provide the udev symbols by including libudev_sources into libshared. This will cause those files to be compiled twice, but it actually reduces the installed size and is closer to what the autotools build system is doing. Closes systemd#5828
Linking dynamically against libudev will fail once mesonbuild/meson#1545 is merged and apparently already triggers a link failure on s390x. Make libshared provide the udev symbols by including libudev_sources into libshared. This will cause those files to be compiled twice, but it actually reduces the installed size and is closer to what the autotools build system is doing. Closes #5828
|
What's the status of this? Is any help needed? |
|
Dropped off my list accidentally, will look into this today! |
We were doing this on the basis of an old comment, but there was no test for it and I couldn't reproduce the issue with clang on Linux at all. Let's add a (somewhat comprehensive) test and see if it breaks anywhere if we stop doing this. Halves the size of gstreamer's build.ninja from 20M to 8.7M Closes #1057
This significantly reduces the size of build.ninja for GStreamer.
Now we aggressively de-dup the list of libraries used while linking, and when linking with GNU ld we have to enclose all static libraries with -Wl,--start-group and -Wl,--end-group to force the linker to resolve all symbols recursively. This is needed when static libraries have circular deps on each other (see included test). The --start/end-group change is also needed for circular dependencies between static libraries because we no longer recursively list out all library dependencies. The size of build.ninja for GStreamer is now down to 6.1M from 20M, and yields a net reduction in configuration time of 10%
|
"Today" came 18 days late, but I have something that works for most cases now. Some people will get build failures because they under-specified the libraries that they need, but gstreamer itself didn't need any such fixes and that makes me think that people are generally disciplined about this. Anyway, the fix in such cases is easy and is backwards-compatible so I think we shouldn't worry about this too much. |
Codecov Report
@@ Coverage Diff @@
## master #1545 +/- ##
==========================================
+ Coverage 63.01% 63.07% +0.06%
==========================================
Files 58 58
Lines 16882 16900 +18
Branches 3456 3464 +8
==========================================
+ Hits 10638 10660 +22
+ Misses 5150 5148 -2
+ Partials 1094 1092 -2
Continue to review full report at Codecov.
|
This is more reliable, and more accurate. For instance, this means arguments in commands aren't surrounded by `'` on Linux unless that is actually needed by that specific argument. There is no equivalent helper for Windows, so we keep the old behaviour for that.
|
|
||
| if mesonlib.is_windows(): | ||
| quote_char = '"' | ||
| quote_func = lambda s: '"{}"'.format(s) |
There was a problem hiding this comment.
[flake8]
- [E731] do not assign a lambda expression, use a def
| quoter = ninja_quote | ||
| else: | ||
| templ = q_templ | ||
| quoter = lambda x: ninja_quote(quote_func(x)) |
There was a problem hiding this comment.
[flake8]
- [E731] do not assign a lambda expression, use a def
|
Also, here's some stats: glib's All this with no significant changes in configure time (gst-build's configure time went down by 10% for me, but likely because of the smaller These numbers can be reduced a bunch more by using Ninja rules for each target so that build statements don't have to repeat the cflags over and over for each source file in the target. We could reduce this even more by putting compiler-specific cflags in the compiler rules instead of in each target's build statements. Interestingly, the "use shlex.quote for quoting" commit in this PR also reduces the |
I'm surprised that this works on platforms without groupings, mainly MSVC. IIRC it does something saner than LD by looking at past libraries for symbols. So the question is:
If the latter is true (dunno, maybe Solaris or somesuch works like that) then having the dependencies a a set is problematic because you would need have something like We could also say that this is too niche and we don't care or will fix it later if the issue really arises. |
|
I wrote the Perhaps Sun Studio's
Specifying a library multiple times will now be ignored because we de-dup library names in the |
|
Let's list the platforms that we actively support:
Others:
Is there anything else we want to support? I think most edge-platforms actually rely on GCC, so we shouldn't have much to worry about. |
|
gold? |
|
I tested gold, it behaves the same way as bfd at least on Fedora. |
|
🏁 🎉 🎆 🥂 |
We were doing this on the basis of an old comment, but there was no test for it and I couldn't reproduce the issue with clang on Linux at all.
Let's add a test and see if it breaks anywhere if we stop doing this.
Halves the size of gstreamer's build.ninja from 19M to 8.5M
Closes #1057