compute-engine: lce_converter build from source error: /tmp/lce_android
Hi all
I was trying to build the Larq Compute engine in a virtual environment using Python3.7/TensorFlow2.4.1.
Given the instructions https://docs.larq.dev/compute-engine/build/converter/ and after executing
bazel clean --expunge
bazel build :build_pip_pkg
I get the following error:
(tf2.4) ➜ compute-engine git:(bazel3.7.0) ✗ bazel build :build_pip_pkg Starting local Bazel server and connecting to it… ERROR: Analysis of target ‘//:build_pip_pkg’ failed; build aborted: The repository’s path is “/tmp/lce_android” (absolute: “/tmp/lce_android”) but a symlink could not be created for it, because: /tmp/lce_android (No such file or directory) INFO: Elapsed time: 13,699s INFO: 0 processes. FAILED: Build did NOT complete successfully (13 packages loaded, 27 targets configured) currently loading: larq_compute_engine/mlir … (3 packages) Fetching @local_config_cuda; fetching Fetching @local_execution_config_python; fetching Fetching @local_config_sh; fetching Fetching @local_config_cc_toolchains; Restarting. Fetching @rules_java; fetching
Trying to solve using Android NDK install script worked out, just asking myself why this would be needed as the compilation for the converter is native for the host platform (macOS, Intel i5-8259U in this case) ? Running the install script in a docker container makes sense, for a build on a host machine is there an alternative other than changing the install path in the script to something else than /tmp/lce_android ?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (16 by maintainers)
Commits related to this issue
- Configure the Android SDK/NDK interactively in configure.py. This means we don't have to hard-code paths, and Android only needs to be configured when necessary. Configuration code taken from TF. Clo... — committed to AdamHillier/compute-engine by AdamHillier 3 years ago
- Configure the Android SDK/NDK interactively in configure.py. (#627) This means we don't have to hard-code paths, and Android only needs to be configured when necessary. Configuration code taken from... — committed to larq/compute-engine by AdamHillier 3 years ago
perfect.
@Tombana, @AdamHillier thank you all for the support. still wonder why such an error during compilation is thrown by newer versions than
bazel 3.1.0but I consider this issue resolvedHi @simonmaurer, sorry for the delay in getting back to you. Thanks for investigating the Bazel errors further 😃
My gut instinct, without any evidence, is that this is a bug in Bazel that has been introduced, since as you say that release is meant to be backwards-compatible. Unfortunately, it’s hard to have any insight in how to get this working with newer Bazel versions without actually trying to do upgrade. Since TensorFlow master is currently on Bazel 3.7.2, we will certainly have to address this when we update our TF dependency (which we probably do when/soon after the TF 2.5 release branch gets cut).
It’s true that our approach of hard-coding this link to
/tmp/lce_androidis not the approach TF takes (perhaps it once was); they have dynamic configuration of paths to Android SDK/NDK environments as part of theirconfigure.py, so likely the easiest thing for us to do would be to copy these functions into our ownconfigure.pyand delete the hard-coded lines. Of course, that’s actually a much nicer solution anyway since it’s much less brittle and allows interactive configuration.Happy to hear that you got it working!
This is expected. When in the root folder, the python import statement gives the
larq_compute_enginefolder higher priority than the package, and the_graphdef_tfl_flatbuffer.so(compiled library) file is not present there, it is only present in the compiled package.so built again with exactly the aforementioned flags
this time the compilation resulted in a correct
larq_compute_engine-0.5.0-cp37-cp37m-macosx_10_13_x86_64.whl, installing it via pip in the virtual environment was successful. importing larq_compute_engine in the python interpreter works as expected. very nice!one thing I noticed is when I’m directly in the root folder of the larq_compute_engine repo. launching the python interpreter and importing larq_compute_engine results in:
is that expected behavior?
will compile again with these optimization flags
Hmm, that is weird. I don’t know why it would default to a higher value than your native OS version 😕
That said, we successfully build release wheels for MacOS 10.13, you can see the command flags we pass in order to do that here: https://github.com/larq/compute-engine/blob/579c8fb02f69d6f08e1581206c7b9b00b5394028/.github/workflows/release.yml#L134-L135
within the virtual environment the
which pythoncommand states :so that should be correct when executing
python configure.pyI’ll do a reconfigure (including the latest bazelisk version from Homebrew that chooses the right bazel version 3.1.0 given the .bazelversion in larq_compute_engine repo) and report back.