libp2p / libp2p/cpp-libp2p

Configuration fails while compiling BoringSSL

Open
#347 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
492
Forks
130
PR merge metrics
No merged PRs in 30d

Description

Summary

Cmake fails to configure the build (GCC 15.2) due to a compilation error during BoringSSL:

make[3]: warning: -j8 forced in submake: resetting jobserver mode.
In file included from /xxx/.hunter/_Base/15ca502/2341084/9613f97/Build/BoringSSL/Source/crypto/fipsmodule/bcm.c:31:
/xxx/.hunter/_Base/15ca502/2341084/9613f97/Build/BoringSSL/Source/crypto/fipsmodule/../internal.h: In function ‘OPENSSL_memchr’:
/xxx/.hunter/_Base/15ca502/2341084/9613f97/Build/BoringSSL/Source/crypto/fipsmodule/../internal.h:1027:10: error: return discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
 1027 |   return memchr(s, c, n);
      |          ^~~~~~
cc1: all warnings being treated as errors
make[5]: *** [CMakeFiles/fipsmodule.dir/build.make:79: CMakeFiles/fipsmodule.dir/crypto/fipsmodule/bcm.c.o] Error 1

This is GCC 15.2.1, which defaults to gnu23, which imposes memchr() and others should return const pointers when passed arguments are const -- then compilation fails due to -Werror.

Expected behavior

The project would configure without problems.

Actual behavior

The project doesn't configure properly.

Relevant log output
make[3]: warning: -j8 forced in submake: resetting jobserver mode.
In file included from /xxx/.hunter/_Base/15ca502/2341084/9613f97/Build/BoringSSL/Source/crypto/fipsmodule/bcm.c:31:
/xxx/.hunter/_Base/15ca502/2341084/9613f97/Build/BoringSSL/Source/crypto/fipsmodule/../internal.h: In function ‘OPENSSL_memchr’:
/xxx/.hunter/_Base/15ca502/2341084/9613f97/Build/BoringSSL/Source/crypto/fipsmodule/../internal.h:1027:10: error: return discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
 1027 |   return memchr(s, c, n);
      |          ^~~~~~
cc1: all warnings being treated as errors
make[5]: *** [CMakeFiles/fipsmodule.dir/build.make:79: CMakeFiles/fipsmodule.dir/crypto/fipsmodule/bcm.c.o] Error 1
Possible Solution

The proper solution is BoringSSL upstream fixing their codebase to C23; or upstream properly setting -std=c17 or whatever they're using; or simply removing -Werror=discarded-qualifiers.

A workaround is to set -Wno-error=discarded-qualifiers during the build of this particular dependency, but I'm not sure how to do it with this Hunter thing. Any help is appreciated.

Version

v0.1.37

Would you like to work on fixing this bug ?

Maybe

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the CMake configuration with GCC 15.2.1 and inspect how Hunter builds the BoringSSL dependency, especially the reported internal.h failure and warning flags. Done means the project configures successfully without the discarded-qualifiers error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.