On Thu, Oct 19, 2023 at 08:52:28PM -0400, Greg Troxel wrote: > Riccardo Mottola <riccardo.mott...@libero.it> writes: > > > who sets what pkgconf returns for the packages? Is it upstream or does > > it come from NetBSD? > > For packages: > generally, upstream, and pkgsrc tries to fix it if it is not right. It > is often not right... > > For the base system: it's really up to NetBSD. > > > I think there is an issue with freetype, missing the other part. > > > > Here: > > osgiliath: {64} pkg-config --libs freetype2 > > -L/usr/pkg/lib -lfreetype > > osgiliath: {65} pkg-config --libs-only-other freetype2 > > <nothing> > > > > if I compare it with nettle, which works fine: > > osgiliath: {72} pkg-config --libs nettle > > -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lnettle > > osgiliath: {73} pkg-config --libs-only-other nettle > > -Wl,-R/usr/pkg/lib > > > > we see that for freetype -Wl,-R/usr/pkg/lib is missing and this causes > > me various issues during configures and builds. > > This is the typical bug. > > You can look at the freetype2 package and the file from upstream and how > LDFLAGS get substituted in. > > Basically things are often linuxy and assume that everything goes in > /usr and there is no need to set rpath.
Specifically: - RPATH is not portable. Some OSes don't support it at all. Many distributors recommend against it and advise leaving library path configuration to the system's administrator. - Most upstreams will not accept patches to add RPATH to .pc files for the above reasons. - LDFLAGS do not affect generation of .pc files. - In pkgsrc we use PKGCONFIG_OVERRIDE to automatically insert RPATH to .pc files on supported systems. - Some complex build systems dynamically generate .pc files, so you also need to set PKGCONFIG_OVERRIDE_STAGE (it defaults to pre-configure - hey, maybe we should change it)... tl;ldr Use PKGCONFIG_OVERRIDE