我正在尝试编译msg2pdf这是一个将 mu4e(Emacs 中的 mu)中的消息转换为 pdf 的工具。 我收到以下错误:
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in .
CC msg2pdf.o
In file included from msg2pdf.c:20:
In file included from ../../lib/mu-msg.h:24:
../../lib/mu-flags.h:24:10: fatal error: 'glib.h' file not found
#include <glib.h>
^
1 error generated.
make[2]: *** [msg2pdf.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
奇怪的是,我检查了 Makefile,GLIB_CFLAGS 似乎指向正确的文件夹(brew 安装它的位置)。
事实上,glib.h
位于/usr/local/Cellar/glib/2.40.0_1/include/glib-2.0
。
GLIB_CFLAGS = -D_REENTRANT -I/usr/local/Cellar/glib/2.40.0_1/include/glib-2.0 -I/usr/local/Cellar/glib/2.40.0_1/lib/glib-2.0/include -I/usr/local/opt/gettext/include
GLIB_LIBS = -L/usr/local/Cellar/glib/2.40.0_1/lib -L/usr/local/opt/gettext/lib -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl
如何才能成功编译文件?是否有任何命令行“黑客”我可以在调用时使用 制作?
编辑 这是目录中的文件 https://github.com/flexdec/temp
编辑2 这是使用 make V=1 时的输出
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in .
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../lib -DICONDIR='""' -Wall -Wextra -Wno-unused-parameter -Wdeclaration-after-statement -g -O2 -MT msg2pdf.o -MD -MP -MF .deps/msg2pdf.Tpo -c -o msg2pdf.o msg2pdf.c
In file included from msg2pdf.c:20:
In file included from ../../lib/mu-msg.h:24:
../../lib/mu-flags.h:24:10: fatal error: 'glib.h' file not found
#include <glib.h>
^
1 error generated.
make[2]: *** [msg2pdf.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
编辑3
现在 GLIB_CFLAGS 问题已修复,我使用 make V=1
遇到的新错误
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in .
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../lib -D_REENTRANT -I/usr/local/Cellar/glib/2.40.0_1/include/glib-2.0 -I/usr/local/Cellar/glib/2.40.0_1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -DICONDIR='""' -Wall -Wextra -Wno-unused-parameter -Wdeclaration-after-statement -g -O2 -MT msg2pdf.o -MD -MP -MF .deps/msg2pdf.Tpo -c -o msg2pdf.o msg2pdf.c
msg2pdf.c:24:10: fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
^
1 error generated.
make[2]: *** [msg2pdf.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
最佳答案
make V=1
而不是 make
会告诉您 C 编译器命令是什么样的(而不仅仅是“CC msg2pdf.o”) - 检查并 make确保它包含您需要的标志。
根据对 Makefile.am 的快速查看,您在 AM_CPPFLAGS 中包含了 $(GTK_CFLAGS) 和 $(WEBKIT_CFLAGS),但不包含 $(GLIB_CFLAGS)。
关于macos - 在 Max OSX 10.9 上找不到“glib.h”文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24194357/