google / riegeli

Riegeli/records is a file format for storing a sequence of string records, typically serialized protocol buffers.
Apache License 2.0
418 stars 53 forks source link

Build error: clang w/ c++17 #13

Closed blais closed 4 years ago

blais commented 4 years ago

Hi, I'm having a build error on C++17 w/ Clang:

cd ~/p/beancount/ && bazel build //experiments/v3/serialization/...
Loading:
Loading: 0 packages loaded
Analyzing: target //experiments/v3/serialization:riegeli_print (0 packages loaded, 0 targets configured)
INFO: Analyzed target //experiments/v3/serialization:riegeli_print (10 packages loaded, 267 targets configured).
INFO: Found 1 target...
bazel: Entering directory `/home/blais/.cache/bazel/_bazel_blais/7d265136e440aae0298519930a834a34/execroot/beancount/'
[22 / 514] [Prepa] BazelWorkspaceStatusAction stable-status.txt
[397 / 601] Compiling experiments/v3/serialization/riegeli_print.cc; 1s linux-sandbox ... (4 actions running)
[406 / 605] Compiling experiments/v3/serialization/riegeli_print.cc; 3s linux-sandbox ... (4 actions running)
[413 / 607] Compiling external/com_google_riegeli/riegeli/bytes/brotli_reader.cc; 2s linux-sandbox ... (4 actions, 3 running)
ERROR: /home/blais/.cache/bazel/_bazel_blais/7d265136e440aae0298519930a834a34/external/com_google_riegeli/riegeli/base/BUILD:76:11: C++ compilation of rule '@com_google_riegeli//riegeli/base:buffer' failed (Exit 1) clang failed: error executing command /usr/bin/clang -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 21 \
argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
In file included from external/com_google_riegeli/riegeli/base/buffer.cc:15:
external/com_google_riegeli/riegeli/base/buffer.h:99:25: error: no matching function for call to 'operator delete'
  if (data_ != nullptr) operator delete(data_, size_);
                        ^~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/new:174:13: note: candidate function not viable: no known conversion from 'size_t' (aka 'unsigned long') to 'void *' for 2nd argument; take the address of the argument with &
inline void operator delete  (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
            ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/new:138:6: note: candidate function not viable: no known conversion from 'size_t' (aka 'unsigned long') to 'const std::nothrow_t' for 2nd argument
void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
     ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/new:147:6: note: candidate function not viable: no known conversion from 'size_t' (aka 'unsigned long') to 'std::align_val_t' for 2nd argument
void operator delete(void*, std::align_val_t)
     ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/new:124:6: note: candidate function not viable: requires 1 argument, but 2 were provided
void operator delete(void*) _GLIBCXX_USE_NOEXCEPT
     ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/new:149:6: note: candidate function not viable: requires 3 arguments, but 2 were provided
void operator delete(void*, std::align_val_t, const std::nothrow_t&)
     ^
1 error generated.
bazel: Leaving directory `/home/blais/.cache/bazel/_bazel_blais/7d265136e440aae0298519930a834a34/execroot/beancount/'
Target //experiments/v3/serialization:riegeli_print failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 6.382s, Critical Path: 4.36s
INFO: 6 processes: 6 linux-sandbox.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

To reproduce:

git checkout https://github.com/beancount/beancount
cd beancount
bazel build //experiments/v3/serialization/...

Note: compiler and std is set in beancount/.bazelrc.

Thank you for open sourcing Riegeli!

blais commented 4 years ago

This is related to this: https://github.com/pybind/pybind11/issues/1604

Adding -fsized-deallocation to clang flags may be the solution.

blais commented 4 years ago

That works. I think you may want to change the code instead though.

QrczakMK commented 4 years ago

I am sorry, I missed this email.

A fix is on the way.