Closed kasra-keshavarz closed 6 months ago
Forgot to mention that the VM is running on a arm64
computer (MacBook Pro M2 CPU).
Including #include <string.h>
does resolve the issue. librmn will be updated in the future, so we'll see if then they've already accounted for this. A pending update to the makefile targets will also provide more flexibility to omit inactive model codes from being compiled. This will also resolve the issue if SVS isn't required and would be disabled during compile-time outright.
Please re-open the ticket if further action is required for @roalva82's specific needs.
Thanks Dan, I tried to follow your suggestion:
$ make netcdf gfortran
...
gcc -c -O2 -I./LSS_Model/SVS/svs1/changes_to_rpnphy -I./LSS_Model/SVS/svs1/rpnphy_5.8.3_all -I./LSS_Model/SVS/svs1/svs_GEM_v5.8.rc2 -I./Modules/librmn/19.7.0/CUSTOM_INCLUDES/ ./Modules/librmn/19.7.0/primitives/getenvc.c
./Modules/librmn/19.7.0/primitives/getenvc.c:34:1: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type]
34 | F2Cl len1, len2;
| ^~~~
./Modules/librmn/19.7.0/primitives/getenvc.c:33:1: error: 'f77name' declared as function returning a function
33 | f77name(getenvc) ( name, value, len1, len2 )
| ^~~~~~~
./Modules/librmn/19.7.0/primitives/getenvc.c: In function 'f77name':
./Modules/librmn/19.7.0/primitives/getenvc.c:33:1: error: type of 'getenvc' defaults to 'int' [-Wimplicit-int]
./Modules/librmn/19.7.0/primitives/getenvc.c:35:15: error: declaration for parameter 'value' but no such parameter
35 | char name[1], value[1];
| ^~~~~
./Modules/librmn/19.7.0/primitives/getenvc.c:35:6: error: declaration for parameter 'name' but no such parameter
35 | char name[1], value[1];
| ^~~~
./Modules/librmn/19.7.0/primitives/getenvc.c:34:13: error: declaration for parameter 'len2' but no such parameter
34 | F2Cl len1, len2;
| ^~~~
./Modules/librmn/19.7.0/primitives/getenvc.c:34:7: error: declaration for parameter 'len1' but no such parameter
34 | F2Cl len1, len2;
| ^~~~
make: *** [getenvc.o] Error 1
(base) kasras-mbp:MESH-Dev kasrakeshavarz$ git diff
diff --git a/Modules/librmn/19.7.0/primitives/getenvc.c b/Modules/librmn/19.7.0/primitives/getenvc.c
index bbd2dbf..d8bc783 100644
--- a/Modules/librmn/19.7.0/primitives/getenvc.c
+++ b/Modules/librmn/19.7.0/primitives/getenvc.c
@@ -17,9 +17,9 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
#if defined(NEC)
#endif
+#include <string.h>
#include <stdlib.h>
#include <rpnmacros.h>
/*
I'm still hitting this issue, and it needs a patch. Is the new file I have shared above acceptable? Let me know.
With what version of gcc, is it still gcc9?
I think anything above gcc@9
(inclusive) is having this issue.
Right now, here are my specs:
$ gfortran --version
GNU Fortran (Spack GCC) 14.2.0
Copyright (C) 2024 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.
$ git rev-parse --short HEAD # MESH's repository
ff1de25
I'm aware of an issue with gcc12. We haven't moved ahead to gcc14 yet. However, I don't think this is the the same problem as with <string.h>
, and from your error, it looks related to variable declarations. Are you using SVS?
No I'm not using SVS specifically, just trying to compile MESH
with:
$ make netcdf gfortran
Let me test with gcc@12
as well. I know gcc@12
has this issue which I think is only isolated to c++
(not sure)?: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109359. It is resolved with @12.4.0
. Let me try and report here.
Ok, sounds good. I suggest creating a new issue for gcc12 and/or gcc14, since it's unrelated to the original problem described here with gcc9.
Problem statement
I'm not quite sure about the source code of
MESH
, as I am not completely aware of all the ins and outs, but while trying to provide @roalva82 with an executable on an Ubuntu VM, I noticed>gcc-9.4.0
(could be earlier versions too) throws an error for the involvedC
codes inMESH
. Are we missing a flag or something?Here is the typical error:
Suggested fix
It apparently relates to the
SVS
source code? I thought a quick fix could be like the following:and, the original code is the following: https://github.com/MESH-Model/MESH-Dev/blob/ff1de25e67ef552844f1e789c0faffb4175a8dac/Modules/librmn/19.7.0/primitives/getenvc.c#L21-L75
Let me know if this is an acceptable fix, and I'll send it as a
PR
.Suggestions
I know
SVS
is probably an upstream package, but not sure if it is under active development, so I can submit this there? Also, is there a possibility to useSVS
as a shared library, rather than statically linking (if it is) it withMESH
executables?