Parden me at first because my Emacs mu4e seems can't sent out email (It failed recently on "sendmail" on macOS system, don't know why, even I tried 3 times). So I post on Google Groups in web browser again.
Problem: meson and ninja can't find the Homebrew installed glib.h header file.
How to solve this error?
The homebrew provided "mu" formula is not updated with GitHub repo latest release. So I try to compile by myself.
Environments:
- Emacs version: GNU Emacs 28.1 (build 1, aarch64-apple-darwin21.1.0, NS appkit-2113.00 Version 12.0.1 (Build 21A559)) of 2022-05-12
- System: M1 macOS Monterey
- glib: I installed glib with Homebrew =$ brew install glib=
Compile commands:
#+begin_src shell
export CPATH=/opt/homebrew/include
export LIBRARY_PATH=/opt/homebrew/lib
./autogen.sh # && make
meson build && ninja -C build
#+end_src
Here is the output of compile commands:
#+begin_example
*** meson build setup
/opt/homebrew/bin/meson
The Meson build system
Version: 0.62.1
Source dir: /Users/stardiviner/Code/Emacs/mu
Build dir: /Users/stardiviner/Code/Emacs/mu/build
Build type: native build
Project name: mu
Project version: 1.7.23
C compiler for the host machine: cc (clang 13.1.6 "Apple clang version 13.1.6 (clang-1316.0.21.2.3)")
C linker for the host machine: cc ld64 762
C++ compiler for the host machine: c++ (clang 13.1.6 "Apple clang version 13.1.6 (clang-1316.0.21.2.3)")
C++ linker for the host machine: c++ ld64 762
Host machine cpu family: aarch64
Host machine cpu: arm64
Compiler for C supports arguments -Wno-unused-parameter: YES (cached)
Compiler for C++ supports arguments -Wno-unused-parameter: YES (cached)
Compiler for C supports arguments -Wno-cast-function-type: YES (cached)
Compiler for C++ supports arguments -Wno-cast-function-type: YES (cached)
Compiler for C supports arguments -Wformat-security: YES (cached)
Compiler for C++ supports arguments -Wformat-security: YES (cached)
Compiler for C supports arguments -Wformat=2: YES (cached)
Compiler for C++ supports arguments -Wformat=2: YES (cached)
Compiler for C supports arguments -Wstack-protector: YES (cached)
Compiler for C++ supports arguments -Wstack-protector: YES (cached)
Compiler for C supports arguments -Wno-keyword-macro: YES
Compiler for C++ supports arguments -Wno-keyword-macro: YES
Compiler for C supports arguments -Wno-switch-enum: YES (cached)
Compiler for C++ supports arguments -Wno-switch-enum: YES (cached)
Compiler for C supports arguments -Wno-#warnings: YES (cached)
Compiler for C++ supports arguments -Wno-#warnings: YES (cached)
Checking for function "setsid" : YES (cached)
Checking for function "wordexp" : YES (cached)
Dependency glib-2.0 found: YES 2.72.0 (cached)
Dependency gobject-2.0 found: YES 2.72.0 (cached)
Dependency gio-2.0 found: YES 2.72.0 (cached)
Dependency gmime-3.0 found: YES 3.2.7 (cached)
Dependency xapian-core found: YES 1.4.19 (cached)
Dependency threads found: YES unknown (cached)
Dependency guile-3.0 found: YES 3.0.8 (cached)
Program gawk found: YES (/opt/homebrew/bin/gawk)
Program emacs found: YES 29.0.50 (/opt/homebrew/bin/emacs)
Program makeinfo found: YES (/usr/local/bin/makeinfo)
Configuring version.texi using configuration
Configuring mu4e-meta.el using configuration
mu4e/meson.build:92: WARNING: Source item '/Users/stardiviner/Code/Emacs/mu/build/mu4e/mu4e-meta.el' cannot be converted to File object, because it is a generated file. This will become a hard error in the future.
Configuring compile-scm using configuration
Program guile-snarf found: YES (/opt/homebrew/bin/guile-snarf)
Configuring config.h using configuration
Build targets in project: 59
NOTICE: Future-deprecated features used:
* 0.56.0: {'dependency.get_pkgconfig_variable', 'meson.source_root'}
Found ninja-1.11.0 at /opt/homebrew/Caskroom/miniforge/base/bin/ninja
*** Now run 'ninja -C build' to build mu
*** Or check the Makefile for some useful targets
Directory already configured.
Just run your build command (e.g. ninja) and Meson will regenerate as necessary.
If ninja fails, run "ninja reconfigure" or "meson --reconfigure"
to force Meson to regenerate.
If build failures persist, run "meson setup --wipe" to rebuild from scratch
using the same options as passed when configuring the build.
To change option values, run "meson configure" instead.
ninja: Entering directory `build'
[1/127] Compiling C object lib/utils/tests/test-mu-util.p/test-mu-util.c.o
FAILED: lib/utils/tests/test-mu-util.p/test-mu-util.c.o
cc -Ilib/utils/tests/test-mu-util.p -Ilib/utils/tests -I../lib/utils/tests -I. -I.. -Ilib/utils -I../lib/utils -Ilib -I../lib -I/opt/homebrew/Cellar/glib/2.72.0/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.72.0/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre/8.45/include -fcolor-diagnostics -Wall -Winvalid-pch -Wextra -std=c11 -O2 -g -Wno-unused-parameter -Wno-cast-function-type -Wformat-security -Wformat=2 -Wstack-protector -Wno-keyword-macro -Wno-switch-enum '-Wno-#warnings' -DHAVE_CONFIG_H -MD -MQ lib/utils/tests/test-mu-util.p/test-mu-util.c.o -MF lib/utils/tests/test-mu-util.p/test-mu-util.c.o.d -o lib/utils/tests/test-mu-util.p/test-mu-util.c.o -c ../lib/utils/tests/test-mu-util.c
../lib/utils/tests/test-mu-util.c:24:10: fatal error: 'glib.h' file not found
#include <glib.h>
^~~~~~~~
1 error generated.
[2/127] Compiling C object lib/utils/libmu-utils.a.p/mu-util.c.o
FAILED: lib/utils/libmu-utils.a.p/mu-util.c.o
cc -Ilib/utils/libmu-utils.a.p -Ilib/utils -I../lib/utils -Ilib -I../lib -I. -I.. -I/opt/homebrew/Cellar/glib/2.72.0/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.72.0/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre/8.45/include -fcolor-diagnostics -Wall -Winvalid-pch -Wextra -std=c11 -O2 -g -Wno-unused-parameter -Wno-cast-function-type -Wformat-security -Wformat=2 -Wstack-protector -Wno-keyword-macro -Wno-switch-enum '-Wno-#warnings' -DHAVE_CONFIG_H -MD -MQ lib/utils/libmu-utils.a.p/mu-util.c.o -MF lib/utils/libmu-utils.a.p/mu-util.c.o.d -o lib/utils/libmu-utils.a.p/mu-util.c.o -c ../lib/utils/mu-util.c
In file included from ../lib/utils/mu-util.c:26:
../lib/utils/mu-util.h:23:10: fatal error: 'glib.h' file not found
#include <glib.h>
^~~~~~~~
1 error generated.
[3/127] Compiling C++ object lib/utils/libmu-utils.a.p/mu-option.cc.o
FAILED: lib/utils/libmu-utils.a.p/mu-option.cc.o
c++ -Ilib/utils/libmu-utils.a.p -Ilib/utils -I../lib/utils -Ilib -I../lib -I. -I.. -I/opt/homebrew/Cellar/glib/2.72.0/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.72.0/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre/8.45/include -fcolor-diagnostics -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -std=c++17 -O2 -g -Wno-unused-parameter -Wno-cast-function-type -Wformat-security -Wformat=2 -Wstack-protector -Wno-keyword-macro -Wno-switch-enum '-Wno-#warnings' -DHAVE_CONFIG_H -MD -MQ lib/utils/libmu-utils.a.p/mu-option.cc.o -MF lib/utils/libmu-utils.a.p/mu-option.cc.o.d -o lib/utils/libmu-utils.a.p/mu-option.cc.o -c ../lib/utils/mu-option.cc
../lib/utils/mu-option.cc:21:10: fatal error: 'glib.h' file not found
#include <glib.h>
^~~~~~~~
1 error generated.
[4/127] Compiling C++ object lib/utils/libmu-utils.a.p/mu-logger.cc.o
FAILED: lib/utils/libmu-utils.a.p/mu-logger.cc.o
c++ -Ilib/utils/libmu-utils.a.p -Ilib/utils -I../lib/utils -Ilib -I../lib -I. -I.. -I/opt/homebrew/Cellar/glib/2.72.0/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.72.0/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre/8.45/include -fcolor-diagnostics -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -std=c++17 -O2 -g -Wno-unused-parameter -Wno-cast-function-type -Wformat-security -Wformat=2 -Wstack-protector -Wno-keyword-macro -Wno-switch-enum '-Wno-#warnings' -DHAVE_CONFIG_H -MD -MQ lib/utils/libmu-utils.a.p/mu-logger.cc.o -MF lib/utils/libmu-utils.a.p/mu-logger.cc.o.d -o lib/utils/libmu-utils.a.p/mu-logger.cc.o -c ../lib/utils/mu-logger.cc
../lib/utils/mu-logger.cc:21:10: fatal error: 'glib.h' file not found
#include <glib.h>
^~~~~~~~
1 error generated.
[5/127] Compiling C++ object lib/utils/libmu-utils.a.p/mu-readline.cc.o
FAILED: lib/utils/libmu-utils.a.p/mu-readline.cc.o
c++ -Ilib/utils/libmu-utils.a.p -Ilib/utils -I../lib/utils -Ilib -I../lib -I. -I.. -I/opt/homebrew/Cellar/glib/2.72.0/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.72.0/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre/8.45/include -fcolor-diagnostics -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -std=c++17 -O2 -g -Wno-unused-parameter -Wno-cast-function-type -Wformat-security -Wformat=2 -Wstack-protector -Wno-keyword-macro -Wno-switch-enum '-Wno-#warnings' -DHAVE_CONFIG_H -MD -MQ lib/utils/libmu-utils.a.p/mu-readline.cc.o -MF lib/utils/libmu-utils.a.p/mu-readline.cc.o.d -o lib/utils/libmu-utils.a.p/mu-readline.cc.o -c ../lib/utils/mu-readline.cc
../lib/utils/mu-readline.cc:26:10: fatal error: 'glib.h' file not found
#include <glib.h>
^~~~~~~~
1 error generated.
[6/127] Compiling C++ object lib/utils/tests/test-command-parser.p/test-command-parser.cc.o
FAILED: lib/utils/tests/test-command-parser.p/test-command-parser.cc.o
c++ -Ilib/utils/tests/test-command-parser.p -Ilib/utils/tests -I../lib/utils/tests -Ilib/utils -I../lib/utils -Ilib -I../lib -I/opt/homebrew/Cellar/glib/2.72.0/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.72.0/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre/8.45/include -fcolor-diagnostics -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -std=c++17 -O2 -g -Wno-unused-parameter -Wno-cast-function-type -Wformat-security -Wformat=2 -Wstack-protector -Wno-keyword-macro -Wno-switch-enum '-Wno-#warnings' -DHAVE_CONFIG_H -MD -MQ lib/utils/tests/test-command-parser.p/test-command-parser.cc.o -MF lib/utils/tests/test-command-parser.p/test-command-parser.cc.o.d -o lib/utils/tests/test-command-parser.p/test-command-parser.cc.o -c ../lib/utils/tests/test-command-parser.cc
../lib/utils/tests/test-command-parser.cc:21:10: fatal error: 'glib.h' file not found
#include <glib.h>
^~~~~~~~
1 error generated.
[7/127] Compiling C++ object lib/utils/libmu-utils.a.p/mu-command-parser.cc.o
FAILED: lib/utils/libmu-utils.a.p/mu-command-parser.cc.o
c++ -Ilib/utils/libmu-utils.a.p -Ilib/utils -I../lib/utils -Ilib -I../lib -I. -I.. -I/opt/homebrew/Cellar/glib/2.72.0/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.72.0/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre/8.45/include -fcolor-diagnostics -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -std=c++17 -O2 -g -Wno-unused-parameter -Wno-cast-function-type -Wformat-security -Wformat=2 -Wstack-protector -Wno-keyword-macro -Wno-switch-enum '-Wno-#warnings' -DHAVE_CONFIG_H -MD -MQ lib/utils/libmu-utils.a.p/mu-command-parser.cc.o -MF lib/utils/libmu-utils.a.p/mu-command-parser.cc.o.d -o lib/utils/libmu-utils.a.p/mu-command-parser.cc.o -c ../lib/utils/mu-command-parser.cc
In file included from ../lib/utils/mu-command-parser.cc:20:
In file included from ../lib/utils/mu-command-parser.hh:30:
In file included from ../lib/utils/mu-error.hh:25:
../lib/utils/mu-util.h:23:10: fatal error: 'glib.h' file not found
#include <glib.h>
^~~~~~~~
1 error generated.
[8/127] Compiling C++ object lib/utils/libmu-utils.a.p/mu-sexp.cc.o
FAILED: lib/utils/libmu-utils.a.p/mu-sexp.cc.o
c++ -Ilib/utils/libmu-utils.a.p -Ilib/utils -I../lib/utils -Ilib -I../lib -I. -I.. -I/opt/homebrew/Cellar/glib/2.72.0/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.72.0/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre/8.45/include -fcolor-diagnostics -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -std=c++17 -O2 -g -Wno-unused-parameter -Wno-cast-function-type -Wformat-security -Wformat=2 -Wstack-protector -Wno-keyword-macro -Wno-switch-enum '-Wno-#warnings' -DHAVE_CONFIG_H -MD -MQ lib/utils/libmu-utils.a.p/mu-sexp.cc.o -MF lib/utils/libmu-utils.a.p/mu-sexp.cc.o.d -o lib/utils/libmu-utils.a.p/mu-sexp.cc.o -c ../lib/utils/mu-sexp.cc
In file included from ../lib/utils/mu-sexp.cc:21:
In file included from ../lib/utils/mu-sexp.hh:27:
../lib/utils/mu-utils.hh:30:10: fatal error: 'glib.h' file not found
#include <glib.h>
^~~~~~~~
1 error generated.
[9/127] Compiling C++ object lib/utils/libmu-utils.a.p/mu-utils.cc.o
FAILED: lib/utils/libmu-utils.a.p/mu-utils.cc.o
c++ -Ilib/utils/libmu-utils.a.p -Ilib/utils -I../lib/utils -Ilib -I../lib -I. -I.. -I/opt/homebrew/Cellar/glib/2.72.0/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.72.0/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre/8.45/include -fcolor-diagnostics -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -std=c++17 -O2 -g -Wno-unused-parameter -Wno-cast-function-type -Wformat-security -Wformat=2 -Wstack-protector -Wno-keyword-macro -Wno-switch-enum '-Wno-#warnings' -DHAVE_CONFIG_H -MD -MQ lib/utils/libmu-utils.a.p/mu-utils.cc.o -MF lib/utils/libmu-utils.a.p/mu-utils.cc.o.d -o lib/utils/libmu-utils.a.p/mu-utils.cc.o -c ../lib/utils/mu-utils.cc
../lib/utils/mu-utils.cc:43:10: fatal error: 'glib.h' file not found
#include <glib.h>
^~~~~~~~
1 error generated.
[10/127] Compiling C++ object lib/utils/tests/test-option.p/test-option.cc.o
FAILED: lib/utils/tests/test-option.p/test-option.cc.o
c++ -Ilib/utils/tests/test-option.p -Ilib/utils/tests -I../lib/utils/tests -Ilib/utils -I../lib/utils -Ilib -I../lib -I/opt/homebrew/Cellar/glib/2.72.0/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.72.0/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre/8.45/include -fcolor-diagnostics -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -std=c++17 -O2 -g -Wno-unused-parameter -Wno-cast-function-type -Wformat-security -Wformat=2 -Wstack-protector -Wno-keyword-macro -Wno-switch-enum '-Wno-#warnings' -DHAVE_CONFIG_H -MD -MQ lib/utils/tests/test-option.p/test-option.cc.o -MF lib/utils/tests/test-option.p/test-option.cc.o.d -o lib/utils/tests/test-option.p/test-option.cc.o -c ../lib/utils/tests/test-option.cc
In file included from ../lib/utils/tests/test-option.cc:20:
../lib/utils/mu-utils.hh:30:10: fatal error: 'glib.h' file not found
#include <glib.h>
^~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.
#+end_example