indigo-astronomy / indigo

INDIGO is a system of standards and frameworks for multiplatform and distributed astronomy software development designed to scale with your needs.
http://www.indigo-astronomy.org
Other
142 stars 63 forks source link

[OSX] Compilation error of HIDAPI with autoconf 2.71 #431

Open pebdev opened 2 years ago

pebdev commented 2 years ago

Hi!

I had an issue when I tried to build INDIGO on my Mac (MacBook Air M1 2020, OSX 12.0.1, Xcode 13.2.1)

Error

autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
configure.ac:23: error: AC_CONFIG_MACRO_DIR can only be used once
./lib/autoconf/general.m4:1970: AC_CONFIG_MACRO_DIR is expanded from...
configure.ac:23: the top level
autom4te: error: /opt/homebrew/opt/m4/bin/m4 failed with exit status: 1
aclocal: error: /opt/homebrew/Cellar/autoconf/2.71/bin/autom4te failed with exit status: 1
autoreconf: error: aclocal failed with exit status: 1
/bin/sh: ./configure: No such file or directory
make[2]: *** No targets specified and no makefile found.  Stop.
make[2]: *** No rule to make target `install'.  Stop.
make[1]: *** [/Users/peb/Documents/astronomy/indigo/build/lib/libhidapi.a] Error 2
make: *** [all] Error 2

Root cause

In fact I have autoconf 2.71 installed (through Homebrew), not the version 2.69 used by your script tools/cltools.sh and the version 2.71 is more restrictive. Just for information, I have automake 1.16.5 and libtool 2.4.6_4.

Workaround

I solved it by removing the second AC_CONFIG_MACRO_DIR usage in the indigo_libs/externals/hidapi/configure.ac file (line 23):

AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
#AC_CONFIG_MACRO_DIR([m4])

I didn't perform more test to check scope of this change.

polakovic commented 2 years ago

I expect nothing will really work with homebrew installed. It is not just a security hole, it also introduces dependency and version hell to otherwise safe and stable macOS :)

pebdev commented 2 years ago

Yes, Homebrew is clearly not the most safe and clean package manager, but this error is not his fault this time :p

Change in autoconf 2.70 (changelog)

polakovic commented 2 years ago

Yes, good to know. But remember you can run into hidden issues later with older or newer libusb, libjpeg etc. All these libraries are built from source for INDIGO on macOS, some of they may be hacked somehow and may interfere with something installed by homebrew, so be careful.