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

Error when compiling Bazel in Raspberry Pi 3 #8882

Closed
marianopeck opened this issue Jul 12, 2019 · 18 comments
Closed

Error when compiling Bazel in Raspberry Pi 3 #8882

marianopeck opened this issue Jul 12, 2019 · 18 comments
Labels
area-EngProd Bazel CI, infrastructure, bootstrapping, release, and distribution tooling team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website untriaged

Comments

@marianopeck
Copy link

Description of the problem / feature request:

I am getting an error when trying to compile Bazel on a Raspberry Pi 3 on Raspbian.

Feature requests: what underlying problem are you trying to solve with this feature?

Trying to compile "TensorFlow for C" for ARM / Raspberry Pi

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

wget https://github.com/bazelbuild/bazel/releases/download/0.28.0/bazel-0.28.0-dist.zip
unzip bazel-0.28.0-dist.zip
cd bazel
env BAZEL_JAVAC_OPTS="-J-Xms384m -J-Xmx512m" EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" bash ./compile.sh

What operating system are you running Bazel on?

Raspbian Stretch

What's the output of bazel info release?

Can't answer because I can't compile it yet.

Have you found anything relevant by searching the web?

No

Any other information, logs, or outputs that you want to share?

Below is the console output:

[1,686 / 1,797] 4 actions, 1 running
    Building .../downloader/libdownloader.jar (12 source files); 12056s worker
    [Sched] .../devtools/build/lib:build-configuration-option-details; 12851s
ERROR: /home/pi/Instantiations/TensorFlow/bazel/src/main/java/com/google/devtools/build/lib/remote/util/BUILD:9:1: Building src/main/java/com/google/devtools/build/lib/remote/util/libutil.jar (3 source files) failed: Worker process quit or closed its stdin stream when we tried to send a WorkRequest:

---8<---8<--- Exception details ---8<---8<---
java.io.IOException: Stream closed
	at java.lang.ProcessBuilder$NullOutputStream.write(ProcessBuilder.java:433)
	at java.io.OutputStream.write(OutputStream.java:116)
	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
	at java.io.BufferedOutputStream.write(BufferedOutputStream.java:126)
	at com.google.protobuf.CodedOutputStream$OutputStreamEncoder.doFlush(CodedOutputStream.java:3003)
	at com.google.protobuf.CodedOutputStream$OutputStreamEncoder.writeStringNoTag(CodedOutputStream.java:2872)
	at com.google.protobuf.CodedOutputStream$OutputStreamEncoder.writeString(CodedOutputStream.java:2718)
	at com.google.protobuf.GeneratedMessageV3.writeString(GeneratedMessageV3.java:2719)
	at com.google.devtools.build.lib.worker.WorkerProtocol$WorkRequest.writeTo(WorkerProtocol.java:1006)
	at com.google.protobuf.AbstractMessageLite.writeDelimitedTo(AbstractMessageLite.java:98)
	at com.google.devtools.build.lib.worker.WorkerSpawnRunner.execInWorker(WorkerSpawnRunner.java:330)
	at com.google.devtools.build.lib.worker.WorkerSpawnRunner.actuallyExec(WorkerSpawnRunner.java:172)
	at com.google.devtools.build.lib.worker.WorkerSpawnRunner.exec(WorkerSpawnRunner.java:121)
	at com.google.devtools.build.lib.exec.SpawnRunner.execAsync(SpawnRunner.java:225)
	at com.google.devtools.build.lib.exec.AbstractSpawnStrategy.exec(AbstractSpawnStrategy.java:123)
	at com.google.devtools.build.lib.exec.AbstractSpawnStrategy.exec(AbstractSpawnStrategy.java:88)
	at com.google.devtools.build.lib.actions.SpawnActionContext.beginExecution(SpawnActionContext.java:41)
	at com.google.devtools.build.lib.exec.ProxySpawnActionContext.beginExecution(ProxySpawnActionContext.java:60)
	at com.google.devtools.build.lib.actions.SpawnContinuation$1.execute(SpawnContinuation.java:80)
	at com.google.devtools.build.lib.rules.java.JavaCompileAction$JavaActionContinuation.execute(JavaCompileAction.java:494)
	at com.google.devtools.build.lib.rules.java.JavaCompileAction.beginExecution(JavaCompileAction.java:314)
	at com.google.devtools.build.lib.actions.Action.execute(Action.java:123)
	at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$4.execute(SkyframeActionExecutor.java:841)
	at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$ActionRunner.continueAction(SkyframeActionExecutor.java:975)
	at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$ActionRunner.run(SkyframeActionExecutor.java:947)
	at com.google.devtools.build.lib.skyframe.ActionExecutionState.runStateMachine(ActionExecutionState.java:116)
	at com.google.devtools.build.lib.skyframe.ActionExecutionState.getResultOrDependOnFuture(ActionExecutionState.java:77)
	at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor.executeAction(SkyframeActionExecutor.java:571)
	at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.checkCacheAndExecuteIfNeeded(ActionExecutionFunction.java:742)
	at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.compute(ActionExecutionFunction.java:260)
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:451)
	at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:399)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
---8<---8<--- End of exception details ---8<---8<---

---8<---8<--- Start of log, file at /tmp/bazel_E7jBcgcv/out/bazel-workers/worker-3-Javac.log ---8<---8<---
Java HotSpot(TM) Client VM warning: TieredCompilation is disabled in this release.
---8<---8<--- End of log ---8<---8<---
Target //src:bazel_nojdk failed to build
INFO: Elapsed time: 17165.778s, Critical Path: 13505.99s
INFO: 1648 processes: 1459 local, 189 worker.
FAILED: Build did NOT complete successfully

ERROR: Could not build Bazel
@aiuto aiuto added area-EngProd Bazel CI, infrastructure, bootstrapping, release, and distribution tooling untriaged labels Jul 13, 2019
@freedomtan
Copy link

env BAZEL_JAVAC_OPTS="-J-Xms384m -J-Xmx1024m" \
JAVA_TOOL_OPTS="-Xmx1024m" \
EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" \
bash ./compile.sh

works for me.

@marianopeck
Copy link
Author

marianopeck commented Jul 13, 2019 via email

@marianopeck
Copy link
Author

Another question @freedomtan .. is there a particular reason on why you use clang instead of gcc? Thanks!

@marianopeck
Copy link
Author

Oh, another question is what are your answers when you run ./configure before the bazel instruction? I have answered as show here. Does this make sense to you or did you answer something differently? and again, I wonder if something would change for Rpi4 (which I want to try soon), but I suspect there is nothing to be changed...

Thanks a lot in advance @freedomtan

@freedomtan
Copy link

if rpi 4 still uses AArch32 binaries, I guess there is no difference. Clang usually is faster than gcc (in terms of compilation time). For ./configure, yes, I think that works.

@marianopeck
Copy link
Author

Hi,

I think you can now close the issue. The original error was indeed related to out of memory and swap memory. However, the error displayed by Bazel gives NO CLUE about that. It would have been much easier of the error would have said that...

@marianopeck
Copy link
Author

I finally took the time to write down everything I found during my attempt to get TensorFlow C library compiled for Raspberry Pi. In that tutorial, I point back to this issue about bazel compilation error in case any progress is made.
Thank you

@mihaigalos
Copy link

@marianopeck , I tried in vain to set up a qemu vm on Ubuntu on my PC and cross-compile bazel for the Pi there. Would you be so kind as to share the compiled bazel artefacts?

@marianopeck
Copy link
Author

Hi @mihaigalos
Not sure if it would help, but here I wrote some more issues I found with it. In fact, in that post, I comment this place where you can find pre-build binaries for bazel.
Let me know if that helps.

@mihaigalos
Copy link

@marianopeck , I lolled (again) when (re-)seeing your article. Awesome one. Nice one with the binaries. I'm unfortunately on Ubuntu 18.04 on the RPi3B+ and cannot use the arm64 ones. Perhaps the bazel binary has some OS-specific stuff baked in. I'll consider switching to Raspian! Many thanks! 👍

@marianopeck
Copy link
Author

marianopeck commented Aug 17, 2019

Hi @mihaigalos
ohhh I didn't know you wanted arm64. If so, you might try these builds that were used originally for the nano?
Let me know.

@mihaigalos
Copy link

@marianopeck , I could get it running with bazel 0.27 and building a demo with bazel build //... --host_javabase=@local_jdk//:jdk! Many thanks! 👍

@marianopeck
Copy link
Author

Excellent news @mihaigalos!!

@jgresham
Copy link

@marianopeck @mihaigalos I can't find a bazel binary that runs on raspi4, so I am working on that now. I have a few questions.
Did you build bazel on the raspi or using qemu?
If finished, can we get the arm builds listed on the official release pages? (https://github.com/bazelbuild/bazel/releases)

@mihaigalos
Copy link

@jgresham
Up: sorry, I thought you were talking about something else.

@jgresham
Copy link

@mihaigalos Sorry, my mistake, I am running Raspbian Buster which is 32 bit OS on the raspi4. I will try again with a 64 bit OS. Once we test an arm64 build we should try to get it listed on the official release page.

@mihaigalos
Copy link

@jgresham : I am really looking forward to a config for building bazel from source for arm32 and arm64! Good luck if you can write it!

@meisterT
Copy link
Member

Closing as I think there's nothing actionable here for the bazel team

@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-EngProd Bazel CI, infrastructure, bootstrapping, release, and distribution tooling team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website untriaged
Projects
None yet
Development

No branches or pull requests

7 participants