google / differential-privacy

Google's differential privacy libraries.
Apache License 2.0
3.09k stars 353 forks source link

Build failure on Arch Linux #67

Closed shpark closed 3 years ago

shpark commented 3 years ago

I've followed build instructions, and encountered a build failure.

~/differential-privacy/cc main ❯ bazel build "..."                                                            13:08:04
INFO: Analyzed 57 targets (58 packages loaded, 7301 targets configured).
INFO: Found 57 targets...
INFO: From Compiling com_google_protobuf/src/google/protobuf/generated_message_reflection.cc [for host]:
external/com_google_protobuf/src/google/protobuf/generated_message_reflection.cc: In member function 'void google::protobuf::Reflection::SwapOneofField(google::protobuf::Message*, google::protobuf::Message*, const google::protobuf::OneofDescriptor*) const':
external/com_google_protobuf/src/google/protobuf/generated_message_reflection.cc:2131:37: warning: 'temp_float' may be used uninitialized in this function [-Wmaybe-uninitialized]
 2131 |   *MutableRaw<Type>(message, field) = value;
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
external/com_google_protobuf/src/google/protobuf/generated_message_reflection.cc:494:9: note: 'temp_float' was declared here
  494 |   float temp_float;
      |         ^~~~~~~~~~
external/com_google_protobuf/src/google/protobuf/generated_message_reflection.cc:2131:37: warning: 'temp_uint64' may be used uninitialized in this function [-Wmaybe-uninitialized]
 2131 |   *MutableRaw<Type>(message, field) = value;
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
external/com_google_protobuf/src/google/protobuf/generated_message_reflection.cc:493:10: note: 'temp_uint64' was declared here
  493 |   uint64 temp_uint64;
      |          ^~~~~~~~~~~
external/com_google_protobuf/src/google/protobuf/generated_message_reflection.cc:2131:37: warning: 'temp_uint32' may be used uninitialized in this function [-Wmaybe-uninitialized]
 2131 |   *MutableRaw<Type>(message, field) = value;
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
external/com_google_protobuf/src/google/protobuf/generated_message_reflection.cc:492:10: note: 'temp_uint32' was declared here
  492 |   uint32 temp_uint32;
      |          ^~~~~~~~~~~
external/com_google_protobuf/src/google/protobuf/generated_message_reflection.cc:2131:37: warning: 'temp_int64' may be used uninitialized in this function [-Wmaybe-uninitialized]
 2131 |   *MutableRaw<Type>(message, field) = value;
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
external/com_google_protobuf/src/google/protobuf/generated_message_reflection.cc:491:9: note: 'temp_int64' was declared here
  491 |   int64 temp_int64;
      |         ^~~~~~~~~~
ERROR: /home/shpark/differential-privacy/cc/algorithms/BUILD:294:11: C++ compilation of rule '//algorithms:util' failed (Exit 1): gcc failed: error executing command /opt/cuda/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 22 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox gcc failed: error executing command /opt/cuda/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 22 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
algorithms/util.cc: In function 'absl::lts_2020_09_23::Status differential_privacy::ValidateIsSet(std::optional<double>, absl::lts_2020_09_23::string_view, absl::lts_2020_09_23::StatusCode)':
algorithms/util.cc:125:7: error: 'isnan' was not declared in this scope; did you mean 'std::isnan'?
  125 |   if (isnan(d)) {
      |       ^~~~~
      |       std::isnan
In file included from ./algorithms/util.h:21,
                 from algorithms/util.cc:17:
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/cmath:632:5: note: 'std::isnan' declared here
  632 |     isnan(_Tp __x)
      |     ^~~~~
INFO: Elapsed time: 100.222s, Critical Path: 18.31s
INFO: 595 processes: 107 internal, 488 linux-sandbox.
FAILED: Build did NOT complete successfully

GCC version is 10.2.0, and bazel version is 3.7.0.

After replacing isnan with std::isnan, build succeeded without problems.

dibakch commented 3 years ago

Thanks for reporting! :)

This is already fixed in #65, which is about to be merged (takes a bit longer as usual due to the holiday season).