Build error with clang in Xcode 13+ on macOS Monterey - implicit copy constructor
When building on macOS Monterey, the latest version of clang (included with Xcode 13+, I believe) generates a warning about the "definition of implicit copy assignment operator". Because of the use of -Werror
, this warning results in a build error.
This error was reported by a user on the nektar-users mailing list (thanks to the reporter of the error for highlighting this).
The build error is generated from library/LibUtilities/SimdLib/scalar.hpp
(line 124):
/nektar++/library/LibUtilities/SimdLib/scalar.hpp:124:12: error: definition of implicit copy assignment
operator for 'scalarT<unsigned long long, void>' is deprecated because it has a user-declared
copy constructor [-Werror,-Wdeprecated-copy]
inline scalarT(const scalarT &rhs) = default;
There may be other similar occurrences elsewhere in the code but the build fails at this point.
The suggested temporary resolution to this issue is to add the -Wno-deprecated-copy
flag to the build configuration. This can be added to individual CMake configuration options but it was suggested to simply add this directly into the CMake configuration by editing nektar++/cmake/NektarCommon.cmake
and adding a new line after L116 (which should be TARGET_COMPILE_OPTIONS(${name} PRIVATE -Werror)
), at the same level of indentation - the line to add is:
TARGET_COMPILE_OPTIONS(${name} PRIVATE -Wno-deprecated-copy)
This can also be added by applying the attached patch file - from within the nektar++ base directory, run patch -p1 < nektar-disable-deprectaed-copy.diff
.