groops-devs / groops

A software toolkit for gravity field recovery and GNSS processing
GNU General Public License v3.0
172 stars 102 forks source link

Compilation error ‘memcmp’ is not a member of ‘std’ on inputOutput/file.cpp #53

Closed jjclavijo closed 2 years ago

jjclavijo commented 2 years ago

Description

Compilaiton error

source/inputOutput/file.cpp:194:15: error: ‘memcmp’ is not a member of ‘std’; did you mean ‘wmemcm ’?

When compiling from git repo using cmake .; make (first encountered when trying to install on Arch with makepkg -si but reproduced using cmake and make)

It seems there is a missing #include <cstring> somewhere.

I guess it should be included in this file, and indeed this solved the problem.

I don't open a pull request firstly because i don't have experience developing c++ and secondly because the issue may be also solved by including directly on the file reported by the compiler, which is the only piece of code that requires it.

GROOPS version

main (latest commit)

Operating systems

Log output

[  0%] Building CXX object CMakeFiles/groopscore.dir/inputOutput/file.cpp.o
/home/javier/sources/groops-git/src/groops/source/inputOutput/file.cpp: En la función miembro ‘void StreamBase::open(const FileName&, std::ios_base::openmode)’:
/home/javier/sources/groops-git/src/groops/source/inputOutput/file.cpp:194:15: error: ‘memcmp’ is not a member of ‘std’; did you mean ‘wmemcm ’?
  194 |       if(std::memcmp(magic, magicZlib, sizeof(magic)) == 0)
      |               ^~~~~~
      |               wmemcmp
/home/javier/sources/groops-git/src/groops/source/inputOutput/file.cpp:196:20: error: ‘memcmp’ is not a member of ‘std’; did you mean ‘wmemcm ’?
  196 |       else if(std::memcmp(magic, magicCompress, sizeof(magic)) == 0)
      |                    ^~~~~~
      |                    wmemcmp
make[2]: *** [CMakeFiles/groopscore.dir/build.make:482: CMakeFiles/groopscore.dir/inputOutput/file.cpp.o] Error 1
make[2]: se sale del directorio '/home/javier/sources/groops-git/src/groops-git-r187.b7c87d2/build'
make[1]: *** [CMakeFiles/Makefile2:87: CMakeFiles/groopscore.dir/all] Error 2
make[1]: se sale del directorio '/home/javier/sources/groops-git/src/groops-git-r187.b7c87d2/build'
make: *** [Makefile:136: all] Error 2
make: se sale del directorio '/home/javier/sources/groops-git/src/groops-git-r187.b7c87d2/build'
tmayerguerr commented 2 years ago

Thank you for the hint. With the latest GCC version, the standards have been changed a bit. This was already fixed in our internal version, but I forgot to push this to github. Should be solved now. regards Torsten

jjclavijo commented 2 years ago

Tested up to the latest commit (513e978bbe9f8bf0cc8b5e68ac56cde70f0ded96) on the same Arch setting, compiles without errors

Thank you. Javier

Waley04 commented 2 years ago

Dear GROOPS Developers,

I write to report that I experience the same error when I try to install the latest commit of GROOPS on a Windows machine. Please, refer to the following for further details.

#################################################################### C:\groops\source\inputOutput\file.cpp: In member function 'void StreamBase::open(const FileName&, std::ios_base::openmode)': C:\groops\source\inputOutput\file.cpp:194:15: error: 'memcmp' is not a member of 'std'; did you mean 'wmemcmp'? 194 | if(std::memcmp(magic, magicZlib, sizeof(magic)) == 0) | ^~ | wmemcmp C:\groops\source\inputOutput\file.cpp:196:20: error: 'memcmp' is not a member of 'std'; did you mean 'wmemcmp'? 196 | else if(std::memcmp(magic, magicCompress, sizeof(magic)) == 0) | ^~ | wmemcmp mingw32-make[2]: [CMakeFiles\groopscore.dir\build.make:511: CMakeFiles/groopscore.dir/inputOutput/file.cpp.obj] Error 1 mingw32-make[2]: Waiting for unfinished jobs.... mingw32-make[1]: [CMakeFiles\Makefile2:86: CMakeFiles/groopscore.dir/all] Error 2 mingw32-make: [Makefile:135: all] Error 2 Consolidate compiler generated dependencies of target groopscore [ 1%] Building Fortran object CMakeFiles/groopscore.dir/external/nrlmsis2/msis_init.F90.obj [ 1%] Building Fortran object CMakeFiles/groopscore.dir/external/nrlmsis2/msis_gfn.F90.obj [ 1%] Building Fortran object CMakeFiles/groopscore.dir/external/nrlmsis2/msis_tfn.F90.obj [ 1%] Building Fortran object CMakeFiles/groopscore.dir/external/nrlmsis2/msis_dfn.F90.obj [ 1%] Building Fortran object CMakeFiles/groopscore.dir/external/nrlmsis2/msis_calc.F90.obj C:\groops\source\external\nrlmsis2\msis_calc.F90:177:26:

177 | call bspline(zeta,nodesTN,nd+2,kmax,etaTN,Sz,iz) | 1 Warning: Actual argument contains too few elements for dummy argument 'nodes' (30/31) at (1) [ 1%] Building CXX object CMakeFiles/groopscore.dir/inputOutput/file.cpp.obj C:\groops\source\inputOutput\file.cpp: In member function 'void StreamBase::open(const FileName&, std::ios_base::openmode)': C:\groops\source\inputOutput\file.cpp:194:15: error: 'memcmp' is not a member of 'std'; did you mean 'wmemcmp'? 194 | if(std::memcmp(magic, magicZlib, sizeof(magic)) == 0) | ^~ | wmemcmp C:\groops\source\inputOutput\file.cpp:196:20: error: 'memcmp' is not a member of 'std'; did you mean 'wmemcmp'? 196 | else if(std::memcmp(magic, magicCompress, sizeof(magic)) == 0) | ^~ | wmemcmp mingw32-make[2]: [CMakeFiles\groopscore.dir\build.make:511: CMakeFiles/groopscore.dir/inputOutput/file.cpp.obj] Error 1 mingw32-make[1]: [CMakeFiles\Makefile2:86: CMakeFiles/groopscore.dir/all] Error 2 mingw32-make: *** [Makefile:135: all] Error 2

groopsCompilationError

waley@roberts-8N6QM03 MINGW64 /c/groops/source/build

####################################################################

Thanks and looking forward to your usual support.

Regards,

Waley.

Waley04 commented 2 years ago

Greetings GROOOPS Developers,

Please, ignore my comment above. I error is from the software I downloaded 48 hours ago. The copy of the software I downloaded a few hours ago was successfully installed.

groopsSuccessfullyInstalled

Apologies for any inconvenience caused.

Regards,

Waley.