-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Generated pkg-config file contain linker flags for uninstalled static libraries #3934
Comments
Don't you need |
Only when using it for static link. When using the shared library |
It shouldn't really matter: There are a lot of projects that use internal static libraries to build an installed shared library; the internal The reason why |
If you're not going to provide static libraries, then use shared_library() instead of library(). As far as I know the generated pc file is correct for static links, and you must install libgeoclue-public-api.a. |
Note that meson's pc generator special case shared_library() to not pull its dependencies, exactly for the case you're describing. But since geoclue uses library() it means it wants to provide the static library. |
That's a bit of a trap, though… |
Note that at least on Ubuntu the libgeoclue-dev package does provide libgeoclue.a, so I think using link_whole and library() as in geoclue master is the right thing to do. |
Using
|
Reference to actual working code: https://gitlab.freedesktop.org/geoclue/geoclue/merge_requests/8 |
I think this related to #3937. |
This commit contains the following fixes: 1. When a shared library A does `link_with:` to static library B, the parts of B used by A will be added to A, and so we don't need to return B in A.get_dependencies() for targets that link to A. This already is the behaviour when a shared library A does `link_whole:` on B. 2. In situation (1), when generating a pkg-config file for A, we must also not add B to Libs.private for A. This already is the behaviour when a shared library A does `link_whole:` on B. 3. When a static library A does `link_whole:` to static library B, we must add the objects in B to A. 4. When a static library A does `link_with:` to static library B, and B is not installed (which makes it an internal static library), we must add the objects in B to A, otherwise nothing can use A. 5. In situation (4), when generating a pkg-config file for A, we must also not add B to Libs.private for A. All these situations are tested by the unit test added in this commit. Closes #3934 Closes #3937
This commit contains the following fixes: 1. When a shared library A does `link_with:` to static library B, the parts of B used by A will be added to A, and so we don't need to return B in A.get_dependencies() for targets that link to A. This already is the behaviour when a shared library A does `link_whole:` on B. 2. In situation (1), when generating a pkg-config file for A, we must also not add B to Libs.private for A. This already is the behaviour when a shared library A does `link_whole:` on B. 3. When a static library A does `link_whole:` to static library B, we must add the objects in B to A. 4. When a static library A does `link_with:` to static library B, and B is not installed (which makes it an internal static library), we must add the objects in B to A, otherwise nothing can use A. 5. In situation (4), when generating a pkg-config file for A, we must also not add B to Libs.private for A. All these situations are tested by the unit test added in this commit. Closes #3934 Closes #3937
This commit contains the following fixes: 1. When a shared library A does `link_with:` to static library B, the parts of B used by A will be added to A, and so we don't need to return B in A.get_dependencies() for targets that link to A. This already is the behaviour when a shared library A does `link_whole:` on B. 2. In situation (1), when generating a pkg-config file for A, we must also not add B to Libs.private for A. This already is the behaviour when a shared library A does `link_whole:` on B. 3. When a static library A does `link_whole:` to static library B, we must add the objects in B to A. 4. When a static library A does `link_with:` to static library B, and B is not installed (which makes it an internal static library), we must add the objects in B to A, otherwise nothing can use A. 5. In situation (4), when generating a pkg-config file for A, we must also not add B to Libs.private for A. All these situations are tested by the unit test added in this commit. Closes #3934 Closes #3937
This commit contains the following fixes: 1. When a shared library A does `link_with:` to static library B, the parts of B used by A will be added to A, and so we don't need to return B in A.get_dependencies() for targets that link to A. This already is the behaviour when a shared library A does `link_whole:` on B. 2. In situation (1), when generating a pkg-config file for A, we must also not add B to Libs.private for A. This already is the behaviour when a shared library A does `link_whole:` on B. 3. When a static library A does `link_whole:` to static library B, we must add the objects in B to A. 4. When a static library A does `link_with:` to static library B, and B is not installed (which makes it an internal static library), we must add the objects in B to A, otherwise nothing can use A. 5. In situation (4), when generating a pkg-config file for A, we must also not add B to Libs.private for A. All these situations are tested by the unit test added in this commit. Closes #3934 Closes #3937
Hi, Is this the same issue that I am hit by here? When I try to build GLib for instance with Visual Studio+Ninja, my glib-2.0.pc contains the following for Libs.private: Libs.private: -L${libdir} -lcharset -lgnulib -lpcre -lws2_32 -lwinmm Note the part where it says -lcharset and -lgnulib, which are static .lib's that are internal to the glib-2.0-0.dll that I am trying to build Likewise for the generated gio-2.0.pc: Note the part where it says -lgiowin32, which is a static .lib that is internal to the gio-2.0-0.dll that I am trying to build. These static .lib's get in the way when I try to build items using Meson that depends on these pkg-config files, as these static .lib's would not be found since they won't be installed, so as a workaround I need to remove them from these pkg-config files before I try to build any other projects using Meson that depends on them. With blessings, and cheers, and thank you! |
This commit contains the following fixes: 1. When a shared library A does `link_with:` to static library B, the parts of B used by A will be added to A, and so we don't need to return B in A.get_dependencies() for targets that link to A. This already is the behaviour when a shared library A does `link_whole:` on B. 2. In situation (1), when generating a pkg-config file for A, we must also not add B to Libs.private for A. This already is the behaviour when a shared library A does `link_whole:` on B. 3. When a static library A does `link_whole:` to static library B, we must add the objects in B to A. 4. When a static library A does `link_with:` to static library B, and B is not installed (which makes it an internal static library), we must add the objects in B to A, otherwise nothing can use A. 5. In situation (4), when generating a pkg-config file for A, we must also not add B to Libs.private for A. All these situations are tested by the unit test added in this commit. Closes #3934 Closes #3937
This commit contains the following fixes: 1. When a shared library A does `link_with:` to static library B, the parts of B used by A will be added to A, and so we don't need to return B in A.get_dependencies() for targets that link to A. This already is the behaviour when a shared library A does `link_whole:` on B. 2. In situation (1), when generating a pkg-config file for A, we must also not add B to Libs.private for A. This already is the behaviour when a shared library A does `link_whole:` on B. 3. When a static library A does `link_whole:` to static library B, we must add the objects in B to A. 4. When a static library A does `link_with:` to static library B, and B is not installed (which makes it an internal static library), we must add the objects in B to A, otherwise nothing can use A. 5. In situation (4), when generating a pkg-config file for A, we must also not add B to Libs.private for A. All these situations are tested by the unit test added in this commit. Closes #3934 Closes #3937
This commit contains the following fixes: 1. When a shared library A does `link_with:` to static library B, the parts of B used by A will be added to A, and so we don't need to return B in A.get_dependencies() for targets that link to A. This already is the behaviour when a shared library A does `link_whole:` on B. 2. In situation (1), when generating a pkg-config file for A, we must also not add B to Libs.private for A. This already is the behaviour when a shared library A does `link_whole:` on B. 3. When a static library A does `link_whole:` to static library B, we must add the objects in B to A. 4. When a static library A does `link_with:` to static library B, and B is not installed (which makes it an internal static library), we must add the objects in B to A, otherwise nothing can use A. 5. In situation (4), when generating a pkg-config file for A, we must also not add B to Libs.private for A. All these situations are tested by the unit test added in this commit. Closes #3934 Closes #3937
Switch back to autotools to fix static build with rygel (and so reverts partially commit 66a3fbb "package/gupnp: bump to version 1.0.4"). Indeed gupnp uses meson's subproject feature for guul which is just plainly broken on static build with meson, see: mesonbuild/meson#3934 mesonbuild/meson#3937 mesonbuild/meson#3939 This will fix a build failure with rygel Fixes: - http://autobuild.buildroot.org/results/ebbf96a1be5547e416feb1e96e55986890d0a1de Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
libcommon isn't even installed, so that means libalpm.a (if installed) is fatally broken as it misses objects. The problem is that meson doesn't handle this case correctly: mesonbuild/meson#3934 mesonbuild/meson#3937 mesonbuild/meson#3939 Work around this by manually extracting libcommon's .o files into the list of objects used to create libalpm.
Should be fixed by #5936 |
libcommon isn't even installed, so that means libalpm.a (if installed) is fatally broken as it misses objects. The problem is that meson doesn't handle this case correctly: mesonbuild/meson#3934 mesonbuild/meson#3937 mesonbuild/meson#3939 Work around this by manually extracting libcommon's .o files into the list of objects used to create libalpm. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
If a library target A depend on an uninstalled static library target B,
pkgconfig.generate()
will add-lB
to theLibs.private
key of the pkg-config file.Meson version: 0.47.1
Example, taken from Geoclue:
public-api/meson.build
:libgeoclue/meson.build
:libgeoclue-2.0.pc
file:The
-lgeoclue-public-api
is wrong, and will cause any user oflibgeoclue-2.0
to break.The text was updated successfully, but these errors were encountered: