Error in generating .exe when compiling SWAT+ on Linux

31 views
Skip to first unread message

Ann Wang

unread,
Nov 5, 2024, 11:48:57 AMNov 5
to SWAT+
Hello SWAT+ community:

I'm compiling SWAT+ (download directly from its official github page) on Linux. All the .f90 sources files have been successfully compiled into '.f90.o' files. But the compile process runs into error in merging all *.f90.o files into a single executable file, which is line 9696 in the "CMakeFiles/swatplus-unknown-gcc-lin_x86_64.dir/build.make". The error message 'cannot find -lm & -lc,' as shown in the attached picture, seems to indicate that some libraries are missing from my environment.

Can anyone help to identify the specific libraries that the error message is indicating?

Many thanks,
Ann

Screenshot 2024-11-04 153334.png

Olaf David

unread,
Nov 18, 2024, 9:18:05 AMNov 18
to SWAT+
Hi Ann,
 it seems like you are missing 'libm.a' and 'libc.a' for statically linking. Those are basic libraries (math and C) that should be installed. On a Debian based system, they are in '/usr/lib/x86_64-linux-gnu'. I'd recommend re-installing gcc/gfortran and then try to compile a very simple Fortran program. If that works then rebuild swat, but delete the folder 'build' first.  If that still fails, please post the file 'link.txt' from the 'swatplus-unknown-gcc-lin_x86_64.dir' folder.

BTW. If you just want to run the model, you can download the executables from Github. I recommend using the ifx builds, since swat for gfortran still needs adjustments. 

Hope this helps.

--od
Reply all
Reply to author
Forward
0 new messages