Re: Error when doing make

From: Volker Springel <vspringel_at_MPA-Garching.MPG.DE>
Date: Sat, 22 Jan 2022 15:19:38 +0100

Hi Joost,

Not sure whether your problem is still around. Both, compiling these libraries from source into /usr/local, or using home brew, is fine in principle. Your compilation also seems to have found the header files fine, otherwise you would have not gotton to the link stage. But you only included a truncated version of your link command below... the part where the libaries and the paths to them should be is the interesting one, but is mussing. For example, you should have something like
-L/opt/local/lib -lhdf5
or
-L/usr/local/Cellar/hdf5/1.12.1/lib -lhdf5
in the ink command. If not, you have probably not setup the systype correctly (whether you name that 'Darwin' or something else doesn't matter - this only serves as an arbitrart tag to select the desired sub-makefile for defining the paths to the libraries).

Regards,
Volker

> On 13. Jan 2022, at 06:40, Joost VanderBorgh <joostv_at_sas.upenn.edu> wrote:
>
> Hello all,
>
> I hope the new year has been treating you well :)
>
> I am attempting to run Gadget-4 on my Mac and wanted to reach out since I am having some issues.
> In particular, I am not too sure if I am setting up the link correctly. I have tried two ways of installing the dependencies. Since I am running on a Mac, I have set the systype as Darwin which would rely on Makefile.path.macports and Makefile.comp.gcc. I did not edit Makefile.path.macports.
>
> For the first attempt, I built GSL, FFTW, HDF5, Open-MPI, and HLOC from source. I then set up the Makefile.path.macports as follows:
> GSL_INCL = -I/usr/local/include
> GSL_LIBS = -L/usr/local/lib
> FFTW_INCL = -I/usr/local/include
> FFTW_LIBS = -L/usr/local/lib
> HDF5_INCL = -I/usr/local/include
> HDF5_LIBS = -L/usr/local/lib
> HWLOC_INCL = -I/usr/local/include
> HWLOC_LIBS = -L/usr/local/lib
> MAPS_INCL = -I/usr/local/include
> MAPS_LIBS = -L/usr/local/lib
> Unfortunately, undefined symbols as below was the error message and after trying to fix it, I decided maybe it was the installation being the issue.
>
> So: for the second attempt, I used home brew to install GSL, FFTW, HDF5, Open MPI, and HLOC and set my Makefile.path.macports as follows to directly reference each package:
> GSL_INCL = -I/usr/local/Cellar/gsl/2.7/include
> GSL_LIBS = -L/usr/local/Cellar/gsl/2.7/lib
> FFTW_INCL = -I/usr/local/Cellar/fftw/3.3.10/include
> FFTW_LIBS = -L/usr/local/Cellar/fftw/3.3.10/lib
> HDF5_INCL = -I/usr/local/Cellar/hdf5/1.12.1/include
> HDF5_LIBS = -L/usr/local/Cellar/hdf5/1.12.1/lib
> HWLOC_INCL = -I/usr/local/Cellar/hwloc/2.7.0/include
> HWLOC_LIBS = -L/usr/local/Cellar/hwloc/2.7.0/lib
> MAPS_INCL = -I/usr/local/include
> MAPS_LIBS = -L/usr/local/lib
> I was sure to link this via $ brew link --overwrite
>
> Then still an error. I apologize for the trivialness of the question and thank you for your help in advance. I read through the previous general discussion posts on "Error on Make" and these applied to Gadget2 but gave me some insights into explicitly writing out the locations as above to each package.
>
> I have three direct questions:
> 1. I wonder if I could use other systypes rather than Darwin if I am running on Mac, perhaps this might help?
> 2. Should I stick with Home Brew or should I revert back to installation from source?
> 3. Has anyone come across this before and has suggestions for what I can do? Please let me know if you need more information :)
>
> This was the error message for the both:
> mpicxx -std=c++11 -ggdb -O3 -march=native -Wall -Wno-format-security -I/usr/local/include -Ibuild -Isrc -c build/compile_time_info.cc -o build/compile_time_info.o
> mpicxx -std=c++11 -ggdb -O3 -march=native -Wall -Wno-format-security -I/usr/local/include -Ibuild -Isrc -c build/compile_time_info_hdf5.cc -o build/compile_time_info_hdf5.o
> mpicxx -std=c++11 -ggdb -O3 -march=native -Wall -Wno-format-security build/main/begrun.o build/main/init.o build/main/main.o build/main/run.o build/data/mymalloc.o build/data/allvars.o build/data/test_symtensors.o build/domain/domain.o build/domain/domain_balance.o build/domain/domain_box.o build/domain/domain_exchange.o build/domain/domain_toplevel.o build/io/hdf5_util.o build/io/snap_io.o build/io/parameters.o build/io/restart.o build/io/io.o ..
> ...
> -o Gadget4
> Undefined symbols for architecture x86_64:
> ...
>
> "_H5check_version", referenced from:
> snap_io::read_header_fields(char const*) in snap_io.o
> IO_Def::read_file(char const*, int, int, int, void*) in io.o
> IO_Def::append_file(char*, int, int, void*, int, int) in io.o
> IO_Def::write_file(char*, int, int, void*, int, int) in io.o
> IO_Def::read_single_file_segment(char const*, int, int, long long, unsigned long long, long long, int) in io.o
> fof_io<simparticles>::read_header_fields(char const*) in fof_io.o
> "_H5open", referenced from:
> my_create_HDF5_halfprec_handler() in hdf5_util.o
> my_create_HDF5_special_integer_types() in hdf5_util.o
> write_string_attribute(int, char const*, char const*) in hdf5_util.o
> snap_io::write_header_fields(int) in snap_io.o
> snap_io::read_header_fields(char const*) in snap_io.o
> IO_Def::append_file(char*, int, int, void*, int, int) in io.o
> IO_Def::write_file(char*, int, int, void*, int, int) in io.o
> ...
> ...
> "_fftwf_plan_many_dft_c2r", referenced from:
> pm_periodic::pm_init_periodic(simparticles*) in pm_periodic.o
> ngenic::ngenic_initialize_ffts() in ngenic.o
> "_fftwf_plan_many_dft_r2c", referenced from:
> pm_periodic::pm_init_periodic(simparticles*) in pm_periodic.o
> ngenic::ngenic_initialize_ffts() in ngenic.o
> .....
> "_gsl_rng_state", referenced from:
> restart::contents_restart_file(int) in restart.o
> "_gsl_rng_uniform", referenced from:
> get_random_number() in system.o
> ngenic::ngenic_displace_particles() in ngenic.o
> ngenic::ngenic_setup_modes_in_kspace(float (*) [2]) in ngenic.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>
>
> Thank you in advance for your advice.
>
> Regards,
>
> Joost
>
> -----------------------------------------------------------
>
> If you wish to unsubscribe from this mailing, send mail to
> minimalist_at_MPA-Garching.MPG.de with a subject of: unsubscribe gadget-list
> A web-archive of this mailing list is available here:
> http://www.mpa-garching.mpg.de/gadget/gadget-list
Received on 2022-01-22 15:19:39

This archive was generated by hypermail 2.3.0 : 2023-01-10 10:01:33 CET