【发布时间】:2014-06-12 21:38:45
【问题描述】:
我正在尝试编译 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
我怎样才能成功编译文件?有没有我可以在调用时使用的命令行“hack” 制作?
编辑 这是目录中的文件 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
【问题讨论】:
-
您没有向 C 编译器显示命令的外观(尝试使用
make V=1而不仅仅是make)。也许 GLIB_CFLAGS 实际上并没有被传递给 CC...? -
对不起,我是编译领域的初学者。我得到与
make V=1相同的错误。我用目录中文件的链接编辑了帖子。