mirror of
https://github.com/google/brotli.git
synced 2026-07-08 17:56:58 +00:00
pkg-config --static not working #310
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jay on GitHub (Feb 14, 2020).
The static libraries have the name -static appended to them but pkg-config --static returns the regular name. I don't think there is a way to treat the library name as different for static in pkg-config.
libbrotlicommon-static.a
libbrotlidec-static.a
libbrotlienc-static.a
@emerzon commented on GitHub (Mar 1, 2020):
I have same issue. Quick and Dirty workaround was to symlink libs to their names without the "-static" suffix.
@jay commented on GitHub (Mar 3, 2020):
I did something similar
@wader commented on GitHub (Jun 17, 2020):
Hello! i was bitten by this and wondering if i could help resolve it somehow.
@eustas i'm curious when you were working on https://github.com/google/brotli/pull/599 was there reason the static library ended up having a -static suffix?
@ILW000 commented on GitHub (Apr 21, 2021):
I did workaround similar in the opposite way. I edited files
libbrotl*.pcto provide static only compilation (replaced-lbrotl*to-lbrotl*-staticinside alllibbrotl*.pcfiles). It's Dirty workaround method of course.@eustas commented on GitHub (Jan 6, 2023):
Should work now. Feel free to reopen if it doesn't.
@nh2 commented on GitHub (Jul 13, 2023):
@eustas What was changed?
@eustas commented on GitHub (Jul 14, 2023):
#599
@nh2 commented on GitHub (Jul 14, 2023):
@eustas How can/does it fix this issue though?
PR #599 was merged in 2017; this issue was filed in 2020.
Aren't the generated files still suffixed
-static.a, but the.pcfile does not mention this suffix, as the issue description here describes?@eustas commented on GitHub (Jul 14, 2023):
Indeed, did not read through the thread carefully.
@nh2 commented on GitHub (Jul 14, 2023):
@eustas If there is no drawback for your use case from it, I propose to just name the files
without any suffix. This way, systems such as
pkg-configand GCC will pick them up correctly automatically.Given that
.afiles are always static, the-staticsuffix in the file name is semantically not necessary.@eustas commented on GitHub (Jul 14, 2023):
There are #601 and #655; I was under impression that the later dealt with
-staticsuffix... Going to re-check on Monday.@eustas commented on GitHub (Jul 14, 2023):
Yes, CMake now builds without suffix... but shared and static builds have to be done in separate runs...
@eustas commented on GitHub (Jul 14, 2023):
Likely that is ok, since CMake is not a solution responsible for making packages...
@nh2 commented on GitHub (Jul 14, 2023):
CMake now does have a feature to build
.aand.sofrom the same.ofiles so that you don't have to compile twice:https://stackoverflow.com/questions/2152077/is-it-possible-to-get-cmake-to-build-both-a-static-and-shared-library-at-the-sam/29824424#29824424
The drawback, as described there:
From a distro packager's perspective, it is usually fine if the CMake builds
.ofiles multiple times, as long as I can conveniently end up with both.aand.soand control them independently e.g. using CMake variables.@eustas commented on GitHub (Jul 14, 2023):
Yup, we've moved to object libraries in fresher projects, perhaps it is time to modernize brotli as well. PIC is fine, it is better for security... There are other problems in CMake object libraries, we already know how to deal with them =)
@arp242 commented on GitHub (Jun 6, 2024):
I don't know anything that works like brotli does now by allowing only building one or the other; having both static and dynamic libraries built is the desirable situation on pretty much any Linux package system. I don't see what #655 fixed, it only broke things.
Package systems don't have a way to say "use cmake, but run it twice, with different options", so need to kludge around all of this. The old situation with -static suffix wasn't ideal, but could be worked around with a bit of sed.
Right now I can't recompile anything that depends on brotli unless I also manually compile brotli instead of using the distro package. There isn't any (reasonable) way distro packages can ship the .a files at all. All of this is a huge hassle especially if you're compiling to a different target (I now need to set up an entire build environment for that, instead of being able to rely on packages).
(I'd send a patch if I could understand any of this cmake magic...)