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

Allow a bootstrap build of Bazel on OpenBSD to succeed. #10274

Closed
wants to merge 3 commits into from
Closed

Allow a bootstrap build of Bazel on OpenBSD to succeed. #10274

wants to merge 3 commits into from

Conversation

aldersondrive
Copy link
Contributor

Tested on OpenBSD 6.6-current (amd64 architecture), as follows:

# Create a 'dist' tarball. Here, `bbazel` is a binary left over from the
# porting work leading up to this patch.
cd ~/git/aldersondrive_bazel
/home/me/bin/bbazel build --host_javabase=@local_jdk//:jdk :bazel-distfile

# Perform a bootstrap build based on the tarball.
rm -rf ~/test_bootstrap
mkdir ~/test_bootstrap
cd ~/test_bootstrap
unzip ~/git/aldersondrive_bazel/bazel-bin/bazel-distfile.zip
EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" JAVA_HOME="/usr/local/jdk-1.8.0" BAZEL_JAVAC_OPTS="-J-Xmx2g -J-Xms200m" bash ./compile.sh

The resulting Bazel binary appeared to work in some simple testing involving cc_library, cc_binary, java_library, and java_binary.

Known issues/limitations:

  • For the above to work, I had to add python to my PATH. (On OpenBSD, the Python binary is called python3.)
ln -s /usr/local/bin/python3 ~/bin/python
  • Building a java_binary's deploy JAR fails because the singlejar tool fails to build. I intend to look into this issue next.
In file included from external/remote_java_tools_linux/java_tools/src/tools/singlejar/input_jar.cc:15:
In file included from bazel-out/host/bin/external/remote_java_tools_linux/_virtual_includes/input_jar/src/tools/singlejar/input_jar.h:27:
bazel-out/host/bin/external/remote_java_tools_linux/_virtual_includes/diag/src/tools/singlejar/diag.h:54:2: error: Unknown platform
#error Unknown platform
 ^
  • Running Bazel requires a --host_javabase=@local_jdk//:jdk flag.

  • Sandboxing is unsupported.

This change is part of the OpenBSD port in #10250.

Tested on OpenBSD 6.6-current (amd64 architecture), as follows:

    # Create a 'dist' tarball. Here, `bbazel` is a binary left over from the
    # porting work leading up to this patch.
    cd ~/git/aldersondrive_bazel
    /home/me/bin/bbazel build --host_javabase=@local_jdk//:jdk :bazel-distfile

    # Perform a bootstrap build based on the tarball.
    rm -rf ~/test_bootstrap
    mkdir ~/test_bootstrap
    cd ~/test_bootstrap
    unzip ~/git/aldersondrive_bazel/bazel-bin/bazel-distfile.zip
    EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" JAVA_HOME="/usr/local/jdk-1.8.0" BAZEL_JAVAC_OPTS="-J-Xmx2g -J-Xms200m" bash ./compile.sh

The resulting Bazel binary appeared to work in some simple testing involving cc_library, cc_binary, java_library, and java_binary.

Known issues/limitations:

- For the above to work, I had to add `python` to my PATH. (On OpenBSD, the Python binary is called `python3`.)

    ln -s /usr/local/bin/python3 ~/bin/python

- Buliding a java_binary's deploy JAR fails because the `singlejar` tool fails to build. I intend to look into this issue next.

    In file included from external/remote_java_tools_linux/java_tools/src/tools/singlejar/input_jar.cc:15:
    In file included from bazel-out/host/bin/external/remote_java_tools_linux/_virtual_includes/input_jar/src/tools/singlejar/input_jar.h:27:
    bazel-out/host/bin/external/remote_java_tools_linux/_virtual_includes/diag/src/tools/singlejar/diag.h:54:2: error: Unknown platform
    #error Unknown platform
     ^

- Running Bazel requires a `--host_javabase=@local_jdk//:jdk` flag.

- Sandboxing is unsupported.
…ion.

The reference to `//src/conditions:openbsd` was invalid, and caused breakage:

```
ERROR: Analysis of target '//java/main:JavaBinary' failed; build aborted: no such package 'src/conditions': BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.
```
@aldersondrive
Copy link
Contributor Author

I've fixed the breakage; the tests pass now. PTAL.

(In case you're wondering: I can't run the tests on OpenBSD because the singlejar build error mentioned above means that the tests currently won't even build, let alone run.)

@ulfjack
Copy link
Contributor

ulfjack commented Nov 20, 2019

This is a pretty big change. I wonder if it could be broken up. Most of the changes are trivial, but we may need to look more carefully at the added C++ code.

@aldersondrive
Copy link
Contributor Author

aldersondrive commented Nov 20, 2019

I would be okay with dividing up this PR, but I don't understand the interdependencies well enough to be confident of a good way to do so. Are you able to suggest one?

Regarding the added C++ code, it's mostly copy/pasted from the equivalent FreeBSD code, which is already in the repo. Thus, there's actually a lot less C++ code changing here than the Github interface suggests.

@dslomov dslomov added team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website untriaged labels Nov 25, 2019
@hlopko hlopko requested review from laszlocsomor and aehlig and removed request for buchgr and ola-rozenfeld November 25, 2019 14:31
@hlopko
Copy link
Member

hlopko commented Nov 25, 2019

Oh this is indeed too big for a PR. I'd split changes touching the client into one PR, one PR for the C++ toolchain configuration, one PR for the python semantics change, and maybe the rest.

Do you have a CI testing story figured out already? @philwo is your point of contact for that.

@hlopko
Copy link
Member

hlopko commented Nov 25, 2019

I'll actually unassign folks from this PR and will wait for the smaller PRs. Thank you!

@aldersondrive
Copy link
Contributor Author

Do you have a CI testing story figured out already? @philwo is your point of contact for that.

I've just filed bazelbuild/continuous-integration#876. (Earlier we briefly discussed FreeBSD CI also. There's already bazelbuild/continuous-integration#258 about that.)

Smaller PRs are on the way. Thanks!

bazel-io pushed a commit that referenced this pull request Dec 6, 2019
This change, split out of the larger PR #10274, is part of the OpenBSD port in #10250.

Closes #10316.

PiperOrigin-RevId: 284198941
bazel-io pushed a commit that referenced this pull request Dec 17, 2019
This change, split out of the larger PR #10274, is part of the OpenBSD port in #10250.

Closes #10386.

PiperOrigin-RevId: 285973120
bazel-io pushed a commit that referenced this pull request Jan 10, 2020
In my limited testing, these changes appear to work. When I built Bazel on OpenBSD incorporating these changes, the resulting `bazel` binary could build C++ libraries and binaries. Likewise on FreeBSD.

This change, split out of the larger PR #10274, is part of the OpenBSD port in #10250.

Closes #10436.

PiperOrigin-RevId: 289091510
bazel-io pushed a commit that referenced this pull request Jan 21, 2020
I have tested these changes via a bootstrap build on OpenBSD 6.6-current (amd64 architecture). The resulting `bazel` binary appeared to work in some simple testing involving `cc_library`, `cc_binary`, `java_library`, and `java_binary`.

Known issues/limitations:

- Building a `java_binary`'s deploy JAR fails because the `singlejar` tool fails to build. I intend to investigate soon.

- Running Bazel requires a `--host_javabase=@local_jdk//:jdk` flag.

- Sandboxing is unsupported.

This change, split out of the larger PR #10274, is part of the OpenBSD port in #10250. Most of the changes in that larger PR have already been committed via several smaller PRs (see the PRs linked from #10250). This PR collects the remaining changes.

Closes #10567.

PiperOrigin-RevId: 290745757
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants