Skip to content

Instantly share code, notes, and snippets.

@jl
Created February 20, 2016 05:40
Show Gist options
  • Save jl/9e5ebbc9ccf44f3c804e to your computer and use it in GitHub Desktop.
Save jl/9e5ebbc9ccf44f3c804e to your computer and use it in GitHub Desktop.
Installing pkg-config from source on OS X
@givingwu
Copy link

givingwu commented Aug 2, 2019

First, thanks for your share.

And i am confusing about the first line of the code LDFLAGS="-framework CoreFoundation -framework Carbon" ./configure --with-internal-glib,

what's that means LDFLAGS="-framework CoreFoundation -framework Carbon"?

@meschbach
Copy link

OSX & iOS uses a mechanism for managing development resources such as a libraries called Frameworks. These are generally frameworks in the Software Engineering sense however might also just be libraries. The flag informs the tool chain to build against these libraries.

See Apple's documentation about it for more details.

@Kampouse
Copy link

@scrutinizer11
Copy link

scrutinizer11 commented Jun 18, 2022

Thank you very much. To compile another binary pkg-config was a requirement although I'll never use it. You're the first one to explain how to compile the damn thing on macOS in plain human language. Additionally, the official GitLab link given on freedesktop.org to download "the source code" landed me with a package without the configure exec but with vastly inarticulate instructions.

@rangelfn
Copy link

I went to compile OS Sonoma on my Mac and got this error:

gatomic.c:392:10: error: incompatible integer to pointer conversion passing 'gssize' (aka 'long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_add ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:170:46: note: expanded from macro 'g_atomic_pointer_add'
    (gssize) __sync_fetch_and_add ((atomic), (val));                         \
                                             ^~~~~
gatomic.c:416:10: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_and ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:177:45: note: expanded from macro 'g_atomic_pointer_and'
    (gsize) __sync_fetch_and_and ((atomic), (val));                          \
                                            ^~~~~
gatomic.c:440:10: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_or ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:184:44: note: expanded from macro 'g_atomic_pointer_or'
    (gsize) __sync_fetch_and_or ((atomic), (val));                           \
                                           ^~~~~
gatomic.c:464:10: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_xor ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:191:45: note: expanded from macro 'g_atomic_pointer_xor'
    (gsize) __sync_fetch_and_xor ((atomic), (val));                          \
                                            ^~~~~
4 errors generated.
make[6]: *** [libglib_2_0_la-gatomic.lo] Error 1
make[5]: *** [all-recursive] Error 1
make[4]: *** [all] Error 2
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

@m-bob
Copy link

m-bob commented May 29, 2024

Same issue as [rangelfn]. So far, I've been unable to work around it.

@mkdeak
Copy link

mkdeak commented Jun 17, 2024

Running into the same issue as well. Sonoma 14.5 on Apple Silicon.

@mkdeak
Copy link

mkdeak commented Jun 17, 2024

@m-bob
Copy link

m-bob commented Jun 17, 2024

@mkdeak

Thanks for the info. I'm also running Sonoma 14.5 on Apple Silicon (M1 Air).

But no joy. I tried to make pkgconfig 0.28.

From what I gleaned from the link you provided, I tried:

CFLAGS="-Wno-int-conversion"
CXXFLAGS="-Wno-int-conversion"
./configure --with-internal-glib

Same errors as before when I tried to make.

Did I misinterpret the link? Should I try a newer pkgconfig?

Should I try to build glib separately and then try to build pkgconfig without using its internal glib?

Again, thanks!

@rangelfn

@mkdeak
Copy link

mkdeak commented Jun 18, 2024

@m-bob try running the three things on the same line: CFLAGS="-Wno-int-conversion" CXXFLAGS="-Wno-int-conversion" ./configure --with-internal-glib

@m-bob
Copy link

m-bob commented Jun 18, 2024 via email

@math-steam
Copy link

@mkdeak Your solution is very useful!

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