Parallel-NetCDF / PnetCDF

Source code repository of PnetCDF library and utilities
https://parallel-netcdf.github.io
Other
83 stars 23 forks source link

Open-MPI: Apple linker does not accept `-commons use_dylibs` flag anymore #139

Open chenrui333 opened 8 months ago

chenrui333 commented 8 months ago

👋 while building 1.13.0 release, running into the following build failure.

libtool: link: /opt/homebrew/opt/open-mpi/bin/mpif90 -I../../src/binding/f90 -ffree-form -I. -DN_DIM=3 -DMAXBLOCKS=100 -DIONMAX=13 -g -O2 -fallow-argument-mismatch -o .libs/flash_benchmark_io get_mfluid_property.o flash_release.o flash_benchmark_io.o checkpoint_ncmpi_parallel.o plotfile_ncmpi_parallel.o  -L../../src/libs /private/tmp/pnetcdf-20240330-45441-hnd2nv/pnetcdf-1.13.0/src/libs/.libs/libpnetcdf.dylib -L/opt/homebrew/Cellar/open-mpi/5.0.2_1/lib -L/opt/homebrew/Cellar/gcc/13.2.0/bin/../lib/gcc/current/gcc/aarch64-apple-darwin22/13 -L/opt/homebrew/Cellar/gcc/13.2.0/bin/../lib/gcc/current/gcc -L/opt/homebrew/Cellar/gcc/13.2.0/bin/../lib/gcc/current/gcc/aarch64-apple-darwin22/13/../../.. -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -lgfortran -lemutls_w -lquadmath
ld: warning: -commons use_dylibs is no longer supported, using error treatment instead
ld: warning: ignoring duplicate libraries: '-lemutls_w', '-lgcc', '-lgfortran', '-lmpi', '-lmpi_mpifh', '-lmpi_usempi_ignore_tkr', '-lmpi_usempif08', '-lquadmath'
ld: common symbol '_mpi_fortran_argv_null_' from '/private/tmp/pnetcdf-20240330-45441-hnd2nv/pnetcdf-1.13.0/benchmarks/FLASH-IO/checkpoint_ncmpi_parallel.o' conflicts with definition from dylib '_mpi_fortran_argv_null_' from '/opt/homebrew/Cellar/open-mpi/5.0.2_1/lib/libmpi_usempi_ignore_tkr.40.dylib'
collect2: error: ld returned 1 exit status

This is mostly because of -commons use_dylibs is now ignored. We (Homebrew) have filed the similar issue as https://github.com/open-mpi/ompi/issues/12427

And now for now. LDFLAGS=-ld_classic is a workaround.

relates to https://github.com/Homebrew/homebrew-core/pull/167535

wkliao commented 8 months ago

Thanks. I have added "Open-MPI:" to the title to mark it as an issue related to Open-MPI.