maim
maim copied to clipboard
maim fails to build: ‘enable_if’ in namespace ‘std’ does not name a template type
media-gfx/maim-5.8.0 fails to build with error:
error: ‘enable_if’ in namespace ‘std’ does not name a template type
[3/4] /usr/bin/x86_64-pc-linux-gnu-g++ -DCXXOPTS_USE_UNICODE -DMAIM_VERSION=\"v5.8.0\" -O2 -pipe -march=haswell -mtune=skylake -std=c++11 -MD -MT CMakeFiles/maim.dir/src/main.cpp.o -MF CMakeFiles/maim.dir/src/main.cpp.o.d -o CMakeFiles/maim.dir/src/main.cpp.o -c /var/tmp/portage/portage/media-gfx/maim-5.8.0/work/maim-5.8.0/src/main.cpp
FAILED: CMakeFiles/maim.dir/src/main.cpp.o
/usr/bin/x86_64-pc-linux-gnu-g++ -DCXXOPTS_USE_UNICODE -DMAIM_VERSION=\"v5.8.0\" -O2 -pipe -march=haswell -mtune=skylake -std=c++11 -MD -MT CMakeFiles/maim.dir/src/main.cpp.o -MF CMakeFiles/maim.dir/src/main.cpp.o.d -o CMakeFiles/maim.dir/src/main.cpp.o -c /var/tmp/portage/portage/media-gfx/maim-5.8.0/work/maim-5.8.0/src/main.cpp
In file included from /usr/include/unicode/unistr.h:39,
from /var/tmp/portage/portage/media-gfx/maim-5.8.0/work/maim-5.8.0/src/cxxopts.hpp:51,
from /var/tmp/portage/portage/media-gfx/maim-5.8.0/work/maim-5.8.0/src/main.cpp:11:
/usr/include/unicode/stringpiece.h:133:29: error: ‘enable_if_t’ in namespace ‘std’ does not name a template type
133 | typename = std::enable_if_t<
| ^~~~~~~~~~~
/usr/include/unicode/stringpiece.h:133:24: note: ‘std::enable_if_t’ is only available from C++14 onwards
133 | typename = std::enable_if_t<
| ^~~
/usr/include/unicode/stringpiece.h:133:40: error: expected ‘>’ before ‘<’ token
133 | typename = std::enable_if_t<
| ^
ninja: build stopped: subcommand failed.
To fix this issue I've changed the standard version with the following command:
sed -i 's#CXX_STANDARD 11#CXX_STANDARD 17#' CMakeLists.txt
Is this a good solution? If yes, could you, please, fix in the repository as well?
Downstream bug report: https://bugs.gentoo.org/937454
Note that CXX_STANDARD 17 instead of just CXX_STANDARD 14 is needed because /usr/include/unicode/stringpiece.h (at least since 75.1) also uses std::is_same_v that is c++17.
I believe your fix was applied in https://github.com/naelstrof/maim/commit/e7fe09b6734baeb59081b8805be542c92178cf0f.