我在GTK中有工作程序它在Linux和Mac OS X上编译好(brew)

如何使用静态选项在mac中编译它?

在mac上:

$ pkg-config --libs --cflags gtk -2.0

-D_REENTRANT -I / usr / local / Cellar / gtk /2.24.30/include/gtk-2.0 -I / usr / local / Cellar / gtk /2.24.30/lib/gtk-2.0/include -I / usr / local /Cellar/pango/1.38.1/include/pango-1.0 -I / usr / local / Cellar / harfbuzz / 1.2.1 / include / harfbuzz -I / usr / local / Cellar / pango / 1.38.1 / include / pango -1.0 -I / usr / local / Cellar / atk / 2.18.0_1 / include / atk-1.0 -I / usr / local / Cellar / cairo / 1.14.6_1 / include / cairo -I / usr / local / Cellar / pixman /0.34.0/include/pixman-1 -I / usr / local / Cellar / fontconfig / 2.11.1_2 / include -I / usr / local / Cellar / freetype / 2.6.3 / include / freetype2 -I / usr / local /Cellar/libpng/1.6.21/include/libpng16 -I / usr / local / Cellar / gdk-pixbuf / 2.32.3 / include / gdk-pixbuf-2.0 -I / usr / local / Cellar / libpng / 1.6.21 / include / libpng16 -I / usr / local / Cellar / glib / 2.46.2 / include / glib-2.0 -I / usr / local / Cellar / glib / 2.46.2 / lib / glib-2.0 / include -I / usr / local / opt / gettext / include -L / usr / local / Cellar / gtk /2.24.30/lib -L / usr / local / Cellar / pango / 1.38.1 / lib -L / usr / local / Cellar / atk /2.18.0_1/lib -L / usr / local / Cellar / cairo / 1.14.6_1 / lib -L / usr / local / Cellar / gdk-pixbuf / 2 . 32.3 / lib -L / usr / local / Cellar / glib / 2.46.2 / lib -L / usr / local / opt / gettext / lib -lgtk-quartz-2.0 -lgdk-quartz-2.0 -lpangocairo-1.0 -lpango- 1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl

在mac上是clang llvm而不是gcc

当我使用-static选项时,我得到:

$ gcc -Wall -static -o prog prog.c pkg-config --libs --cflags gtk+-2.0

ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)