arb-project / homebrew-arb

Homebrew tap for formulae to build ARB (http://www.arb-home.de) and related software.
MIT License
11 stars 4 forks source link

Build error (MUSCLE) #4

Closed epruesse closed 4 years ago

epruesse commented 4 years ago

Installing ARB as per instructions fails on brew install arb-project/arb/arb. The error appears during compilation of MUSCLE:

[34:03.N] ------------------------------------------------ Make MUSCLE
mkdir -p obj
/Library/Developer/CommandLineTools/usr/bin/make /private/tmp/arb-20200921-75771-1s8fyf1/arbsrc_18342/bin/muscle
clang++ -c -O3 -msse2 -mfpmath=sse -D_FILE_OFFSET_BITS=64 -DNDEBUG=1 -o obj/aligngivenpath.o src/aligngivenpath.cpp
[...]
clang++ -c -O3 -msse2 -mfpmath=sse -D_FILE_OFFSET_BITS=64 -DNDEBUG=1 -o obj/tomhydro.o src/tomhydro.cpp
src/subfams.cpp:4:13: error: functions that differ only in their return type cannot be overloaded
const float INFINITY = float(1e29);
      ~~~~~ ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/math.h:68:21: note: expanded from macro 'INFINITY'
#define INFINITY    HUGE_VALF
                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/math.h:58:28: note: expanded from macro 'HUGE_VALF'
#   define    HUGE_VALF    __builtin_huge_valf()
                           ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/limits:332:90: note: previous implicit declaration is here
    _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_valf();}
                                                                                         ^
1 error generated.
make[7]: *** [obj/subfams.o] Error 1
make[7]: *** Waiting for unfinished jobs....
make[6]: *** [all] Error 2

Looks like the INFINITY definition needs an #ifdef around it, in case it is already defined by math.h.

epruesse commented 4 years ago

Technically, MUSCLE, MAFFT & Co should probably be built from their own recipes, perhaps even made optional. MUSCLE is not crucial to running ARB.

ryandesign commented 4 years ago

Sounds like a bug in arb. I've filed it here: http://bugs.arb-home.de/ticket/830

rwestram commented 4 years ago

I've patched the subfams.cpp delivered with arb. Please retry.

epruesse commented 4 years ago

Thank you @rwestram

jgerken commented 4 years ago

Hi @epruesse , sorry for joining the issue late. It seems that the problem occurs only with Catalina 10.15.7 and then not even with all setups. The builds in the GitHub VMs still work without the patch from Ralf but after having updated my macOS to Catalina, I get the same issue locally. So, I think it is caused by something both of us have installed which is not part of a default macOS installation. Do you have any idea what it could be? If I know what it causes I could adopt the formula to declare the production version of ARB incompatible with it or to use a "tap" only dependency on the thing that is replaced by it.

epruesse commented 4 years ago

The conflicting #define came out of math.h, so probably just developer tools - compiler and matching library header files. I didn't look at Ralf's patch, but I think having

#ifndef INFINITY
#define INFINITY bla
#endif

or

#undef INFINITY
#define INFINITY bla

is the way to go and easier than trying to control the header files via dependencies.

ryandesign commented 4 years ago

I presume it is the new version of clang that's in Xcode 12. I presume that there has been some change to the way that the system headers include each other such that math.h now gets included automatically whereas before it did not. There is no need to mark anything incompatible with anything. Just fix the problem, either the way the developers of arb did by renaming INFINITY to something else, or change it the way @epruesse suggested so that INFINITY is only defined if it has not already been defined, which is a strategy already used elsewhere in the arb code.

jgerken commented 4 years ago

The problem is now fixed in the production version, too. If you want to switch back to the production version run

brew unlink arb-project/arb/arb
brew install arb-project/arb/arb