Gnome libraries add a lot of implicit library dependencies via their pkg-config files: % pkg-config --libs gtk+-2.0 -L/usr/local/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lpthread -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lfontconfig -lfreetype These libraries are now detected as unlisted dependencies: Error: /usr/local/lib/libgoocanvas.so.3.5.0 is linked to /usr/local/lib/libgdk_pixbuf-2.0.so.0 from graphics/gdk-pixbuf2 but it is not declared as a dependency Warning: you need USE_GNOME+=gdkpixbuf2 Error: /usr/local/lib/libgoocanvas.so.3.5.0 is linked to /usr/local/lib/libfontconfig.so.1 from x11-fonts/fontconfig but it is not declared as a dependency Warning: you need LIB_DEPENDS+=libfontconfig.so:x11-fonts/fontconfig Error: /usr/local/lib/libgoocanvas.so.3.5.0 is linked to /usr/local/lib/libfreetype.so.6 from print/freetype2 but it is not declared as a dependency Warning: you need LIB_DEPENDS+=libfreetype.so:print/freetype2 Error: /usr/local/lib/libgoocanvas.so.3.5.0 is linked to /usr/local/lib/libcairo.so.2 from graphics/cairo but it is not declared as a dependency Warning: you need USE_GNOME+=cairo Error: /usr/local/lib/libgoocanvas.so.3.5.0 is linked to /usr/local/lib/libintl.so.8 from devel/gettext-runtime but it is not declared as a dependency Warning: you need USES+=gettext This should be fixed ASAP if we don't want many ports to be polluted with these bogus dependencies. Instead, these additional dependencies should be added implicitly by USE_GNOME parts.
Yes they should be added via USE_GNOME, but please look at the .pc file to determine the dependencies instead of using "pkg-config --libs".
(In reply to Tijl Coosemans from comment #1) > Yes they should be added via USE_GNOME, but please look at the .pc file to > determine the dependencies instead of using "pkg-config --libs". You mean Requires line? It's incomplete. gettext is not listed, for instance.
Requires and Libs. -lintl is added by glib-2.0.pc so it can be added to glib20_LIB_DEPENDS.
Mmm, might this be a case of overlinking ?
yes this is overlinking, it is known that lots of the gnome '.pc' files lead to overlinking and are badly formatted :(
As far as I know upstream is very well aware of this and it's all intentional. The dependencies are added by the headers. Some glib headers include libintl.h and then use gettext in some macros. Programs that use this API (directly or indirectly) can end up with calls to gettext and need to be linked with libintl.so. These programs shouldn't have to care about how the API is implemented (with gettext or something else) so the reasoning is that it's pkg-config's job to add -lintl. This means -lintl is always added even when it isn't strictly necessary, but there isn't any more fine-grained method. It would be nice if library requirements could be expressed in headers (and object files) so the compiler (and linker) know exactly what libraries are needed.
Created attachment 178045 [details] Add libintl.so to glib20_LIB_DEPENDS Attached patch adds libintl.so to glib20_LIB_DEPENDS. It should fix a very small part of the issue but this small part affects around 1800 ports.
A commit references this bug: Author: antoine Date: Sun Mar 12 08:25:23 UTC 2017 New revision: 435977 URL: https://svnweb.freebsd.org/changeset/ports/435977 Log: Add libintl.so to glib20_LIB_DEPENDS As noted in PR 209813, some glib headers include libintl.h and then use gettext in some macros. Programs that use this API (directly or indirectly) can end up with calls to gettext and need to be linked with libintl.so. glib-2.0.pc has -lintl in its Libs too. PR: 209813 With hat: portmgr Changes: head/Mk/Uses/gnome.mk
Forgotten to close?
No, libintl was just one case.
Moin moin Please re-open if this is still an issue. mfg Tobias
It is, in fact nothing has been done to fix it. Here's an example: --- PORTNAME= testport PORTVERSION= 0.0.0 DISTVERSIONPREFIX= v CATEGORIES= devel DISTFILES= # MAINTAINER= amdmi3@FreeBSD.org COMMENT= Empty comment USES= pkgconfig USE_GNOME= gtk30 PLIST_FILES= bin/testbin do-build: @${MKDIR} ${WRKSRC} echo 'int main(){}' > ${WRKSRC}/main.c cd ${WRKSRC} && ${CC} `pkg-config --libs --cflags gtk+-3.0` main.c -o testbin do-install: ${INSTALL_PROGRAM} ${WRKSRC}/testbin ${STAGEDIR}${PREFIX}/bin/ .include <bsd.port.mk> --- ====> Running Q/A tests (stage-qa) Error: /usr/local/bin/testbin is linked to /usr/local/lib/libcairo-gobject.so.2 from graphics/cairo but it is not declared as a dependency Warning: you need USE_GNOME+=cairo Error: /usr/local/bin/testbin is linked to /usr/local/lib/libcairo.so.2 from graphics/cairo but it is not declared as a dependency Warning: you need USE_GNOME+=cairo Error: /usr/local/bin/testbin is linked to /usr/local/lib/libgdk_pixbuf-2.0.so.0 from graphics/gdk-pixbuf2 but it is not declared as a dependency Warning: you need USE_GNOME+=gdkpixbuf2
I can work on this if there's no objection