在 MacOS 上安装 Repast HPC 2.3.1 时出现问题

Problems installing Repast HPC 2.3.1 on MacOS

更新: 我正在尝试在配备 M1 处理器的 MacBook Pro 上安装 repast hpc 2.3.1,但是我 运行 遇到了以下问题。我正在按照包中包含的 Install.txt 说明进行操作。现在,当我尝试使用 ./install rhpc 时出现以下错误,这似乎是由于 GridComponents.o 文件未能找到 DBL_MAX 变量并将其标记为未声明:

checking for mpicc... mpicc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether mpicc accepts -g... yes
checking for mpicc option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... yes
checking whether /Users/alxndr/sfw/MPICH/bin//mpicxx accepts -g... yes
checking for ar... ar
checking for ranlib... ranlib
detected Mac.
checking for cp that supports -u... no
checking for grep that handles long lines and -e... /usr/bin/grep
checking how to run the C preprocessor... mpicc -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for Boost headers version >= 0... yes
checking for Boost's header version... 1_78
checking build system type... arm-apple-darwin20.6.0
checking host system type... arm-apple-darwin20.6.0
checking for the toolset name used by Boost for /Users/alxndr/sfw/MPICH/bin//mpicxx... xgcc42 -xgcc
checking how to run the C++ preprocessor... /Users/alxndr/sfw/MPICH/bin//mpicxx -E
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking boost/archive/text_oarchive.hpp usability... yes
checking boost/archive/text_oarchive.hpp presence... yes
checking for boost/archive/text_oarchive.hpp... yes
checking for the Boost serialization library... yes
checking boost/mpi.hpp usability... yes
checking boost/mpi.hpp presence... yes
checking for boost/mpi.hpp... yes
checking for the Boost mpi library... yes
checking boost/system/error_code.hpp usability... yes
checking boost/system/error_code.hpp presence... yes
checking for boost/system/error_code.hpp... yes
checking for the Boost system library... yes
checking boost/filesystem/path.hpp usability... yes
checking boost/filesystem/path.hpp presence... yes
checking for boost/filesystem/path.hpp... yes
checking for the Boost filesystem library... yes
checking for boost/system/error_code.hpp... (cached) yes
checking for the Boost system library... (cached) yes
checking for curl_version in -lcurl... yes
checking for nc_open in -lnetcdf... yes
checking netcdfcpp.h usability... yes
checking netcdfcpp.h presence... yes
checking for netcdfcpp.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for size_t... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for uint32_t... yes
checking for ptrdiff_t... yes
checking for error_at_line... no
checking for ANSI C header files... (cached) yes
checking for floor... yes
checking for rint... yes
checking for sqrt... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
  CC        src/repast_hpc/AgentId.o
  CC        src/repast_hpc/AgentImporterExporter.o
  CC        src/repast_hpc/AgentRequest.o
  CC        src/repast_hpc/AgentStatus.o
  CC        src/repast_hpc/CartesianTopology.o
  CC        src/repast_hpc/Graph.o
  CC        src/repast_hpc/GridComponents.o
src/repast_hpc/GridComponents.cpp:165:64: error: use of undeclared identifier 'DBL_MAX'
      if(out[i] >= maxs[i])       out[i] = nextafter(maxs[i], -DBL_MAX);
                                                               ^
src/repast_hpc/GridComponents.cpp:166:64: error: use of undeclared identifier 'DBL_MAX'
      else if(out[i] < mins[i])   out[i] = nextafter(mins[i],  DBL_MAX);
                                                               ^
2 errors generated.
make: *** [src/repast_hpc/GridComponents.o] Error 1

我在此处列出了所有必需的修复(包括 DBL_MAX 修复):https://github.com/Repast/repast.hpc/issues/7。有了这些,僵尸和谣言演示模型就可以在 M1 Max 笔记本电脑上的 macOS 上运行了。

综上所述,顺便说一句,我们通常在 Linux VM 运行ning 下的 Parallels 或 VMWare Fusion 上 Mac 上进行 repast hpc 和 repast4py 开发工作.这是因为它更接近我们最终 运行 模型所在的集群或 HPC 环境。