Skip to content

Fails to build on Arch Linux without -Wno-discarded-qualifiers #2995

Closed

Description

@5long

Problem:

Fail to build on Arch Linux without -Wno-discarded-qualifiers.

With the extra cflag above it can build successfully. But I'm not sure if I should suppress the warning blindly.

A rough Googling shows that -Wno-discarded-qualifiers was introduced in GCC 5 which is released roughly 10 years ago. I believe that ruled out Arch Linux being too bleeding edge... Or maybe it is?

Relevant details

AWS-LC commit: 728811e tagged v1.66.2

System information:

  • CPU architecture: x86-64
  • CPU name: AMD Ryzen 7 5800X
  • OS: Arch Linux
  • C Compiler: gcc 15.2.1 but I believe Arch Linux ships commit=0b99615a8aef011cff76c6caa8c09434f46598b3, not a tagged release. See gcc package in Arch

Build log:
See the gist: https://gist.github.com/5long/be83f0b1ac35b88129ca2dd3228c0c1a

Activity

  1. edmundlod commented on Feb 15, 2026

    @edmundlod
    Contributor

    Reproducible:

    [174/673] Building C object crypto/CMakeFiles/crypto_objects.dir/rand_extra/urandom.c.o
    FAILED: [code=1] crypto/CMakeFiles/crypto_objects.dir/rand_extra/urandom.c.o 
    /usr/bin/clang -DBORINGSSL_HAVE_LIBUNWIND -DBORINGSSL_IMPLEMENTATION -DBORINGSSL_RELEASE_BUILD -I/var/tmp/makepkg/aws-lc/src/aws-lc-1.67.0/build/symbol_prefix_include -I/var/tmp/makepkg/aws-lc/src/aws-lc-1.67.0/include -march=native -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection=full         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/var/tmp/makepkg/aws-lc/src=/usr/src/debug/aws-lc  -flto=auto -Wextra -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow -Wwrite-strings -Wformat-security -Wunused-result -Wno-overlength-strings -Wno-cast-function-type  -Wall -fvisibility=hidden -fno-common -Wno-c11-extensions -Wvla -Wtype-limits -Wno-unused-parameter -Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings -Wnewline-eof -fcolor-diagnostics -Wstring-concatenation -Wimplicit-fallthrough -Wmissing-prototypes -Wold-style-definition -Wstrict-prototypes -DHAVE_LINUX_RANDOM_H -DAWS_LC_STDALIGN_AVAILABLE -DAWS_LC_BUILTIN_SWAP_SUPPORTED -D_XOPEN_SOURCE=700 -O3  -std=gnu11 -fPIC -MD -MT crypto/CMakeFiles/crypto_objects.dir/rand_extra/urandom.c.o -MF crypto/CMakeFiles/crypto_objects.dir/rand_extra/urandom.c.o.d -o crypto/CMakeFiles/crypto_objects.dir/rand_extra/urandom.c.o -c /var/tmp/makepkg/aws-lc/src/aws-lc-1.67.0/crypto/rand_extra/urandom.c
    In file included from /var/tmp/makepkg/aws-lc/src/aws-lc-1.67.0/crypto/rand_extra/urandom.c:70:
    /var/tmp/makepkg/aws-lc/src/aws-lc-1.67.0/crypto/rand_extra/../internal.h:939:10: error: returning 'const void *' from a function with result type 'void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
      939 |   return memchr(s, c, n);
          |          ^~~~~~~~~~~~~~~
    /usr/include/string.h:122:3: note: expanded from macro 'memchr'
      122 |   __glibc_const_generic (S, const void *, memchr (S, C, N))
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/sys/cdefs.h:838:3: note: expanded from macro '__glibc_const_generic'
      838 |   _Generic (0 ? (PTR) : (void *) 1,                     \
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      839 |             const void *: (CTYPE) (CALL),               \
          |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      840 |             default: CALL)
          |             ~~~~~~~~~~~~~~
    1 error generated.
    

    Not sure if correct, but fixed with:

    sed -i 's/return memchr(s, c, n);/return (void *)memchr(s, c, n);/' crypto/internal.h
    
  2. Ra2-IFV commented on Feb 15, 2026

    @Ra2-IFV

    Also:
    cc1plus: note: unrecognized command-line option ‘-Wno-c11-extensions’ may have been intended to silence earlier diagnostics

  3. edmundlod commented on Feb 16, 2026

    @edmundlod
    Contributor

    Also: cc1plus: note: unrecognized command-line option ‘-Wno-c11-extensions’ may have been intended to silence earlier diagnostics

    -Wno-c11-extensions is unrecognized by GCC (it's a Clang flag). This doesn't cause failure but indicates the build system expects Clang. If you're building with GCC, this is expected noise.

    Anyway, it's a different issue and you might want to dive a bit deeper (or open a new issue?) to find out why there is a Clang flag in a GCC build environment. Could be hard-coded, could be in the build environment.

  4. Ra2-IFV commented on Feb 16, 2026

    @Ra2-IFV

    Here

    aws-lc/CMakeLists.txt

    Lines 500 to 510 in 36c64dc

    else()
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra")
    set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wall -fvisibility=hidden -fno-common")
    if(CLANG AND MINGW)
    set(C_CXX_FLAGS "${C_CXX_FLAGS} -fms-extensions")
    endif()
    set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wno-newline-eof")
    endif()
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wwrite-strings -Wformat-security -Wunused-result -Wno-overlength-strings")
    set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-c11-extensions -Wvla -Wtype-limits -Wno-unused-parameter")

    I don't remember I have this warning in my last build, lol

  5. Ra2-IFV commented on Feb 18, 2026

    @Ra2-IFV
  6. justsmth commented on Feb 18, 2026

    @justsmth
    Contributor

    Hello! Sorry, I hadn't noticed this Issue sooner. I'm taking a look.

  7. justsmth commented on Feb 18, 2026

    @justsmth
    Contributor

    I posted a PR that I think will address this build failure: #3008

  8. added a commit that references this issue on Feb 19, 2026
    390b9c0
  9. 5long commented on Feb 21, 2026

    @5long
    Author

    @justsmth big thanks for the timely fix!

  10. added 3 commits that reference this issue on Mar 27, 2026
  11. added a commit that references this issue on Apr 6, 2026
  12. added a commit that references this issue on May 26, 2026
  13. added a commit that references this issue on Jun 10, 2026
    81ad0b3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions