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

Use cc implementation of singlejar on FreeBSD #3096

Closed
xingao267 opened this issue Jun 1, 2017 · 0 comments
Closed

Use cc implementation of singlejar on FreeBSD #3096

xingao267 opened this issue Jun 1, 2017 · 0 comments
Assignees
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) platform: other type: feature request

Comments

@xingao267
Copy link
Member

CC implementation of singlejar is enabled on platforms except windows and FreeBSD. (Use cc implementation of singlejar on Windows is a separate issue: Issue 2241.) When I attempted to enable it, it breaks the CI on Free BSD.

Environment info

Log

The CI log is the following:

Started by upstream project "Bazel" build number 1542
originally caused by:
Started by upstream project "Github-Trigger" build number 1539
originally caused by:
Started by remote host 192.30.252.42
Building remotely on freebsd-11-1 (freebsd-11 install-bazel no-release) in workspace /home/ci/workspace/Bazel/JAVA_VERSION/1.8/PLATFORM_NAME/freebsd-11

git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
git config remote.origin.url https://github.com/bazelbuild/bazel # timeout=10
Cleaning workspace
git rev-parse --verify HEAD # timeout=10
Resetting working tree
git reset --hard # timeout=10
git clean -fdx # timeout=10
Fetching upstream changes from https://github.com/bazelbuild/bazel
git --version # timeout=10
git fetch --tags --progress https://github.com/bazelbuild/bazel +refs/heads/:refs/remotes/origin/ +refs/notes/:refs/notes/
Checking out Revision c3cf7d9 (refs/remotes/origin/master)
git config core.sparsecheckout # timeout=10
git checkout -f c3cf7d9
git rev-list 8621efc # timeout=10
Run condition [Regular expression match] enabling prebuild for step [Execute shell]
Run condition [And] enabling prebuild for step [Execute shell]
Run condition [File exists] enabling prebuild for step [Set the build result]
Regular expression run condition: Expression=[^((?!windows).)*$], Label=[freebsd-11]
Run condition [Regular expression match] enabling perform for step [Execute shell]
[freebsd-11] $ /usr/bin/env bash /tmp/hudson8437180031568339451.sh
.......................
____Loading package: src
____Loading package: @bazel_tools//tools/cpp
____Loading package: @local_config_xcode//
____Loading package: @local_jdk//
____Loading complete. Analyzing...
____Loading package: src/main/cpp
____Loading package: @bazel_tools//tools/genrule
____Loading package: src/main/native
____Loading package: third_party/ijar
____Loading package: src/java_tools/buildjar/java/com/google/devtools/build/java/turbine
____Loading package: third_party/protobuf
____Loading package: third_party/grpc
____Loading package: src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac
____Loading package: third_party/protobuf/3.2.0
____Loading package: tools/zip
___Loading package: src/java_tools/singlejar/java/com/google/devtools/build/zip
WARNING: /home/ci/workspace/Bazel/JAVA_VERSION/1.8/PLATFORM_NAME/freebsd-11/tools/build_defs/docker/docker.bzl:19:1: The docker
{build,bundle} rules bundled with Bazel are deprecated in favor of:
https://github.com/bazelbuild/rules_docker. Please change BUILD loads to reference: @io_bazel_rules_docker//docker:docker.bzl and add the following to your WORKSPACE:
git_repository(
name = "io_bazel_rules_docker",
remote = "https://github.com/bazelbuild/rules_docker.git",
commit = "...",
)
load("@io_bazel_rules_docker//docker:docker.bzl", "docker_repositories")
docker_repositories().
____Loading package: tools/build_defs/docker/testdata/test
____Loading package: @com_google_protobuf//
____Loading package: @com_google_protobuf_java//
____Loading package: src/tools/android/java/com/google/devtools/build/android/desugar/runtime
____Loading package:
____Loading package: src/main/java/com/google/devtools/build/lib/ssd
____Loading package: third_party/protobuf/3.2.0/util/python
____Found 1 target...
____Building...
____[0 / 32] BazelWorkspaceStatusAction stable-status.txt
____[10 / 97] Writing file src/main/java/com/google/devtools/build/lib/libauth_and_tls_options.jar-2.params
____[106 / 452] Compiling src/tools/singlejar/options.cc
__[147 / 501] Compiling src/tools/singlejar/input_jar.cc
ERROR: /home/ci/workspace/Bazel/JAVA_VERSION/1.8/PLATFORM_NAME/freebsd-11/src/tools/singlejar/BUILD:276:1: C++ compilation of rule '//src/tools/singlejar:options' failed: clang failed: error executing command /usr/bin/clang -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 22 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
In file included from src/tools/singlejar/options.cc:17:
./src/tools/singlejar/diag.h:29:2: error: Unknown platform
#error Unknown platform
^
In file included from src/tools/singlejar/options.cc:18:
./src/tools/singlejar/token_stream.h:60:9: error: use of undeclared identifier 'diag_err'
diag_err(1, "%s", filename);
^
./src/tools/singlejar/token_stream.h:96:13: error: use of undeclared identifier 'diag_errx'
diag_errx(1, "Expected character after \, got EOF in %s",
^
./src/tools/singlejar/token_stream.h:137:13: error: use of undeclared identifier 'diag_errx'
diag_errx(1, "No closing %c in %s", quote, filename
.c_str());
^
./src/tools/singlejar/token_stream.h:143:11: error: use of undeclared identifier 'diag_errx'
diag_errx(1, "No closing %c in %s", quote, filename
.c_str());
^
./src/tools/singlejar/token_stream.h:203:7: error: use of undeclared identifier 'diag_errx'
diag_errx(1, "%s requires argument", option);
^
src/tools/singlejar/options.cc:50:7: error: use of undeclared identifier 'diag_errx'
diag_errx(1, "Bad command line argument %s", tokens.token().c_str());
^
src/tools/singlejar/options.cc:55:5: error: use of undeclared identifier 'diag_errx'
diag_errx(1, "Use --output <output_jar> to specify the output file name");
^
src/tools/singlejar/options.cc:58:5: error: use of undeclared identifier 'diag_errx'
diag_errx(
^
9 errors generated.
____[517 / 894] Writing file src/main/java/com/google/devtools/build/lib/libruntime-hjar.jar-2.params
____Building complete.
Target //src:bazel failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /home/ci/workspace/Bazel/JAVA_VERSION/1.8/PLATFORM_NAME/freebsd-11/src/BUILD:207:2 C++ compilation of rule '//src/tools/singlejar:options' failed: clang failed: error executing command /usr/bin/clang -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 22 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
____Elapsed time: 5.681s, Critical Path: 0.49s
Build step 'Conditional step (single)' marked build as failure
Archiving artifacts
Sending e-mails to: bazel-ci@googlegroups.com
Finished: FAILURE

Suggested fix

For record: fix suggested by aehlig@:

It mainly fails due to statements like

#if !((defined(linux) || defined(APPLE)) && SIZEOF_POINTER == 8)
#error This code for 64 bit Unix.
#endif

If you remove those (allowing defined(FreeBSD) as well might be more appropriate), then only two simple adaptions are necessary

  • the #include <endian.h> should be #include <sys/endian.h> on FreeBSD, and
  • singlejar needs to be linked with -lm.
@laszlocsomor laszlocsomor added P3 We're not considering working on this, but happy to review a PR. (No assignee) type: feature request labels Jun 1, 2017
aehlig added a commit to aehlig/bazel that referenced this issue Jun 9, 2017
The C implementation of singlejar verifies that it is built for a
supported system; currently those are 64-bit linux and apple systems.
However, the code is portable enough that it can easily be adapted to
run on 64-bit FreeBSD systems as well. In fact, only the path of a
single header file is different, and we need to link with -lm.

Fixes bazelbuild#3096.

Change-Id: Id69542ad940f1161aceb55eb8f5dabda2f486747
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) platform: other type: feature request
Projects
None yet
Development

No branches or pull requests

3 participants