Static Assertion Failed When Building VMD Plugin in Gromacs
**Gromacs:** 2023.2
**VMD:** 1.9.3 text
**Build settings:**
cmake ../gromacs-2023.2 -DGMX_FFT_LIBRARY=fftw3 -DREGRESSIONTEST_DOWNLOAD=ON -DGMX_GPU=CUDA -DGMX_DOUBLE=off -DCMAKE_BUILD_TYPE=Release -DGMX_PHYSICAL_VALIDATION=ON -DCMAKE_INSTALL_PREFIX=/usr/local/gromacs_2023.2 -DBUILD_SHARED_LIBS=on -DGMX_PYTHON_PACKAGE=ON -DGMX_USE_PLUGINS=ON -DGMX_CUDA_TARGET_COMPUTE=75 -DGMX_VMD_PLUGIN_PATH=/usr/local/vmd-1.9.3
**Error:**
`
[ 89%] Building CXX object src/gromacs/CMakeFiles/libgromacs.dir/selection/scanner_internal.cpp.o
/user/path/configure/gromacs-2023.2/src/gromacs/fileio/vmdio.cpp: In function ‘int register_cb(void*, vmdplugin_t*)’:
/user/path/configure/gromacs-2023.2/src/gromacs/fileio/vmdio.cpp:131:32: error: cannot convert ‘std::filesystem::__cxx11::path’ to ‘const char*’
131 | if (strcmp(key, vmdplugin->filetype) == 0)
| ~~~~~~~~~~~^~~~~~~~
| |
| std::filesystem::__cxx11::path
In file included from /usr/include/c++/9/cstring:42,
from /user/path/configure/gromacs-2023.2/api/legacy/include/gromacs/utility/stringutil.h:46,
from /user/path/configure/gromacs-2023.2/src/gromacs/fileio/vmdio.cpp:41:
/usr/include/string.h:137:50: note: initializing argument 2 of ‘int strcmp(const char*, const char*)’
137 | extern int strcmp (const char *__s1, const char *__s2)
| ~~~~~~~~~~~~^~~~
In file included from /user/path/configure/gromacs-2023.2/api/legacy/include/gromacs/utility/unique_cptr.h:49,
from /user/path/configure/gromacs-2023.2/api/legacy/include/gromacs/utility/fileptr.h:47,
from /user/path/configure/gromacs-2023.2/api/legacy/include/gromacs/utility/futil.h:52,
from /user/path/configure/gromacs-2023.2/src/gromacs/fileio/gmxfio.h:46,
from /user/path/configure/gromacs-2023.2/src/gromacs/fileio/vmdio.cpp:111:
/user/path/configure/gromacs-2023.2/api/legacy/include/gromacs/utility/smalloc.h: In instantiation of ‘void gmx_snew_impl(const char*, const char*, int, T*&, size_t) [with T = gmx_vmdplugin_t; size_t = long unsigned int]’:
/user/path/configure/gromacs-2023.2/src/gromacs/fileio/vmdio.cpp:394:5: required from here
/user/path/configure/gromacs-2023.2/api/legacy/include/gromacs/utility/smalloc.h:201:35: error: static assertion failed: snew() called on C++ type
201 | static_assert(std::is_pod<T>::value, "snew() called on C++ type");
| ^~~~~
[ 89%] Building CXX object src/gromacs/CMakeFiles/libgromacs.dir/selection/selection.cpp.o
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-cast-function-type-strict’
make[2]: *** [src/gromacs/CMakeFiles/libgromacs.dir/build.make:10688: src/gromacs/CMakeFiles/libgromacs.dir/fileio/vmdio.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/user/path/configure/gromacs-2023.2/src/gromacs/fileio/trxio.cpp: In function ‘bool read_first_frame(const gmx_output_env_t*, t_trxstatus**, const std::filesystem::__cxx11::path&, t_trxframe*, int)’:
/user/path/configure/gromacs-2023.2/src/gromacs/fileio/trxio.cpp:1054:42: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘const std::filesystem::__cxx11::path’ [-Wformat=]
1054 | "The file format of %s is not a known trajectory format to GROMACS.\n"
| ~^
| |
| char*
/user/path/configure/gromacs-2023.2/src/gromacs/fileio/trxio.cpp:1064:71: warning: format ‘%s’ expects argument of type ‘char*’, but argument 5 has type ‘const std::filesystem::__cxx11::path’ [-Wformat=]
1064 | gmx_fatal(FARGS, "Not supported in read_first_frame: %s", fn);
| ~^
| |
| char*
In file included from /user/path/configure/gromacs-2023.2/api/legacy/include/gromacs/utility/unique_cptr.h:49,
from /user/path/configure/gromacs-2023.2/api/legacy/include/gromacs/topology/atoms.h:48,
from /user/path/configure/gromacs-2023.2/api/legacy/include/gromacs/fileio/pdbio.h:43,
from /user/path/configure/gromacs-2023.2/api/legacy/include/gromacs/fileio/trxio.h:40,
from /user/path/configure/gromacs-2023.2/src/gromacs/fileio/trxio.cpp:36:
/user/path/configure/gromacs-2023.2/api/legacy/include/gromacs/utility/smalloc.h: In instantiation of ‘void gmx_sfree_impl(const char*, const char*, int, T*) [with T = gmx_vmdplugin_t]’:
/user/path/configure/gromacs-2023.2/src/gromacs/fileio/trxio.cpp:650:5: required from here
/user/path/configure/gromacs-2023.2/api/legacy/include/gromacs/utility/smalloc.h:236:41: error: static assertion failed: sfree() called on C++ type
236 | static_assert(std::is_pod<T>::value || std::is_void<T>::value, "sfree() called on C++ type");
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-cast-function-type-strict’
make[2]: *** [src/gromacs/CMakeFiles/libgromacs.dir/build.make:10674: src/gromacs/CMakeFiles/libgromacs.dir/fileio/trxio.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:4254: src/gromacs/CMakeFiles/libgromacs.dir/all] Error 2
`
issue