Skip to content

Instantly share code, notes, and snippets.

@jl
Created February 20, 2016 05:40
Show Gist options
  • Select an option

  • Save jl/9e5ebbc9ccf44f3c804e to your computer and use it in GitHub Desktop.

Select an option

Save jl/9e5ebbc9ccf44f3c804e to your computer and use it in GitHub Desktop.
Installing pkg-config from source on OS X
@paulmromer
Copy link

If you are not familiar with Make (and I am not), it is not clear whether the advice given above about setting CFLAGS on a single line means that one should run these two different lines one after the other:

LDFLAGS="-framework CoreFoundation -framework Carbon" ./configure --with-internal-glib
CFLAGS="-Wno-int-conversion" CXXFLAGS="-Wno-int-conversion" ./configure --with-internal-glib

or run a single line like this:

LDFLAGS="-framework CoreFoundation -framework Carbon" CFLAGS="-Wno-int-conversion" CXXFLAGS="-Wno-int-conversion" ./configure --with-internal-glib

When I tried running the two lines one after another, the Makefile had a line

LDFLAGS =

which suggests that the second command overwrote the version where the LDFLAGS were set.

When I ran the single line command, the same line in Makefile was

LDFLAGS = -framework CoreFoundation -framework Carbon

All other lines were the same. So it looks like the right approach is to set LDFLAGS, CFLAGS and CXXFLAGS on a single line.

BTW, after I created the Makefile that did not set LDFLAGS, the make and sudo make install commands ran without generating errors. The version of pkg-config created this way may work for some purposes, but if you want a version that has the LDFLAGS set to -framework CoreFoundation -framework Carbon, you probably need to run a single line that sets all the flags and then run the other two commands.

@abaqueiro
Copy link

Thank you very much to everyone for the contributions, you helped me to finally get pkg-config to compile

What I learn from this is that we can't go through life blindly, we have to learn to use the tools, for me this worked to fix the errors compiling in Apple Silicon M2 (2025):

I install my self compiled stuff in /opt/pokemon

This commands make the tric:

tar xvf pkg-config-0.29.2.tar.gz
mkdir pkg-config-build
cd pkg-config-build
export CFLAGS="-Wno-int-conversion"
export CXXFLAGS="-Wno-int-conversion"
../pkg-config-0.29.2/configure --prefix=/opt/pokemon --exec-prefix=/opt/pokemon --with-internal-glib
make
make install

  • /opt/pokemon should have rwx file permissions for the user running the commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment