dealii / candi

candi - (Compile & Install) - Downloads, configures, builds and installs deal.II
GNU Lesser General Public License v3.0
62 stars 61 forks source link

dealii build fails on Mac arm due to use of "unary_function" #388

Open naliboff opened 4 months ago

naliboff commented 4 months ago

While building deal.II via candi on recent arm-based mac (Sonoma 14.5), I ran into the following error while compiling deal.II 9.5.2 (i.e., it made it through installation of the other packages).

In file included from /Users/naliboff/software/dealii/v9.5.2/install/tmp/unpack/deal.II-v9.5.2/bundled/boost-1.70.0/libs/serialization/src/../../../include/boost/type_index/stl_type_index.hpp:47:
/Users/naliboff/software/dealii/v9.5.2/install/tmp/unpack/deal.II-v9.5.2/bundled/boost-1.70.0/libs/serialization/src/../../../include/boost/container_hash/hash.hpp:130:33: error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
        struct hash_base : std::unary_function<T, std::size_t> {};
                           ~~~~~^~~~~~~~~~~~~~
                                __unary_function
/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
^
[ 30%] Built target bundled_umfpack_ZL_STORE_debug
make[2]: *** [bundled/boost-1.70.0/libs/serialization/src/CMakeFiles/bundled_boost_serialization_debug.dir/xml_grammar.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....

This seems likely related to the following deprecation in Xcode15, as noted here: unary_function and binary_function are no longer provided in C++17 and newer Standard modes. They can be re-enabled with _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION.

For reference, I followed the instruction for building deal.II on a Mac ARM system from here, with the exception of:

  1. building gcc@11 with homebrew (likely not an issue since I used the clang compilers)
  2. I used the candi configuration file from the ASPECT repository

Any suggestions for how to proceed?

Thanks! John

naliboff commented 4 months ago

I resolved this by installing boost through candi, where boost version 1.8.x and above no longer uses std::unary_function. Would making a note of this be a helpful addition to one of the wikis and/or add a new platform under deal.II-toolchain/platforms/supported/for Mac osx Sonoma?

QY-Shi commented 4 months ago

You can choose the master version of deal.II instead of 9.5.2. I reported this std::unary_function issue, and it was solved.

pawantakhar commented 3 months ago

I was having problems with both Candi and precompiled (.dmg) versions. I was able to compile ver 9.5.2 for M2 Mac without any issues.