apache / incubator-pagespeed-mod

Apache module for rewriting web pages to reduce latency and bandwidth.
http://modpagespeed.com
Apache License 2.0
693 stars 157 forks source link

Invalid conversion compilation errors with GCC 7 #1568

Open rombert opened 7 years ago

rombert commented 7 years ago

I'm getting the following compilation errors on openSUSE Tumbleewed.

$ c++ -v
Using built-in specs.
COLLECT_GCC=c++
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/7/lto-wrapper
OFFLOAD_TARGET_NAMES=hsa:nvptx-none
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,ada,go --enable-offload-targets=hsa,nvptx-none=/usr/nvptx-none, --without-cuda-driver --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/7 --enable-ssp --disable-libssp --disable-libvtv --disable-libcc1 --enable-plugin --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-7 --without-system-libunwind --enable-multilib --with-arch-32=x86-64 --with-tune=generic --build=x86_64-suse-linux --host=x86_64-suse-linux
Thread model: posix
gcc version 7.1.1 20170530 [gcc-7-branch revision 248621] (SUSE Linux) 
[  119s]   CXX(target) out/Release/obj.target/url_lib/url/url_canon_icu.o
[  119s]   CXX(target) out/Release/obj.target/url_lib/third_party/chromium/src/googleurl/src/url_canon_internal.o
[  119s]   CXX(target) out/Release/obj.target/url_lib/third_party/chromium/src/googleurl/src/url_canon_ip.o
[  119s]   CXX(target) out/Release/obj.target/url_lib/third_party/chromium/src/googleurl/src/url_canon_mailtourl.o
[  119s]   CXX(target) out/Release/obj.target/url_lib/third_party/chromium/src/googleurl/src/url_canon_path.o
[  119s]   CXX(target) out/Release/obj.target/url_lib/third_party/chromium/src/googleurl/src/url_canon_pathurl.o
[  119s] url/url_canon_icu.cc: In member function 'virtual void url_canon::ICUCharsetConverter::ConvertFromUTF16(const char16*, int, url_canon::CanonOutput*)':
[  119s] url/url_canon_icu.cc:133:67: error: invalid conversion from 'const char16* {aka const short unsigned int*}' to 'const UChar* {aka const char16_t*}' [-fpermissive]
[  119s]                                              input, input_len, &err);
[  119s]                                                                    ^
[  119s] In file included from /usr/include/unicode/platform.h:25:0,
[  119s]                  from /usr/include/unicode/ptypes.h:52,
[  119s]                  from /usr/include/unicode/umachine.h:46,
[  119s]                  from /usr/include/unicode/utypes.h:38,
[  119s]                  from /usr/include/unicode/ucnv_err.h:88,
[  119s]                  from ./third_party/icu/source/common/unicode/ucnv.h:50,
[  119s]                  from url/url_canon_icu.cc:12:
[  119s] ./third_party/icu/source/common/unicode/ucnv.h:1197:1: note:   initializing argument 4 of 'int32_t ucnv_fromUChars_59_1(UConverter*, char*, int32_t, const UChar*, int32_t, UErrorCode*)'
[  119s]  ucnv_fromUChars(UConverter *cnv,
[  119s]  ^
[  119s] url/url_canon_icu.cc: In function 'bool url_canon::IDNToASCII(const char16*, int, url_canon::CanonOutputW*)':
[  119s] url/url_canon_icu.cc:173:74: error: invalid conversion from 'const char16* {aka const short unsigned int*}' to 'const UChar* {aka const char16_t*}' [-fpermissive]
[  119s]                                            output->capacity(), &info, &err);
[  119s]                                                                           ^
[  119s] In file included from /usr/include/unicode/platform.h:25:0,
[  119s]                  from /usr/include/unicode/ptypes.h:52,
[  119s]                  from /usr/include/unicode/umachine.h:46,
[  119s]                  from /usr/include/unicode/utypes.h:38,
[  119s]                  from /usr/include/unicode/ucnv_err.h:88,
[  119s]                  from ./third_party/icu/source/common/unicode/ucnv.h:50,
[  119s]                  from url/url_canon_icu.cc:12:
[  119s] ./third_party/icu/source/common/unicode/uidna.h:268:1: note:   initializing argument 2 of 'int32_t uidna_nameToASCII_59_1(const UIDNA*, const UChar*, int32_t, UChar*, int32_t, UIDNAInfo*, UErrorCode*)'
[  119s]  uidna_nameToASCII(const UIDNA *idna,
[  119s]  ^
[  119s] url/url_canon_icu.cc:172:76: error: invalid conversion from 'short unsigned int*' to 'UChar* {aka char16_t*}' [-fpermissive]
[  119s]      int output_length = uidna_nameToASCII(uidna, src, src_len, output->data(),
[  119s]                                                                 ~~~~~~~~~~~~^~
[  119s] In file included from /usr/include/unicode/platform.h:25:0,
[  119s]                  from /usr/include/unicode/ptypes.h:52,
[  119s]                  from /usr/include/unicode/umachine.h:46,
[  119s]                  from /usr/include/unicode/utypes.h:38,
[  119s]                  from /usr/include/unicode/ucnv_err.h:88,
[  119s]                  from ./third_party/icu/source/common/unicode/ucnv.h:50,
[  119s]                  from url/url_canon_icu.cc:12:
[  119s] ./third_party/icu/source/common/unicode/uidna.h:268:1: note:   initializing argument 4 of 'int32_t uidna_nameToASCII_59_1(const UIDNA*, const UChar*, int32_t, UChar*, int32_t, UIDNAInfo*, UErrorCode*)'
[  119s]  uidna_nameToASCII(const UIDNA *idna,
[  119s]  ^
[  119s] make: *** [url/url_lib.target.mk:332: out/Release/obj.target/url_lib/url/url_canon_icu.o] Error 1
[  119s] make: *** Waiting for unfinished jobs....
[  120s] error: Bad exit status from /var/tmp/rpm-tmp.vOXRvX (%build)
[  120s] 
[  120s] 
[  120s] RPM build errors:
[  120s]     Bad exit status from /var/tmp/rpm-tmp.vOXRvX (%build)
morlovich commented 7 years ago

ICU's headers have some helpful context: https://cs.chromium.org/chromium/src/third_party/icu/source/common/unicode/umachine.h?rcl=dfa798fe694702b43a3debc3290761f22b1acaf8&l=308

It may be reasonable to set -DUCHAR_TYPE=uint16_t, perhaps?

rombert commented 7 years ago

I'm using the system icu for compilation: -Duse_system_icu=1 -Duse_system_libs=1, not sure if that would affect the result.

My system has libicu59_1-59.1-1.1 installed