Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build Phantom on macOS #61

Closed
dmentipl opened this issue Sep 1, 2020 · 6 comments
Closed

Cannot build Phantom on macOS #61

dmentipl opened this issue Sep 1, 2020 · 6 comments

Comments

@dmentipl
Copy link
Contributor

dmentipl commented Sep 1, 2020

Phantom fails to build on macOS with HDF5=yes. The failure is in building the binary in the linking stage.

My machine is macOS 10.15.6. I have gfortran (version 10.2.0) and HDF5 (version 1.12.0_1) installed via Homebrew.

I am using Phantom from the master branch plus the changes implemented in #58. I.e. @dliptai's fork.

To reproduce, assuming you have the latest gfortran and HDF5 installed from Homebrew:

$ GIT_LFS_SKIP_SMUDGE=1 git clone git@github.com:dliptai/phantom
$ cd phantom
$ make SETUP=disc SYSTEM=gfortran HDF5=yes HDF5ROOT=/usr/local/opt/hdf5

The output, at the stage where it fails:

gfortran -O3 -Wall -Wno-unused-dummy-argument -frecord-marker=4 -gdwarf-2 -finline-functions-called-once -finline-limit=1500 -funroll-loops -ftree-vectorize -std=f2008 -fall-intrinsics -fPIC -fopenmp -fdefault-real-8 -fdefault-double-8 -I/usr/local/opt/hdf5/include -o ../bin/phantom physcon.o config.o kernel_cubic.o io.o units.o boundary.o mpi_utils.o dtype_kdtree.o utils_omp.o utils_cpuinfo.o utils_allocate.o icosahedron.o utils_mathfunc.o part.o mpi_domain.o utils_timing.o mpi_balance.o setup_params.o timestep.o utils_dumpfiles.o utils_indtimesteps.o utils_infiles.o utils_sort.o utils_supertimestep.o utils_tables.o utils_gravwave.o utils_sphNG.o utils_vectors.o utils_datafiles.o datafiles.o gitinfo.o random.o eos_mesa_microphysics.o eos_mesa.o eos_shen.o eos_helmholtz.o eos_idealplusrad.o eos.o cullendehnen.o nicil.o nicil_supplement.o inverse4x4.o metric_minkowski.o metric_tools.o utils_gr.o cons2primsolver.o checkoptions.o viscosity.o options.o radiation_utils.o cons2prim.o centreofmass.o extern_corotate.o extern_binary.o extern_spiral.o extern_lensethirring.o extern_gnewton.o lumin_nsdisc.o extern_prdrag.o extern_Bfield.o extern_densprofile.o extern_staticsine.o extern_gwinspiral.o externalforces.o damping.o checkconserved.o partinject.o utils_inject.o utils_filenames.o utils_summary.o fs_data.o mol_data.o utils_spline.o h2cooling.o h2chem.o cooling.o dust.o growth.o dust_formation.o ptmass_radiation.o mpi_dens.o mpi_force.o stack.o mpi_derivs.o kdtree.o linklist_kdtree.o memory.o utils_hdf5.o utils_dumpfiles_hdf5.o readwrite_dumps_common.o readwrite_dumps_fortran.o readwrite_dumps_hdf5.o readwrite_dumps.o quitdump.o ptmass.o readwrite_infile.o dens.o force.o utils_deriv.o deriv.o energies.o sort_particles.o evwrite.o step_leapfrog.o writeheader.o step_supertimestep.o mf_write.o evolve.o checksetup.o initial.o phantom.o  -L/usr/local/opt/hdf5/lib -lhdf5 -lhdf5_fortran
Undefined symbols for architecture x86_64:
  "_GOMP_loop_maybe_nonmonotonic_runtime_next", referenced from:
      ___timestep_sts_MOD_sts_init_step._omp_fn.0 in utils_supertimestep.o
      ___densityforce_MOD_densityiterate._omp_fn.0 in dens.o
      ___forces_MOD_force._omp_fn.0 in force.o
  "_GOMP_loop_maybe_nonmonotonic_runtime_start", referenced from:
      ___timestep_sts_MOD_sts_init_step._omp_fn.0 in utils_supertimestep.o
      ___densityforce_MOD_densityiterate._omp_fn.0 in dens.o
      ___forces_MOD_force._omp_fn.0 in force.o
  "__gfortran_os_error_at", referenced from:
      ___dump_utils_MOD_read_array_real8arr in utils_dumpfiles.o
      ___dump_utils_MOD_read_array_real8 in utils_dumpfiles.o
      ___table_utils_MOD_diff in utils_tables.o
      ___table_utils_MOD_flip_array in utils_tables.o
      ___mesa_microphysics_MOD_get_eos_constants_mesa in eos_mesa_microphysics.o
      ___mesa_microphysics_MOD_read_opacity_mesa in eos_mesa_microphysics.o
      ___mesa_microphysics_MOD_get_opacity_constants_mesa in eos_mesa_microphysics.o
      ...
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[1]: *** [phantom] Error 1
make: *** [phantom] Error 2

This is coming from the building the phantom binary stage, in the following lines in the Makefile:

phantom: checksystem checkparams $(OBJECTS) phantom.o
	$(FC) $(FFLAGS) -o $(BINDIR)/$@ $(OBJECTS) phantom.o $(LDFLAGS)

I do not have this problem on my linux machine with gfortran (version 9.3.0) and HDF5 (version 1.10.5).

@dmentipl
Copy link
Contributor Author

dmentipl commented Sep 1, 2020

Actually this also happens without HDF5=yes.

@dmentipl dmentipl changed the title Cannot build Phantom with HDF5=yes on macOS Cannot build Phantom on macOS Sep 1, 2020
@dmentipl
Copy link
Contributor Author

dmentipl commented Sep 1, 2020

Narrowing further (I have to do GIT_LFS_SKIP_SMUDGE=1 because the git-lfs quota is blown):

$ GIT_LFS_SKIP_SMUDGE=1 git clone git@github.com:danieljprice/phantom
$ cd phantom
$ make SETUP=empty SYSTEM=gfortran

Output (at the point where the failure is):

gfortran -O3 -Wall -Wno-unused-dummy-argument -frecord-marker=4 -gdwarf-2 -finline-functions-called-once -finline-limit=1500 -funroll-loops -ftree-vectorize -std=f2008 -fall-intrinsics -fPIC -fopenmp -fdefault-real-8 -fdefault-double-8 -o ../bin/phantom physcon.o config.o kernel_cubic.o io.o units.o boundary.o mpi_utils.o dtype_kdtree.o utils_omp.o utils_cpuinfo.o utils_allocate.o icosahedron.o utils_mathfunc.o part.o mpi_domain.o utils_timing.o mpi_balance.o setup_params.o timestep.o utils_dumpfiles.o utils_indtimesteps.o utils_infiles.o utils_sort.o utils_supertimestep.o utils_tables.o utils_gravwave.o utils_sphNG.o utils_vectors.o utils_datafiles.o datafiles.o gitinfo.o random.o eos_mesa_microphysics.o eos_mesa.o eos_shen.o eos_helmholtz.o eos_idealplusrad.o eos.o cullendehnen.o nicil.o nicil_supplement.o inverse4x4.o metric_minkowski.o metric_tools.o utils_gr.o cons2primsolver.o checkoptions.o viscosity.o options.o radiation_utils.o cons2prim.o centreofmass.o extern_corotate.o extern_binary.o extern_spiral.o extern_lensethirring.o extern_gnewton.o lumin_nsdisc.o extern_prdrag.o extern_Bfield.o extern_densprofile.o extern_staticsine.o extern_gwinspiral.o externalforces.o damping.o checkconserved.o partinject.o utils_inject.o utils_filenames.o utils_summary.o fs_data.o mol_data.o utils_spline.o h2cooling.o h2chem.o cooling.o dust.o growth.o dust_formation.o ptmass_radiation.o mpi_dens.o mpi_force.o stack.o mpi_derivs.o kdtree.o linklist_kdtree.o memory.o readwrite_dumps_common.o readwrite_dumps_fortran.o readwrite_dumps.o quitdump.o ptmass.o readwrite_infile.o dens.o force.o utils_deriv.o deriv.o energies.o sort_particles.o evwrite.o step_leapfrog.o writeheader.o step_supertimestep.o mf_write.o evolve.o checksetup.o initial.o phantom.o
Undefined symbols for architecture x86_64:
  "_GOMP_loop_maybe_nonmonotonic_runtime_next", referenced from:
      ___timestep_sts_MOD_sts_init_step._omp_fn.0 in utils_supertimestep.o
      ___densityforce_MOD_densityiterate._omp_fn.0 in dens.o
      ___forces_MOD_force._omp_fn.0 in force.o
  "_GOMP_loop_maybe_nonmonotonic_runtime_start", referenced from:
      ___timestep_sts_MOD_sts_init_step._omp_fn.0 in utils_supertimestep.o
      ___densityforce_MOD_densityiterate._omp_fn.0 in dens.o
      ___forces_MOD_force._omp_fn.0 in force.o
  "__gfortran_os_error_at", referenced from:
      ___dump_utils_MOD_read_array_real8arr in utils_dumpfiles.o
      ___dump_utils_MOD_read_array_real8 in utils_dumpfiles.o
      ___table_utils_MOD_diff in utils_tables.o
      ___table_utils_MOD_flip_array in utils_tables.o
      ___mesa_microphysics_MOD_get_eos_constants_mesa in eos_mesa_microphysics.o
      ___mesa_microphysics_MOD_read_opacity_mesa in eos_mesa_microphysics.o
      ___mesa_microphysics_MOD_get_opacity_constants_mesa in eos_mesa_microphysics.o
      ...
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[1]: *** [phantom] Error 1
make: *** [phantom] Error 2

gfortran version:

$ gfortran --version
GNU Fortran (Homebrew GCC 10.2.0) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@bjnorfolk
Copy link

Also can't build phantom on my mac. Any tips @danieljprice ?

@danieljprice
Copy link
Owner

danieljprice commented Sep 1, 2020

looks like a conflict in your gfortran installations, not a phantom problem, as in you're linking against the wrong libgfortran compared to the one you used to compile the code.

@danieljprice
Copy link
Owner

this is likely related to your -L/dir/ flags which are causing a conflict with the libraries linked at linktime. This is not a problem with phantom but with your link against hdf5 libraries causing a conflict. Closing as not a phantom issue, and also a good example of why binary Fortran library dependencies cause headaches.

@dmentipl
Copy link
Contributor Author

dmentipl commented Sep 1, 2020

I don't think it's an issue with HDF5. I can't even build Phantom with make SETUP=empty SYSTEM=gfortran.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants