Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile Error with MSVC 19.04 #1485

Closed
ax3l opened this issue Jun 9, 2019 · 5 comments
Closed

Compile Error with MSVC 19.04 #1485

ax3l opened this issue Jun 9, 2019 · 5 comments
Labels

Comments

@ax3l
Copy link
Contributor

ax3l commented Jun 9, 2019

Compiler: MSVC 19.0.24241.7
ADIOS2: v2.4.1-rc1

Compiling on Windows with MSVC and CMake+NMake results in an error https://ci.appveyor.com/project/conda-forge/staged-recipes/builds/25153984 of the form

%SRC_DIR%\source\adios2/helper/adiosMemory.h(121): warning C4002: too many actual parameters for macro 'RtlCopyMemory'
%SRC_DIR%\source\adios2/helper/adiosMemory.h(114): error C2182: 'memcpy': illegal use of type 'void'
%SRC_DIR%\source\adios2/helper/adiosMemory.h(114): error C2988: unrecognizable template declaration/definition
%SRC_DIR%\source\adios2/helper/adiosMemory.h(114): error C2059: syntax error: 'noexcept'
c:\bld\adios2_1560110677887\work\source\adios2\helper\adiosMemory.inl(260): warning C4002: too many actual parameters for macro 'RtlCopyMemory'
c:\bld\adios2_1560110677887\work\source\adios2\helper\adiosMemory.inl(255): error C2146: syntax error: missing ')' before identifier 'dest'
c:\bld\adios2_1560110677887\work\source\adios2\helper\adiosMemory.inl(255): error C2065: 'dest': undeclared identifier
c:\bld\adios2_1560110677887\work\source\adios2\helper\adiosMemory.inl(255): error C2182: 'memcpy': illegal use of type 'void'
c:\bld\adios2_1560110677887\work\source\adios2\helper\adiosMemory.inl(255): error C2374: 'adios2::helper::memcpy': redefinition; multiple initialization
%SRC_DIR%\source\adios2/helper/adiosMemory.h(114): note: see declaration of 'adios2::helper::memcpy'
c:\bld\adios2_1560110677887\work\source\adios2\helper\adiosMemory.inl(255): error C2988: unrecognizable template declaration/definition
c:\bld\adios2_1560110677887\work\source\adios2\helper\adiosMemory.inl(255): error C2059: syntax error: ','
c:\bld\adios2_1560110677887\work\source\adios2\helper\adiosMemory.inl(255): error C2059: syntax error: ')'
c:\bld\adios2_1560110677887\work\source\adios2\helper\adiosMemory.inl(287): error C2143: syntax error: missing ';' before '{'
c:\bld\adios2_1560110677887\work\source\adios2\helper\adiosMemory.inl(287): error C2447: '{': missing function header (old-style formal list?)

Ref: conda-forge/staged-recipes#8526

@ax3l
Copy link
Contributor Author

ax3l commented Jun 29, 2019

Just wondering if you had a change to take a look at this, since this is the default compile chain for windows on conda forge :)
(sorry for just reporting and not PR-ing these days...)

@germasch
Copy link
Contributor

I don't have a Windows machine to try on (luck me), but googling finds this in winbase.h:

#define CopyMemory RtlCopyMemory

So that's probably the culprit, because otherwise the error makes no sense. Since yelling at microsoft for doing such stuff probably won't solve the problem, the two possible ways I can think of to fix it are:

  1. try to avoid having winbase.h included.
  2. rename the function to something different in adios2

I"ll make a PR for 2., should be trivial. Mentioning @chuckatkins as that sounds like something that should be fixed before the release.

germasch added a commit to germasch/ADIOS2 that referenced this issue Jun 29, 2019
This simply renames `helper::CopyMemory` to `helper::CopyMemoryBlock` to
avoid a name clash with the `CopyMemory` defined in the MSVC build in ornladios#1485.
@ax3l
Copy link
Contributor Author

ax3l commented Jun 29, 2019

With #1575 fixing the initial report, the following compile issue with HDF5ReaderP.cpp remains:

%SRC_DIR%\source\adios2\engine\hdf5\HDF5ReaderP.cpp(267): warning C4018: '>=': signed/unsigned mismatch
%SRC_DIR%\source\adios2\engine\hdf5\HDF5ReaderP.cpp(224): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
%SRC_DIR%\source\adios2\engine\hdf5\HDF5ReaderP.cpp(328): note: see reference to function template instantiation 'void adios2::core::engine::HDF5ReaderP::UseHDFRead<std::string>(adios2::core::Variable<std::string> &,T *,hid_t)' being compiled
        with
        [
            T=std::string
        ]
%SRC_DIR%\source\adios2\engine\hdf5\HDF5ReaderP.cpp(133): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
%SRC_DIR%\source\adios2\engine\hdf5\HDF5ReaderP.cpp(204): note: see reference to function template instantiation 'size_t adios2::core::engine::HDF5ReaderP::ReadDataset<std::string>(hid_t,hid_t,adios2::core::Variable<std::string> &,T *)' being compiled
        with
        [
            T=std::string
        ]
%SRC_DIR%\source\adios2\engine\hdf5\HDF5ReaderP.cpp(328): note: see reference to function template instantiation 'void adios2::core::engine::HDF5ReaderP::UseHDFRead<std::string>(adios2::core::Variable<std::string> &,T *,hid_t)' being compiled
        with
        [
            T=std::string
        ]
%SRC_DIR%\source\adios2\engine\hdf5\HDF5ReaderP.cpp(149): error C2131: expression did not evaluate to a constant
%SRC_DIR%\source\adios2\engine\hdf5\HDF5ReaderP.cpp(149): note: failure was caused by non-constant arguments or reference to a non-constant symbol
%SRC_DIR%\source\adios2\engine\hdf5\HDF5ReaderP.cpp(149): note: see usage of 'ndims'
%SRC_DIR%\source\adios2\engine\hdf5\HDF5ReaderP.cpp(156): error C3863: array type 'hsize_t [ndims]' is not assignable
%SRC_DIR%\source\adios2\engine\hdf5\HDF5ReaderP.cpp(157): error C3863: array type 'hsize_t [ndims]' is not assignable
%SRC_DIR%\source\adios2\engine\hdf5\HDF5ReaderP.cpp(161): error C3863: array type 'hsize_t [ndims]' is not assignable
%SRC_DIR%\source\adios2\engine\hdf5\HDF5ReaderP.cpp(162): error C3863: array type 'hsize_t [ndims]' is not assignable
%SRC_DIR%\source\adios2\engine\hdf5\HDF5ReaderP.cpp(165): error C3863: array type 'hsize_t [ndims]' is not assignable

https://ci.appveyor.com/project/conda-forge/staged-recipes/builds/25631833

Using HDF5 1.10.5 (non-parallel for the moment).

pnorbert pushed a commit to pnorbert/ADIOS2 that referenced this issue Jun 29, 2019
This simply renames `helper::CopyMemory` to `helper::CopyMemoryBlock` to
avoid a name clash with the `CopyMemory` defined in the MSVC build in ornladios#1485.

(cherry picked from commit 5f9bdb4)
pnorbert pushed a commit to pnorbert/ADIOS2 that referenced this issue Jun 30, 2019
This simply renames `helper::CopyMemory` to `helper::CopyMemoryBlock` to
avoid a name clash with the `CopyMemory` defined in the MSVC build in ornladios#1485.

(cherry picked from commit 5f9bdb4)
@ax3l
Copy link
Contributor Author

ax3l commented Jul 18, 2019

For further issues, see the report in conda-forge/adios2-feedstock#3

Currently stuck at linker errors.

@ax3l
Copy link
Contributor Author

ax3l commented Jan 14, 2020

Linker issue is now solved as well.
Had to set -DH5_BUILT_AS_DYNAMIC_LIB on conda-forge to link against their dynamic HDF5 libs, as @guj found in this forum entry: https://forum.hdfgroup.org/t/linking-hdf5-with-vs2015-c-64-bit-only-works-with-static-libraries/3697

@ax3l ax3l closed this as completed Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants