google-deepmind / code_contests

Apache License 2.0
2.07k stars 203 forks source link

Bazel run error on Ubuntu16.04 #11

Closed Leah-LJX closed 2 years ago

Leah-LJX commented 2 years ago

python 3.6 gcc 9.4 bazel 5.0 ERROR:/root/.cache/bazel/_bazel_root/6675997dee4e0376c54aabebada3b948/external/com_google_absl/absl/types/BUILD.bazel:153:11: Compiling absl/types/bad_optional_access.cc failed: (Exit 1): clang-11 failed: error executing command I followed the instruction of the readme, and run the command "bazel run -c opt :print_names_and_sources ../dm-code_contestscode_contests_valid.riegeli --verbose_failures". The details is in the following picture error-gcc-9

Actually, I have changed the gcc version from gcc-7 to gcc-9, as it occurred the "ERROR: /root/.cache/bazel/_bazel_root/51fbc34d3ea9958886586d668dbcdf68/external/snappy/BUILD.bazel:5:11: Compiling snappy-stubs-internal.cc failed: (Exit 1): gcc failed: error executing command" when executing the "bazel run...". error-gcc7

And my first tries on the Windows system, it also cannot run sucessfully. (Windows 10, Python 3.6, Microsoft Visual Studio Community 2019, Bazel 6.0.0 and msys) Here is the error. error-windows

I hope that someone could help me. I have try many times. Is there any way to run successfully?

jtkeeling commented 2 years ago

Looking at the first error, it looks like you're attempting to use libstdc++ 5.4.0, which is pretty old and doesn't support c++17. (Indeed, this makes sense, seeing as Ubuntu 16.04 was released the year before.)

So you probably need to update Ubuntu, but you might also try passing -stdlib=libc++ as described here: https://libcxx.llvm.org/UsingLibcxx.html#using-libc-when-it-is-not-the-system-default

You could do this by adding build --cxxopt="-stdlib=libc++" to .bazelrc.

Leah-LJX commented 2 years ago

Thanks for your reply. I have tried to use Ubuntu 20.04, and it builds successfully now.