Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling nghttp2 with GCC 14 fails #2195

Open
Kartatz opened this issue May 13, 2024 · 2 comments
Open

Compiling nghttp2 with GCC 14 fails #2195

Kartatz opened this issue May 13, 2024 · 2 comments

Comments

@Kartatz
Copy link

Kartatz commented May 13, 2024

I'm cross-compiling nghttp2 for FreeBSD 14 (riscv64) using GCC 14. It used to compile just fine with GCC 13, but now it's failing with GCC 14:

$ cmake \
    -DCMAKE_BUILD_TYPE=MinSizeRel \
    -DENABLE_LIB_ONLY=ON \
    -B build \
    ./
-- The CXX compiler identification is GNU 14.1.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /tmp/loki/bin/riscv64-unknown-freebsd14.0-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python3: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter
-- Found OpenSSL: /tmp/loki/riscv64-unknown-freebsd14.0/lib/libcrypto.so (found suitable version "3.0.13", minimum required is "1.1.1")
-- Could NOT find Libngtcp2 (missing: LIBNGTCP2_LIBRARY LIBNGTCP2_INCLUDE_DIR) (Required is at least version "1.0.0")
-- Could NOT find Libngtcp2_crypto_quictls (missing: LIBNGTCP2_CRYPTO_QUICTLS_LIBRARY LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIR) (Required is at least version "1.0.0")
-- Could NOT find Libnghttp3 (missing: LIBNGHTTP3_LIBRARY LIBNGHTTP3_INCLUDE_DIR) (Required is at least version "1.1.0")
-- Could NOT find Systemd (missing: SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES) (Required is at least version "209")
-- Could NOT find Jansson (missing: JANSSON_LIBRARY JANSSON_INCLUDE_DIR) (Required is at least version "2.5")
-- Could NOT find Libevent (missing: LIBEVENT_CORE_LIBRARY LIBEVENT_EXTRA_LIBRARY LIBEVENT_OPENSSL_LIBRARY LIBEVENT_INCLUDE_DIR core extra openssl) (Required is at least version "2.0.8")
-- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) (Required is at least version "2.6.26")
-- Could NOT find Jemalloc (missing: JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR) 
-- Performing Test CXX_FLAG__std_c_20
-- Performing Test CXX_FLAG__std_c_20 - Success
-- Performing Test HAVE_STD_FUTURE
-- Performing Test HAVE_STD_FUTURE - Success
-- Performing Test HAVE_STD_MAP_EMPLACE
-- Performing Test HAVE_STD_MAP_EMPLACE - Success
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for limits.h
-- Looking for limits.h - found
-- Looking for netinet/ip.h
-- Looking for netinet/ip.h - not found
-- Looking for syslog.h
-- Looking for syslog.h - found
-- Looking for windows.h
-- Looking for windows.h - not found
-- Performing Test HAVE_STRUCT_TM_TM_GMTOFF
-- Performing Test HAVE_STRUCT_TM_TM_GMTOFF - Success
-- Looking for _Exit
-- Looking for _Exit - found
-- Looking for accept4
-- Looking for accept4 - found
-- Looking for clock_gettime
-- Looking for clock_gettime - found
-- Looking for mkostemp
-- Looking for mkostemp - found
-- Looking for GetTickCount64
-- Looking for GetTickCount64 - not found
-- Looking for initgroups
-- Looking for initgroups - not found
-- Looking for initgroups
-- Looking for initgroups - found
-- Looking for CLOCK_MONOTONIC
-- Looking for CLOCK_MONOTONIC - found
-- Performing Test OPT_Wpragmas
-- Performing Test OPT_Wpragmas - Success
-- summary of build options:
    Package version: 1.62.90
    Library version: 42:1:28
    Install prefix:  /home/kartz/nghttp2/build/riscv64-unknown-freebsd
    Target system:   FreeBSD
    Compiler:
      Build type:     MinSizeRel
      C compiler:     /tmp/loki/bin/riscv64-unknown-freebsd14.0-gcc
      CFLAGS:         -Os  
      C++ compiler:   /tmp/loki/bin/riscv64-unknown-freebsd14.0-g++
      CXXFLAGS:       -Os  
      WARNCFLAGS:       -W -Wall -Wconversion -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wshadow -Wundef -Wwrite-strings -Waddress -Wattributes -Wcast-align -Wdeclaration-after-statement -Wdiv-by-zero -Wempty-body -Wendif-labels -Wfloat-equal -Wformat-nonliteral -Wformat-security -Wmissing-field-initializers -Wmissing-noreturn -Wno-format-nonliteral -Wredundant-decls -Wsign-conversion -Wstrict-prototypes -Wunreachable-code -Wunused-parameter -Wvla -Wclobbered -Wpragmas
      CXX1XCXXFLAGS:  -std=c++20
      WARNCXXFLAGS:     -Wall -Wformat-security
    Python:
      Python:          /usr/bin/python3.10
      Python3_VERSION: 3.10.12
    Test:
      Failmalloc:     ON
      Build Test:     OFF
    Libs:
      OpenSSL:        TRUE (LIBS='/tmp/loki/riscv64-unknown-freebsd14.0/lib/libssl.so;/tmp/loki/riscv64-unknown-freebsd14.0/lib/libcrypto.so')
      Libxml2:        FALSE (LIBS='')
      Libev:           (LIBS='')
      Libc-ares:       (LIBS='')
      Libngtcp2:       (LIBS='')
      Libngtcp2_crypto_quictls:  (LIBS='')
      Libnghttp3:      (LIBS='')
      Libbpf:          (LIBS='')
      Libevent(SSL):  FALSE (LIBS='')
      Jansson:        FALSE (LIBS='')
      Jemalloc:       FALSE (LIBS='')
      Zlib:            (LIBS='')
      Systemd:        FALSE (LIBS='SYSTEMD_LIBRARIES-NOTFOUND')
      Libbrotlienc:    (LIBS='')
-- Configuring FFmpeg
      Libbrotlidec:    (LIBS='')
    Third-party:
      http-parser:    
      MRuby:          0
      Neverbleed:     0
    Features:
      Applications:   OFF
      HPACK tools:    OFF
      Examples:       OFF
      Threading:      ON
      HTTP/3(EXPERIMENTAL): OFF
-- Configuring done (24.9s)
-- Generating done (0.7s)
-- Build files have been written to: /home/kartz/nghttp2/build
$ cmake --build ./
/home/kartz/nghttp2/lib/nghttp2_helper.c: In function ‘nghttp2_put_uint16be’:
/home/kartz/nghttp2/lib/nghttp2_helper.c:33:16: error: implicit declaration of function ‘htons’ [-Wimplicit-function-declaration]
   33 |   uint16_t x = htons(n);
      |                ^~~~~
/home/kartz/nghttp2/lib/nghttp2_helper.c:33:16: warning: nested extern declaration of ‘htons’ [-Wnested-externs]
/home/kartz/nghttp2/lib/nghttp2_helper.c:33:16: warning: conversion from ‘int’ to ‘uint16_t’ {aka ‘short unsigned int’} may change value [-Wconversion]
/home/kartz/nghttp2/lib/nghttp2_helper.c: In function ‘nghttp2_put_uint32be’:
/home/kartz/nghttp2/lib/nghttp2_helper.c:38:16: error: implicit declaration of function ‘htonl’ [-Wimplicit-function-declaration]
   38 |   uint32_t x = htonl(n);
      |                ^~~~~
/home/kartz/nghttp2/lib/nghttp2_helper.c:38:16: warning: nested extern declaration of ‘htonl’ [-Wnested-externs]
/home/kartz/nghttp2/lib/nghttp2_helper.c:38:16: warning: conversion to ‘uint32_t’ {aka ‘unsigned int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
/home/kartz/nghttp2/lib/nghttp2_helper.c: In function ‘nghttp2_get_uint16’:
/home/kartz/nghttp2/lib/nghttp2_helper.c:45:10: error: implicit declaration of function ‘ntohs’ [-Wimplicit-function-declaration]
   45 |   return ntohs(n);
      |          ^~~~~
/home/kartz/nghttp2/lib/nghttp2_helper.c:45:10: warning: nested extern declaration of ‘ntohs’ [-Wnested-externs]
/home/kartz/nghttp2/lib/nghttp2_helper.c:45:10: warning: conversion from ‘int’ to ‘uint16_t’ {aka ‘short unsigned int’} may change value [-Wconversion]
   45 |   return ntohs(n);
      |          ^~~~~~~~
/home/kartz/nghttp2/lib/nghttp2_helper.c: In function ‘nghttp2_get_uint32’:
/home/kartz/nghttp2/lib/nghttp2_helper.c:51:10: error: implicit declaration of function ‘ntohl’ [-Wimplicit-function-declaration]
   51 |   return ntohl(n);
      |          ^~~~~
/home/kartz/nghttp2/lib/nghttp2_helper.c:51:10: warning: nested extern declaration of ‘ntohl’ [-Wnested-externs]
/home/kartz/nghttp2/lib/nghttp2_helper.c:51:10: warning: conversion to ‘uint32_t’ {aka ‘unsigned int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
   51 |   return ntohl(n);
      |          ^~~~~~~~
gmake[2]: *** [nghttp2/lib/CMakeFiles/nghttp2.dir/build.make:202: nghttp2/lib/CMakeFiles/nghttp2.dir/nghttp2_helper.c.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
/home/kartz/nghttp2/lib/nghttp2_hd_huffman.c: In function ‘nghttp2_hd_huff_encode’:
/home/kartz/nghttp2/lib/nghttp2_hd_huffman.c:65:11: error: implicit declaration of function ‘htonl’ [-Wimplicit-function-declaration]
   65 |       x = htonl((uint32_t)(code >> 32));
      |           ^~~~~
/home/kartz/nghttp2/lib/nghttp2_hd_huffman.c:65:11: warning: nested extern declaration of ‘htonl’ [-Wnested-externs]
/home/kartz/nghttp2/lib/nghttp2_hd_huffman.c:65:11: warning: conversion to ‘uint32_t’ {aka ‘unsigned int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
gmake[2]: *** [nghttp2/lib/CMakeFiles/nghttp2.dir/build.make:244: nghttp2/lib/CMakeFiles/nghttp2.dir/nghttp2_hd_huffman.c.o] Error 1

I'm on latest master (20d21b2).

@tatsuhiro-t
Copy link
Member

I have not tried compiling nghttp2 with gcc-14. This might be another picky gcc behavior, which may be good for us.

@tatsuhiro-t
Copy link
Member

It looks like your cmake does not fully check header files, arpa/inet.h in particular.
I have no idea why. Maybe your CMakeList.txt is corrupted or edited or cmake is broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants