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

Unable to build v30.0 on debian-12 with clang-16 #20645

Open
damageboy opened this issue Mar 11, 2025 · 0 comments
Open

Unable to build v30.0 on debian-12 with clang-16 #20645

damageboy opened this issue Mar 11, 2025 · 0 comments
Labels
untriaged auto added to all issues by default when created.

Comments

@damageboy
Copy link

When building on debian-12 with clang-16, I get the following error:

FAILED: _deps/protobuf-build/CMakeFiles/libprotobuf-lite.dir/src/google/protobuf/port.cc.o
/usr/bin/clang++-16 -DGOOGLE_PROTOBUF_CMAKE_BUILD -DHAVE_ZLIB -DTEST_DATA_DIR=\"/home/dmg/projects/nfisim\" -I/home/dmg/projects/nfisim/build/_deps/protobuf-build -I/home/dmg/.cpm/protobuf/6f7442d2c00f7e7355cfa6d430e4c3ea731a9792 -I/home/dmg/projects/nfisim/build/_deps/protobuf-build/src -I/home/dmg/.cpm/protobuf/6f7442d2c00f7e7355cfa6d430e4c3ea731a9792/src -I/home/dmg/.cpm/protobuf/6f7442d2c00f7e7355cfa6d430e4c3ea731a9792/third_party/utf8_range -I/home/dmg/projects/nfisim/build/_deps/absl-src -g -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fconstexpr-steps=1271242 -std=gnu++20 -MD -MT _deps/protobuf-build/CMakeFiles/libprotobuf-lite.dir/src/google/protobuf/port.cc.o -MF _deps/protobuf-build/CMakeFiles/libprotobuf-lite.dir/src/google/protobuf/port.cc.o.d -o _deps/protobuf-build/CMakeFiles/libprotobuf-lite.dir/src/google/protobuf/port.cc.o -c /home/dmg/.cpm/protobuf/6f7442d2c00f7e7355cfa6d430e4c3ea731a9792/src/google/protobuf/port.cc
/home/dmg/.cpm/protobuf/6f7442d2c00f7e7355cfa6d430e4c3ea731a9792/src/google/protobuf/port.cc:102:5: error: variable does not have a constant initializer
    fixed_address_empty_string{};
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dmg/.cpm/protobuf/6f7442d2c00f7e7355cfa6d430e4c3ea731a9792/src/google/protobuf/port.cc:101:31: note: required by 'constinit' specifier here
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT const GlobalEmptyString
                              ^~~~~~~~~~~~~~~~~~
/home/dmg/.cpm/protobuf/6f7442d2c00f7e7355cfa6d430e4c3ea731a9792/src/google/protobuf/port_def.inc:425:30: note: expanded from macro 'PROTOBUF_CONSTINIT'
#  define PROTOBUF_CONSTINIT constinit
                             ^~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/basic_string.h:356:10: note: assignment to member '_M_local_buf' of union with no active member is not allowed in a constant expression
            __c = _CharT();
                ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/basic_string.h:519:2: note: in call to '&fixed_address_empty_string.value_->_M_use_local_data()'
        _M_use_local_data();
        ^
/home/dmg/.cpm/protobuf/6f7442d2c00f7e7355cfa6d430e4c3ea731a9792/src/google/protobuf/port.h:499:18: note: in call to 'basic_string()'
class alignas(8) GlobalEmptyString {
                 ^
/home/dmg/.cpm/protobuf/6f7442d2c00f7e7355cfa6d430e4c3ea731a9792/src/google/protobuf/port.cc:102:5: note: in call to 'GlobalEmptyString()'
    fixed_address_empty_string{};
    ^
1 error generated.
[36/940] Building CXX object _deps/protobuf-build/CMakeFiles/libprotobuf.dir/src/google/protobuf/struct.pb.cc.o

The CXX_STANDARD is set to 20, for reference, and the problem seems to not happen with clang-19,
unfortunately for me, I need this on older clangs as well... is there a way around this issue?

@damageboy damageboy added the untriaged auto added to all issues by default when created. label Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged auto added to all issues by default when created.
Projects
None yet
Development

No branches or pull requests

1 participant