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

bazel-3.3.0 fails to bootstrap on ppc64le #11643

Closed
ceseo opened this issue Jun 25, 2020 · 2 comments
Closed

bazel-3.3.0 fails to bootstrap on ppc64le #11643

ceseo opened this issue Jun 25, 2020 · 2 comments
Labels
team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug untriaged

Comments

@ceseo
Copy link
Contributor

ceseo commented Jun 25, 2020

Description of the problem / feature request:

While bootstrapping bazel-3.3.0 on ppc64le:

In file included from src/main/java/com/google/devtools/build/lib/syntax/cpu_profiler_posix.cc:20:0:
bazel-out/ppc-opt/bin/external/bazel_tools/tools/jdk/include/jni.h:45:10: fatal error: jni_md.h: No such file or directory
 #include "jni_md.h"
          ^~~~~~~~~~
compilation terminated.
Target //src:bazel_nojdk failed to build
INFO: Elapsed time: 173.915s, Critical Path: 19.09s
INFO: 735 processes: 735 local.
FAILED: Build did NOT complete successfully

This is probably because jni_md.h is in jdk/include/linux, not jdk/include. Looking at the JDK installation path on Ubuntu 18.04:

ubuntu@horus:~$ sudo find / -name jni_md.h
/usr/lib/jvm/java-8-openjdk-ppc64el/include/linux/jni_md.h
/usr/lib/jvm/java-11-openjdk-ppc64el/include/linux/jni_md.h

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Just try a bootstrap build on ppc64le.

What operating system are you running Bazel on?

Ubuntu 18.04.3

@redsigma
Copy link

redsigma commented Jun 27, 2020

I had this problem on a raspberry pi 4 b (Debian 10 buster).
I managed to build version 3.2.0 by doing the following edits:

1.cd {bazel_root}/tools/jdk
2.Open BUILD file
3.Edit the ares marked in bold:

# TODO(adonovan): add cases for //src/conditions:linux_{ppc,s390x} when released in Bazel.
# TODO(adonovan): why is there no //src/conditions target meaning "just linux"?
cc_library(
name = "jni",
hdrs = [":jni_header"] + select({
"//src/conditions:linux_x86_64": [":jni_md_header-linux"],
"//src/conditions:linux_aarch64": [":jni_md_header-linux"],
"//src/conditions:darwin": [":jni_md_header-darwin"],
"//src/conditions:freebsd": [":jni_md_header-freebsd"],
"//src/conditions:openbsd": [":jni_md_header-openbsd"],
"//src/conditions:windows": [":jni_md_header-windows"],
"//conditions:default": [],
}),
includes = ["include"] + select({
"//src/conditions:linux_x86_64": ["include/linux"],
"//src/conditions:linux_aarch64": ["include/linux"],
"//src/conditions:darwin": ["include/darwin"],
"//src/conditions:freebsd": ["include/freebsd"],
"//src/conditions:openbsd": ["include/openbsd"],
"//src/conditions:windows": ["include/win32"],
"//conditions:default": [],
}),
)

To the following:

# TODO(adonovan): add cases for //src/conditions:linux_{ppc,s390x} when released in Bazel.
# TODO(adonovan): why is there no //src/conditions target meaning "just linux"?
cc_library(
name = "jni",
hdrs = [":jni_header"] + select({
"//src/conditions:linux_x86_64": [":jni_md_header-linux"],
"//src/conditions:linux_aarch64": [":jni_md_header-linux"],
"//src/conditions:darwin": [":jni_md_header-darwin"],
"//src/conditions:freebsd": [":jni_md_header-freebsd"],
"//src/conditions:openbsd": [":jni_md_header-openbsd"],
"//src/conditions:windows": [":jni_md_header-windows"],
"//conditions:default": [":jni_md_header-linux"],
}),
includes = ["include"] + select({
"//src/conditions:linux_x86_64": ["include/linux"],
"//src/conditions:linux_aarch64": ["include/linux"],
"//src/conditions:darwin": ["include/darwin"],
"//src/conditions:freebsd": ["include/freebsd"],
"//src/conditions:openbsd": ["include/openbsd"],
"//src/conditions:windows": ["include/win32"],
"//conditions:default": ["include/linux"],
}),
)

4. (Optional) I also did the following commands to make sure the headers files are seen:
cd /usr/lib/jvm/java-11-openjdk-armhf/include
cp ./linux/* .
After that bazel compiled succesfully. Also i'm using g++ (Debian 9.3.0-14) 9.3.0

@ceseo
Copy link
Contributor Author

ceseo commented Jun 29, 2020

@redsigma Thanks.

If the maintainers are interested, this fixes the build for both ppc64/ppc64le: ceseo@2c49a93

I already have a Google CLA signed for golang, so I think I'm clear.

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

Successfully merging a pull request may close this issue.

3 participants