#66715 closed defect (worksforme)

pkgconfig @0.29.2 (devel) Should pkgconfig not look in /opt/local/lib/pkgconfig by default?

Reported by: MarcKaufmann (Marc Kaufmann) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: pkgconfig

Description

I had a problem installing some package for R from source, since pkg-config did not find an installed library (harfbuzz), with the harfbuzz.pc file being in /opt/local/lib/pkgconfig. I have now set the PKG_CONFIG_PATH environment variable in my .zprofile:

export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:$PKG_CONFIG_PATH"

While this works (harfbuzz.pc is now found), I am surprised that pkg-config does not look in this folder by default. If this is not the case, shouldn't there be some instructions to set the environment variable as above -- or is that not the right way to do it either? Since it is the first time that I found out about the existence of pkg-config, it is possible that I misunderstand its use, or an error may have occurred somewhere else that caused this.

I am on an M1, Ventura 13.0.1.

Change History (3)

comment:1 Changed 22 months ago by jmroot (Joshua Root)

Cc: ryandesign removed
Owner: set to ryandesign
Status: newassigned

The pkgconfig Portfile configures the default search path thus:

--with-pc-path=${prefix}/lib/pkgconfig:${prefix}/share/pkgconfig

and it seems to work:

% pkg-config --debug --exists zlib
Error printing disabled by default due to use of output options --exists, --atleast/exact/max-version, --list-all or no output option at all. Value of --print-errors: 0
Error printing disabled
Adding virtual 'pkg-config' package to list of known packages
Looking for package 'zlib'
Looking for package 'zlib-uninstalled'
Reading 'zlib' from file '/opt/local/lib/pkgconfig/zlib.pc'
Parsing package file '/opt/local/lib/pkgconfig/zlib.pc'
  line>prefix=/opt/local
 Variable declaration, 'prefix' has value '/opt/local'
  line>exec_prefix=${prefix}
 Variable declaration, 'exec_prefix' has value '/opt/local'
  line>libdir=${exec_prefix}/lib
 Variable declaration, 'libdir' has value '/opt/local/lib'
  line>sharedlibdir=${libdir}
 Variable declaration, 'sharedlibdir' has value '/opt/local/lib'
  line>includedir=${prefix}/include
 Variable declaration, 'includedir' has value '/opt/local/include'
  line>
  line>Name: zlib
  line>Description: zlib compression library
  line>Version: 1.2.13
  line>
  line>Requires:
  line>Libs: -L${libdir} -L${sharedlibdir} -lz
  line>Cflags: -I${includedir}
Path position of 'zlib' is 1
Adding 'zlib' to list of known packages

You could try running something like the above command without PKG_CONFIG_PATH set to see what's going on?

comment:2 Changed 22 months ago by MarcKaufmann (Marc Kaufmann)

Sorry for the late reply, I missed yours. I have now commented out the setting of PKG_CONFIG_PATH in my .zprofile, logged out and back in, and it seems unset. And now it seems to work:

% echo $PKG_CONFIG_PATH
% pkg-config --debug --exists zlib
Error printing disabled by default due to use of output options --exists, --atleast/exact/max-version, --list-all or no output option at all. Value of --print-errors: 0
Error printing disabled
Adding virtual 'pkg-config' package to list of known packages
Looking for package 'zlib'
Looking for package 'zlib-uninstalled'
Reading 'zlib' from file '/opt/local/lib/pkgconfig/zlib.pc'
Parsing package file '/opt/local/lib/pkgconfig/zlib.pc'
  line>prefix=/opt/local
 Variable declaration, 'prefix' has value '/opt/local'
  line>exec_prefix=${prefix}
 Variable declaration, 'exec_prefix' has value '/opt/local'
  line>libdir=${exec_prefix}/lib
 Variable declaration, 'libdir' has value '/opt/local/lib'
  line>sharedlibdir=${libdir}
 Variable declaration, 'sharedlibdir' has value '/opt/local/lib'
  line>includedir=${prefix}/include
 Variable declaration, 'includedir' has value '/opt/local/include'
  line>
  line>Name: zlib
  line>Description: zlib compression library
  line>Version: 1.2.13
  line>
  line>Requires:
  line>Libs: -L${libdir} -L${sharedlibdir} -lz
  line>Cflags: -I${includedir}
Path position of 'zlib' is 1
Adding 'zlib' to list of known packages

The other command also seems to work (I should have included it in my message above, but I think the following did not work):

% pkg-config harfbuzz --cflags
-I/opt/local/include/harfbuzz -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/include

Not sure what happened or if the first time it found it it (re)set something that got it into a working order? Thanks for the reply, if there is something else I can do to investigate, let me know.

comment:3 Changed 22 months ago by kencu (Ken)

Resolution: worksforme
Status: assignedclosed

thanks for checking

Note: See TracTickets for help on using tickets.