rules_scala icon indicating copy to clipboard operation
rules_scala copied to clipboard

Fix thrid party compilation with gcc 11 or higher

Open Koisell opened this issue 2 years ago • 4 comments

The fix was available

Description

Since gcc 11 some headers are mandatory to build ijar third party.

Motivation

I use fedora 35 and so I have gcc 12 and my code doesn't build anymore.

Koisell avatar Aug 25 '22 12:08 Koisell

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Aug 25 '22 12:08 google-cla[bot]

Hi, @Koisell, thanks for PR.

I see that com_github_bazelbuild_buildtools is used internally for rules_scala and I don't understand how it affects your code. Could you elaborate more?

Are you willing to go over lint failures?

simuons avatar Aug 30 '22 09:08 simuons

While compiling I get

ERROR: /home/nfrancois/.cache/bazel/_bazel_nfrancois/8d37f7d4f97f2686ecd717eabbe802da/external/io_bazel_rules_scala/third_party/java_tools/ijar/BUILD:11:11: Compiling third_party/java_tools/ijar/mapped_file_unix.cc failed: (Exit 1): gcc failed: error executing command
  (cd /home/nfrancois/.cache/bazel/_bazel_nfrancois/8d37f7d4f97f2686ecd717eabbe802da/sandbox/linux-sandbox/29/execroot/platform && \
  exec env - \
    PATH=/bin:/usr/bin:/usr/local/bin \
    PWD=/proc/self/cwd \
  /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/k8-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_scala/third_party/java_tools/ijar/_objs/zip/mapped_file_unix.d '-frandom-seed=bazel-out/k8-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_scala/third_party/java_tools/ijar/_objs/zip/mapped_file_unix.o' -DBLAZE_OPENSOURCE -iquote external/io_bazel_rules_scala -iquote bazel-out/k8-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_scala -isystem external/io_bazel_rules_scala/third_party/java_tools/zlib -isystem bazel-out/k8-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_scala/third_party/java_tools/zlib -g0 -g0 -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/io_bazel_rules_scala/third_party/java_tools/ijar/mapped_file_unix.cc -o bazel-out/k8-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_scala/third_party/java_tools/ijar/_objs/zip/mapped_file_unix.o)
# Configuration: 6c55a82e8ef79ce63c8ee04139fc82a3e92ee5f0f33086df5d05c087b3f7bc28
# Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/io_bazel_rules_scala/third_party/java_tools/ijar/mapped_file_unix.cc: In constructor 'devtools_ijar::MappedOutputFile::MappedOutputFile(const char*, size_t)':
external/io_bazel_rules_scala/third_party/java_tools/ijar/mapped_file_unix.cc:115:21: error: 'numeric_limits' is not a member of 'std'
  115 |                std::numeric_limits<size_t>::max());
      |                     ^~~~~~~~~~~~~~
external/io_bazel_rules_scala/third_party/java_tools/ijar/mapped_file_unix.cc:115:42: error: expected primary-expression before '>' token
  115 |                std::numeric_limits<size_t>::max());
      |                                          ^
external/io_bazel_rules_scala/third_party/java_tools/ijar/mapped_file_unix.cc:115:45: error: '::max' has not been declared; did you mean 'std::max'?
  115 |                std::numeric_limits<size_t>::max());
      |                                             ^~~
      |                                             std::max
In file included from /usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/algorithm:61,
                 from external/io_bazel_rules_scala/third_party/java_tools/ijar/mapped_file_unix.cc:21:
/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_algo.h:5756:5: note: 'std::max' declared here
 5756 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~

bazel build ijar as rules_scala requests it.

I will have a look on lint errors :wink:

Koisell avatar Aug 31 '22 13:08 Koisell

I pull a build based on bazel 5. Shouldn't we try using it in CI/CD ?

Koisell avatar Aug 31 '22 13:08 Koisell

closing as stale, feel free to reopen

liucijus avatar Jan 31 '24 15:01 liucijus