Build on Apple Silicon fails due to missing linker options
Building on new Macs fails with:
make[2]: Entering directory '/Users/ilg/Work/xbb-bootstrap-3.4-macos-11.6.1-arm64/build/flex-2.6.4/src'
/bin/bash ../libtool --tag=CC --mode=link clang -pipe -O2 -ffunction-sections -fdata-sections -w -version-info 2:0:0 -L/Users/ilg/.local/xbb-bootstrap/lib -Wl,-dead_strip -o libfl.la -rpath /Users/ilg/.local/xbb-bootstrap/lib libmain.lo libyywrap.lo -lm
Undefined symbols for architecture arm64:
"_yylex", referenced from:
_main in libmain.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Makefile:736: libfl.la] Error 1
make[2]: Leaving directory '/Users/ilg/Work/xbb-bootstrap-3.4-macos-11.6.1-arm64/build/flex-2.6.4/src'
make[1]: *** [Makefile:577: all] Error 2
One of the reasons is the missing linker -Wl,-undefined -Wl,dynamic_lookup, skipped due to a problem in configure.
HomeBrew applies a patch to avoid this:
The patch that the linked file points to is against configure itself. Can you point me to a patch that provides the fix in configure.ac (or some other input to configure)? Alternatively, if this is addressed in a more recent version of autoconf, then can you suggest how recent that would need to be?
Another thing worth checking is if this problem occurs on the tip of master.
Thanks!
a patch that provides the fix in configure.ac
I tried to figure out what is wrong in configure.ac, but failed. :-(
a more recent version of autoconf
Ah, right, I'm using the very latest autoconf/automake. This creates another set of problems, since the current configure refers to aclocal-1.15, and the new versions provide aclocal-1.16.
if this problem occurs on the tip of master
Yeah, this is a bit more complicated, but I'll try to find a way to do it. Releases would make things easier.
Can you document which versions of:
- autoconf
- automake
- libtool you're seeing this error with?
- autoconf 2.71
- automake 1.16.5
- libtool 2.4.6
I cloned the master branch, ran autogen.sh and observed the same behaviour.
In case it helps, attached are the generated files.
The problem seems to be in configure, around lines 7970, where it probably fails to identify the kernel version, which is now 20.x, and silently leaves _lt_dar_allow_undefined uninitialised.
The root cause is in the venerable libtool, which handles the *_allow_undefined variables.
HomeBrew patches it to fix the linker options:
I patched configure as in HomeBrew and the build passed, but later the checks failed, with an internal error caused by gm4; without providing more details in the logs, further diagnosing is difficult.
Can you point me to a patch that provides the fix in configure.ac (or some other input to configure)? Alternatively, if this is addressed in a more recent version of autoconf, then can you suggest how recent that would need to be?
It is libtool bug 44605. A fixed version of libtool has not yet been released. When it is, regenerate the configure script with that version.
Does libtool 2.47 fix this?
I certainly expect 2.4.7 to fix it. I haven't updated yet but they did commit the fix months before releasing 2.4.7.