build broken on gcc version 4.8.5
Describe the bug gcc4.8.5 does not have full support of C++11, so codecvt will broken the build.
#include <codecvt>
How To Reproduce (Include if Applicable) When try to build laoshanxi/app-mesh
# docker run -ti --rm -v `pwd`:/data laoshanxi/appmesh:build_centos7 bash
# mkdir build; cd build;cmake ..;make
Expected behavior A clear and concise description of what you expected to happen.
Screenshots
bash-4.2# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
Desktop (please complete the following information):
- OS: [centos7]
- Compiler [gcc]
- Version [4.8.5]
Additional context For the include, we can use below micro to handle, but I am not sure how to handle the function below:
#if __cplusplus > 201103L
#include <codecvt>
#endif
static std::string to_lower_unicode(const std::string& str, const std::locale& loc)
Logs (Include/Attach if Applicable)
Click to expand log
[ 25%] Built target prometheus
[ 27%] Building CXX object src/cli/CMakeFiles/appc.dir/ArgumentParser.cpp.o
In file included from /data/src/cli/ArgumentParser.cpp:16:0:
/data/src/cli/../common/jwt-cpp/jwt.h: In static member function 'static std::string jwt::verify_ops::insensitive_string_claim<json_traits, in_header>::to_lower_unicode(const string&, const std::locale&)':
/data/src/cli/../common/jwt-cpp/jwt.h:3037:5: error: 'wstring_convert' is not a member of 'std'
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> conv;
^
/data/src/cli/../common/jwt-cpp/jwt.h:3037:26: error: 'codecvt_utf8' is not a member of 'std'
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> conv;
^
/data/src/cli/../common/jwt-cpp/jwt.h:3037:44: error: expected primary-expression before 'wchar_t'
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> conv;
^
/data/src/cli/../common/jwt-cpp/jwt.h:3037:44: error: expected ';' before 'wchar_t'
/data/src/cli/../common/jwt-cpp/jwt.h:3038:17: error: 'conv' was not declared in this scope
auto wide = conv.from_bytes(str);
^
make[2]: *** [src/cli/CMakeFiles/appc.dir/ArgumentParser.cpp.o] Error 1
JWT-CPP requires at least C++11 (that's ten year old) so I am not surprised gcc 4.8 fails... 🤔 not sure what to do here.
AFAIK codecvt is only used to convert between lower/upper-case strings to provide case insensitive matching. We could fall back to std::tolower with the caveat that it might not match correctly for characters outside the ascii range. For most people this is probably fine though. Maybe add a define JWT_NO_UTF8 to make clear that we don't support utf8 in that case ?
This still wouldn't lift the requirement for C++11, because we use lambdas and auto quite extensively, but it might help in cases where the compiler supports c++11 good enough, but the STL doesn't (like this one).
Thanks so much, I would usestd::tolower(str, loc) with #if __cplusplus > 201103L to handle the build issue in laoshanxi/app-mesh which should good enough for now to support build compatibility.
Seem like every new year we break support for this compiler #118 😆
anyway, gcc4.8.5 is not so important.
Seem like every new year we break support for this compiler #118 laughing
Maybe we should consider adding a "laoshanxi Test" to the CI ? ;)
Seem like every new year we break support for this compiler #118 laughing
Maybe we should consider adding a "laoshanxi Test" to the CI ? ;)
good idea, I rely heavily on jwt-cpp😊 . and I am learning integration Github Action to do more CI/CD.
We definitely need one of those tests!
We definitely need one of those tests!
So I finally got one to work... but I am not sure how long it will last

https://github.com/actions/runner-images/issues/6002
To raise awareness of the upcoming removal, we will temporarily fail jobs using Ubuntu 18.04.