slcs-jsc / mptrac

Massive-Parallel Trajectory Calculations (MPTRAC) is a Lagrangian particle dispersion model for the analysis of atmospheric transport processes in the free troposphere and stratosphere.
GNU General Public License v3.0
35 stars 14 forks source link

build and make issue #35

Closed zhangslTHU closed 2 months ago

zhangslTHU commented 2 months ago

Hi, i have met some issues when i install MPTRAC onto server linux system. Describe the bug

bug1

Environment i use the Rocky Linux server

envs

log_check.txt

lars2015 commented 2 months ago

Hi there,

Glad to hear you are looking at MPTRAC and thanks for letting us know about your issues!

From the log messages, the issue with installing the libraries seems to be related to the HDF5 library checks. Since you found that the compilations sometimes work and sometimes do not, it may be related to a specific hardware issue with a network file system.

You can disable the HDF5 library checks in ./lib/build.sh by removing make check on this line: https://github.com/slcs-jsc/mptrac/blob/329597ce0bfdf302209fd89ab45612b7f3928d7c/libs/build.sh#L209

You wouldn't find any problems with HDF5 during the installation, but you might find them later when running MPTRAC, so this seems a bit dangerous.

Alternatively, you could try installing MPTRAC using the netCDF and HDF5 libraries available on your Linux system.

The second problem you mention is probably due to the fact that you are using a newer version of gcc than we are, which checks the code more carefully. The compiler correctly warns that the size of the varname and longname variables may not be long enough to capture the full string. I have increased the size of the varname and longname variables:

https://github.com/slcs-jsc/mptrac/commit/329597ce0bfdf302209fd89ab45612b7f3928d7c

You can also remove the -Werror flag from ./src/Makefile to prevent the compiler from converting warnings into compilation errors and stopping the compilation.

If this doesn't work or you have any other questions, please let me know.

Best regards Lars

zhangslTHU commented 2 months ago

thanks a lot for your answers.

i am curious about how to install MPTRAC using the netCDF and HDF5 libraries available on my Linux system. I know i can add the local path of netCDF and HDF5 libraries to INCDIR and LIBDIR in Makefile when i make check, but how can i specify netCDF and HDF5 libraries in './build.sh'? skip HDF5 library build?

For second issue, i downloaded latest MPTRAC and updated. However, when i make check, it still has some warnings like below

bug1

When i removed the -Werror flag from ./src/Makefile, it still failed to compile (make clean first) (opt is the directory in our linux server, i am not sure whether opt shown in screenshot is that directory). more detailed errors can been seen in attached log files.

bug2

later, i ./build.sh -gnz again, but still came across same issue shown in fig 1 when keep -Werror and same issue shown in fig 2 when remove -Werror. log_check_withWerror.txt

log_check_without_Werror.txt

lars2015 commented 2 months ago

Hi,

From the log messages it looks like there is a name conflict on your system. It seems that there is an environment variable $OPT on your system which is defined as OPT = /opt (or similar). However, in the MPTRAC Makefile, we use this variable to set the optimization level for the gcc compiler (OPT ?= -O3). The environment variable overrides the Makefile, so on your system /opt is used instead of -O3, causing the compilation errors. I changed the variable name from OPT to OPTI in the Makefile to fix this. (You can also try make OPT=-O3 with the existing code).

I also fixed the warnings about the length of the string variable msg that you saw during the compilation process. Interestingly, these only appeared when the code was compiled without optimization (-O0), but didn't appear with optimization turned on (-O3).

If you'd like to use the netCDF library and possibly the GNU Scientific Library (GSL) from your system, you may need to add the paths to the include directory and the library directory (variables INCDIR and LIBDIR) to the Makefile. You can find out the correct paths with nc-config' andgsl-config'. If you are using netCDF and GSL from your system, you don't need to build the libraries with MPTRAC at all (no need to run build.sh). Just be aware that you may have different versions of the libraries on your system than the ones we use with MPTRAC, which may cause other conflicts.

Best regards Lars

zhangslTHU commented 2 months ago

Hi lars, thanks a lot for your kindly help.

Previous issues have been resolved after i updated MPTRAC. However, a new error appeared showing as follows when i do make check. Here i run build.sh first to use libraries provided by MPTRAC and don't make any changes for Makefile.

bug
lars2015 commented 2 months ago

Hi,

It seems the compilation worked this time but there are issues with linking to system libraries such as the math library (-lm).

You may have to install the static versions of the libraries as described here: https://stackoverflow.com/questions/7284009/cannot-find-lc-and-lm-in-g-linux

You can also try dynamic linking, try make STATIC=0 when compiling MPTRAC. This often works easier but you may have to set/adapt $LD_LIBRARY_PATH when runing the executables.

Best regards Lars

zhangslTHU commented 2 months ago

Hi, Lars.

thanks a lot . MPTRAC is compiled successfully with make STATIC=0. The issue has been resolved now.

lars2015 commented 2 months ago

Hi,

Glad to hear it worked out! :-)

You can try make check next to see if you can reproduce the test cases/results.

If you need further help, e.g. with preparing the meteo data for a study, please let me know.

Best regards Lars

zhangslTHU commented 2 months ago

HI, Lars,

It is successful to reproduce the results and pass the tests with dynamic linking when try make check and run examples.

thank you very much for your kindly help!

lars2015 commented 2 months ago

Hi, this is nice! I will close this issue for now. If there are other questions, we can reopen it later. Best, Lars