mu + mu4e compile fail on MacOS 10.12.2

239 views
Skip to first unread message

Patrick Ball

unread,
Dec 20, 2016, 12:19:46 PM12/20/16
to mu-discuss
hi mu list,

Compiling on MacOS 10.12.2 is a bit challenging. Following many suggestions, I disabled System Integrity Protection in order to replace Apple's ancient /usr/bin/emacs with a script that points at the binary to which I want to link mu4e (/usr/local/Cellar/emacs-plus/25.1/Emacs.app/Contents/MacOS/Emacs); /usr/local/bin/emacs is the same script. But then brew errors out with this:

pball@petunia:~
$ EMACS=$(which emacs) brew install mu --with-emacs --HEAD
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core, homebrew/versions).
==> Updated Formulae
dnscrypt-proxy format-udf jmxtrans libsass sassc


==> Using the sandbox
==> Cloning https://github.com/djcb/mu.git
Updating /Users/pball/Library/Caches/Homebrew/mu--git
==> Checking out branch master
==> autoreconf -ivf
Last 15 lines from /Users/pball/Library/Logs/Homebrew/mu/01.autoreconf:
autoreconf: running: glibtoolize --copy --force
glibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'xua'.
glibtoolize: copying file 'xua/ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
glibtoolize: copying file 'm4/libtool.m4'
glibtoolize: copying file 'm4/ltoptions.m4'
glibtoolize: copying file 'm4/ltsugar.m4'
glibtoolize: copying file 'm4/ltversion.m4'
glibtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf: running: /usr/local/Cellar/autoconf/2.69/bin/autoconf --force
configure:5822: error: possibly undefined macro: dnl
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure:5897: error: possibly undefined macro: AS_ECHO
autoreconf: /usr/local/Cellar/autoconf/2.69/bin/autoconf failed with exit status: 1


Sometimes brew gets a bit farther and complains about errors in ld. 

Also, I *can* brew install mu (0.9.8) without mu4e, and it seems to run fine: it indexes my ~/Maildir, I can mu find <predicate> from bash, the results look right. I think that brew's install of mu uses a prebuilt binary, but --with-emacs requires recompiling. Of course I want the emacs bits too, but this is an interesting start.

I also tried to compile directly from git, and got a different error: autoconf completes, but configure does not:

pball@petunia:~/src/mu
$ autoreconf -i


pball@petunia:~/src/mu
$ ./configure
<snip>
checking for /usr/local/bin/gcc option to accept ISO C99... none needed
checking for /usr/local/bin/gcc option to accept ISO Standard C... (cached) none needed
checking for /usr/local/bin/gcc option to accept ISO C99... (cached) none needed
checking how to run the C preprocessor... /usr/local/bin/cpp
checking for grep that handles long lines and -e... /Users/pball/bin/grep
checking for egrep... /Users/pball/bin/grep -E
checking for ANSI C header files... yes
checking for a sed that does not truncate output... /usr/local/bin/gsed
./configure: line 5754: syntax error near unexpected token `AX_COMPILER_FLAGS_CFLAGS'
./configure: line 5754: ` AX_REQUIRE_DEFINED(AX_COMPILER_FLAGS_CFLAGS)'


(NB that the $HOME/bin/grep and gsed just symlink to the gnu versions in /usr/local/bin/)

Using the trick to replace /usr/bin/emacs I managed to get brew to compile on a different machine running MacOS 10.12.1 just a few weeks ago, but I can't make it work now.

Am I missing something obvious? I suspect that something in the toolchain is different (and wrong), but I'm not sure what. Thanks in advance -- PB.


full brew log:


pball@petunia:~/src/mu
$ cat /Users/pball/Library/Logs/Homebrew/mu/01.autoreconf
2016-12-19 23:52:05 -0800


autoreconf
-ivf


autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: configure.ac: creating directory xua
autoreconf: running: glibtoolize --copy --force
glibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'xua'.
glibtoolize: copying file 'xua/ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
glibtoolize: copying file 'm4/libtool.m4'
glibtoolize: copying file 'm4/ltoptions.m4'
glibtoolize: copying file 'm4/ltsugar.m4'
glibtoolize: copying file 'm4/ltversion.m4'
glibtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf: running: /usr/local/Cellar/autoconf/2.69/bin/autoconf --force
configure:5822: error: possibly undefined macro: dnl
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure:5897: error: possibly undefined macro: AS_ECHO
autoreconf: /usr/local/Cellar/autoconf/2.69/bin/autoconf failed with exit status: 1


HOMEBREW_VERSION: 1.1.5
ORIGIN: https://github.com/Homebrew/brew
HEAD: 9cd5a21b473f0271b162bbe7f77f7d1468c0cfa1
Last commit: 6 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 3977167695b3cc0e917370191c44a42046e61a40
Core tap last commit: 14 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit skylake
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.11.0 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: N/A
macOS: 10.12.2-x86_64
Xcode: N/A
CLT: 8.2.0.0.1.1480973914
X11: N/A


HOMEBREW_CC: gcc-5
HOMEBREW_CXX: g++-5
MAKEFLAGS: -j8
CMAKE_PREFIX_PATH: /usr/local/opt/gettext:/usr/local/opt/libffi:/usr/local
CMAKE_INCLUDE_PATH: /usr/include/libxml2:/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: /System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
PKG_CONFIG_PATH: /usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/pcre/lib/pkgconfig:/usr/local/opt/glib/lib/pkgconfig:/usr/local/opt/libpng/lib/pkgconfig:/usr/local/opt/freetype/lib/pkgconfig:/usr/local/opt/fontconfig/lib/pkgconfig:/usr/local/opt/pixman/lib/pkgconfig:/usr/local/opt/cairo/lib/pkgconfig:/usr/local/opt/gobject-introspection/lib/pkgconfig:/usr/local/opt/gmime/lib/pkgconfig:/usr/local/opt/xapian/lib/pkgconfig
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.12
ACLOCAL_PATH: /usr/local/opt/gettext/share/aclocal:/usr/local/share/aclocal
PATH: /usr/local/bin:/usr/local/Homebrew/Library/Homebrew/shims/super:/usr/local/opt/autoconf/bin:/usr/local/opt/automake/bin:/usr/local/opt/libtool/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/gettext/bin:/usr/local/opt/pcre/bin:/usr/local/opt/glib/bin:/usr/local/opt/libpng/bin:/usr/local/opt/freetype/bin:/usr/local/opt/fontconfig/bin:/usr/local/opt/cairo/bin:/usr/local/opt/gobject-introspection/bin:/usr/local/opt/xapian/bin:/usr/local/opt/git/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/gcc5/bin

Patrick Ball

unread,
Dec 20, 2016, 12:28:35 PM12/20/16
to mu-discuss
Additional info: following the instructions in this thread: https://groups.google.com/forum/#!topic/mu-discuss/x1CyEGKcZKY using autogen.sh instead of autoconf, the build gets a little farther to the ld error I mentioned before:

<snip> 
  "Xapian::Document::add_value(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      add_terms_values_date(Xapian::Document&, _MuMsg*, unsigned char) in libtestmucommon.a(mu-store-write.o)
      add_terms_values_number(Xapian::Document&, _MuMsg*, unsigned char) in libtestmucommon.a(mu-store-write.o)
      add_terms_values_msgid(Xapian::Document&, _MuMsg*)      in libtestmucommon.a(mu-store-write.o)
      add_terms_values_string(Xapian::Document&, _MuMsg*, unsigned char) in libtestmucommon.a(mu-store-write.o)
      add_terms_values_string_list(Xapian::Document&, _MuMsg*, unsigned char) in libtestmucommon.a(mu-store-write.o)
      update_threading_info(Xapian::WritableDatabase*, _MuMsg*, Xapian::Document&)  in libtestmucommon.a(mu-store-write.o)
  "Xapian::WritableDatabase::add_synonym(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const", referenced from:
      add_synonym_for_flag(_MuFlags, Xapian::WritableDatabase*)       in libtestmucommon.a(mu-store-write.o)
      add_synonym_for_prio(_MuMsgPrio, Xapian::WritableDatabase*)        in libtestmucommon.a(mu-store-write.o)
  "Xapian::WritableDatabase::clear_synonyms(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const", referenced from:
      add_synonym_for_flag(_MuFlags, Xapian::WritableDatabase*)       in libtestmucommon.a(mu-store-write.o)
      add_synonym_for_prio(_MuMsgPrio, Xapian::WritableDatabase*)        in libtestmucommon.a(mu-store-write.o)
  "Xapian::Database::term_exists(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const", referenced from:
      _mu_store_contains_message in libtestmucommon.a(mu-store-read.o)
  "Xapian::Database::get_metadata(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const", referenced from:
      _mu_store_get_metadata in libtestmucommon.a(mu-store-read.o)
      xapian_get_metadata(char const*, char const*) in libtestmucommon.a(mu-store.o)
  "Xapian::Document::get_value[abi:cxx11](unsigned int) const", referenced from:
      _mu_store_foreach in libtestmucommon.a(mu-store-read.o)
      _mu_msg_doc_get_str_field in libtestmucommon.a(mu-msg-doc.o)
      _mu_msg_doc_get_str_list_field in libtestmucommon.a(mu-msg-doc.o)
      _mu_msg_doc_get_num_field in libtestmucommon.a(mu-msg-doc.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[4]: *** [test-mu-store] Error 1
make[3]: *** [all] Error 2
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

James Felix Black

unread,
Dec 20, 2016, 12:30:40 PM12/20/16
to mu-di...@googlegroups.com
Try:

brew install autoconf-archive 

Also, I would be very leery of disabling SIP to modify the /usr/bin/emacs binary; having /usr/local/bin (or whatever) earlier in your path than /usr/bin should be sufficient, no?
--
You received this message because you are subscribed to the Google Groups "mu-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mu-discuss+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Josiah Schwab

unread,
Dec 20, 2016, 12:31:32 PM12/20/16
to mu-di...@googlegroups.com
Hi Patrick,

> Compiling on MacOS 10.12.2 is a bit challenging. ...

> But then brew errors out with this:
>
> pball@petunia:~
> $ EMACS=$(which emacs) brew install mu --with-emacs --HEAD
> Updating Homebrew...
> ==> Auto-updated Homebrew!
> Updated 2 taps (homebrew/core, homebrew/versions).

The dependencies and instructions to build mu from git changed in the
last week-ish and it doesn't look like anyone has updated the homebrew
formula.

Compare

https://github.com/Homebrew/homebrew-core/blob/53532b0188a671030413018a246a6b205fa8543e/Formula/mu.rb

and the instructions in HACKING

https://github.com/djcb/mu/blob/master/HACKING

Josiah

Patrick Ball

unread,
Dec 20, 2016, 12:49:08 PM12/20/16
to mu-discuss
Thanks much to Josiah and James! 

On autoconf-archive: yep, installed. no change.

On whether it's necessary to break /usr/bin/emacs: I think it is in order to make sure the build finds the right one. I remember a thread (lost now) saying that /usr/bin/emacs is hardcoded into some of the build. I can't find that now, and I'll certainly return /usr/bin/emacs to the original when this is done. 

On mu build changes: I'll review the HACKING note again. Are you pointing to the dependencies? 

The errors are different between the brew problem and when I try to compile directly, but there are errors both ways. For example, when I git clone directly, then ./autogen.sh, then rerun configure: 

    EMACS=$(which emacs) ./configure

ends with what I want (see below) but then make fails: 

    EMACS=$(which emacs) make

<snip a zillion warnings>
  CC       test-mu-msg.o
  CXXLD    test-mu-msg
Undefined symbols for architecture x86_64:
  "Xapian::sortable_unserialise(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      _mu_msg_doc_get_num_field in libtestmucommon.a(mu-msg-doc.o)
  "Xapian::Document::get_value[abi:cxx11](unsigned int) const", referenced from:
      _mu_msg_doc_get_str_field in libtestmucommon.a(mu-msg-doc.o)
      _mu_msg_doc_get_str_list_field in libtestmucommon.a(mu-msg-doc.o)
      _mu_msg_doc_get_num_field in libtestmucommon.a(mu-msg-doc.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[4]: *** [test-mu-msg] Error 1
make[3]: *** [all] Error 2
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2


the configure summary: 

mu configuration is complete.
------------------------------------------------
mu version                           : 0.9.19

Xapian version                       : 1.4.1
GLib version                         : 2.50.2
GMime version                        : 2.6.22
Emacs version                        : GNU Emacs 25.1.1

Have wordexp                         : yes
Build mu4e emacs frontend            : yes
Build 'mug' toy-ui (gtk+/webkit)     : no
McCabe's Cyclomatic Complexity tool  : no

Have direntry->d_ino                 : yes
Have direntry->d_type                : yes
------------------------------------------------


Now, type 'gmake' to build mu (or 'gmake check' to run the unit tests, too)

Patrick Ball

unread,
Dec 20, 2016, 2:22:49 PM12/20/16
to mu-discuss
Ok, I think I've solved it. I did several pieces, and I'm not entirely sure which one was the key. 

I followed the issue with some of the undefined macros, and came across this suggestion to make sure that we're using gnu's libtool rather than Apple's somewhat older one; added to mu's autogen.sh.  

case `uname` in Darwin*) glibtoolize --copy ;;
                      *) libtoolize --copy ;; esac

This probably didn't fix anything, but I don't think it could hurt. 

Next, following the "symbol(s) not found" error from ld, I note the the problem came when linking agains xapian. reinstall from source:

    brew remove xapian ; brew reinstall --build-from-source xapian --with-gcc

now recompiling from git: 

    EMACS=$(which emacs) ./configure && make && make install 

and mu + mu4e configures, compiles, and works, with elisp in /usr/local/share/emacs/site-lisp/mu4e/  yay! 

to whom should I report this? to brew, I imagine, but anyone else? thx much -- PB. 

Stig Brautaset

unread,
Dec 20, 2016, 4:53:06 PM12/20/16
to mu-di...@googlegroups.com

James Felix Black writes:
>
> % brew install autoconf-archive
>
> Also, I would be very leery of disabling SIP to modify the
> /usr/bin/emacs binary; having /usr/local/bin (or whatever)
> earlier in your path than /usr/bin should be sufficient, no?


I install emacs with brew, and that is sufficient when
/usr/local/bin is prior to /usr/bin in my path.

Stig
Reply all
Reply to author
Forward
0 new messages