How can I make Android Q sources build shared libraries? - build

I lunch 1 which is aosp_arm-eng. Then I do make -j 1.
It seems Android.pb's are always reporting missing variant. Is there a way I can force a build of shared libraries. I dont think this is a problem with system/core this error pops up in other custom Android.bp in my own device tree. And as I have shown even lunch aosp_arm-eng fails
Here is a build log
[100% 1/1] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
out/soong/.bootstrap/bin/soong_build -t -l out/.module_paths/Android.bp.list -b
out/soong -n out -d out/soong/build.ninja.d -globFile out/soong/.bootstrap/build
-globs.ninja -o out/soong/build.ninja Android.bp
error: system/core/init/Android.bp:164:1: dependency "libbootloader_message" of
"init_second_stage" missing variant:
arch:android_arm_armv7-a-neon, image:core, link:shared, version:
available variants:
arch:android_arm_armv7-a-neon, image:core, link:static, version:
error: system/core/init/Android.bp:95:1: dependency "libbootloader_message" of "
libinit" missing variant:
arch:android_arm_armv7-a-neon, image:core, link:shared, version:
available variants:
arch:android_arm_armv7-a-neon, image:core, link:static, version:
error: system/core/init/Android.bp:214:1: dependency "libbootloader_message" of
"init_benchmarks" missing variant:
arch:android_arm_armv7-a-neon, image:core, link:shared, version:
available variants:
arch:android_arm_armv7-a-neon, image:core, link:static, version:
error: system/core/init/Android.bp:190:1: dependency "libbootloader_message" of
"init_tests" missing variant:
arch:android_arm_armv7-a-neon, image:core, link:shared, version:
available variants:
arch:android_arm_armv7-a-neon, image:core, link:static, version:
09:53:04 soong bootstrap failed with: exit status 1
#### failed to build some targets (36 seconds) ####

My problem was I had removed bootable/recovery because it was clashing with recovery-twrp. It seems the missing libraries were in bootable/recovery. I deleted bootable/recovery-twrp and brought back bootable/recovery. Problem solved

Related

GoogleCloudPlatform Buildpacks failed to build

I haven't changed anything recently in my project, but when I tried to deploy it last, I received this error in the logs: ERROR: Could not build wheels for pyarrow, which is required to install pyproject.toml-based projects
See the full log here: log-d20114fe-3eeb-4a8d-8926-3a971882894c.txt
This is my requirements.txt:
requirements.txt
It seems like it is an issue with the dependencies for the snowflake-connector-python package, but I am not really sure what would have caused this. I see in the logs:
-- Running cmake for pyarrow
Step #0 - "Buildpack": cmake -DPYTHON_EXECUTABLE=/layers/google.python.runtime/python/bin/python3 -DPython3_EXECUTABLE=/layers/google.python.runtime/python/bin/python3 "" -DPYARROW_BUILD_CUDA=off -DPYARROW_BUILD_FLIGHT=off -DPYARROW_BUILD_GANDIVA=off -DPYARROW_BUILD_DATASET=off -DPYARROW_BUILD_ORC=off -DPYARROW_BUILD_PARQUET=off -DPYARROW_BUILD_PARQUET_ENCRYPTION=off -DPYARROW_BUILD_PLASMA=off -DPYARROW_BUILD_S3=off -DPYARROW_BUILD_HDFS=off -DPYARROW_USE_TENSORFLOW=off -DPYARROW_BUNDLE_ARROW_CPP=off -DPYARROW_BUNDLE_BOOST=off -DPYARROW_GENERATE_COVERAGE=off -DPYARROW_BOOST_USE_SHARED=on -DPYARROW_PARQUET_USE_SHARED=on -DCMAKE_BUILD_TYPE=release /tmp/pip-install-w1g_50oc/pyarrow_4a54282bee5f4c3c8399d3428e4134e6
Step #0 - "Buildpack": error: command 'cmake' failed: No such file or directory
This makes me think CMake is the problem, but I tried explicitly adding CMake to my requirements file and had the same result.
I also looked at the last successful build, and it looks like I was running python version 3.10.8, and the one that failed first was running 3.11. How can I change what python version cloud build uses? I am using the cloudbuild.yaml file instead of docker.
Figured it out! The issue was with not specifying a version in Cloud Build for Python, so it was defaulting to 3.11, which does not yet have support for pyarrow. I ended up setting the version in the cloud build yaml file to 3.10.8 like so:
steps:
- name: gcr.io/k8s-skaffold/pack
env:
- GOOGLE_ENTRYPOINT=$_ENTRYPOINT
- GOOGLE_RUNTIME_VERSION=$_RUNTIME_VERSION
args:
- build
- '$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA'
- '--builder=gcr.io/buildpacks/builder:v1'
- '--network=cloudbuild'
- '--path=.'
- '--env=GOOGLE_ENTRYPOINT'
- '--env=GOOGLE_RUNTIME_VERSION'
For those of you who are using a Procfile
I was able to fix by creating a .python-version file that contains just the version number needed,
i.e. 3.10.4

Build and run a Qt application on macOS via Bazel

I tried to build and run a Qt5 (5.15.2) application on macOS (10.15.7) using Bazel 5.0.0.
Unfortunately, I run into some problems.
The building part seems to work, but not the run part.
I installed Qt5 on my machine using Homebrew:
brew install qt#5
brew link qt#5
I adapted https://github.com/justbuchanan/bazel_rules_qt/ to my needs. See this PR. When I try to run:
bazel run --cxxopt=-std=c++17 //tests/qt_resource:main
I receive the runtime error:
dyld: Symbol not found: __ZN10QByteArray6_emptyE
Steps to reproduce the issue:
# brew install bazel # Install Bazel
# brew install qt#5 # Install Qt5
git clone https://github.com/Vertexwahn/bazel_rules_qt.git
cd bazel_rules_qt
git checkout add-macos-support
bazel build --cxxopt=-std=c++17 //... # should work
bazel run --cxxopt=-std=c++17 //tests/qt_resource:main # should give you the error message
Nevertheless, building everything using bazel build --cxxopt=-std=c++17 //... seems to work.
I am not 100% sure if the link options -F/usr/local/opt/qt5/Frameworks and -framework QtCore, etc. are correct.
Maybe someone can confirm this.
Did I use the correct link options?
For me, it is a bit unclear what dependencies the main binary expects. I tried to copy QtCore.framework to the location of the main binary manually but this does not change the error message.
What files does the main binary expect?
If I try to run macdeployqt on my main binary I get also some errors. I do within my workspace root dir a cd bazel-bin/tests/qt_resource and run then /usr/local/opt/qt5/bin/macdeployqt main:
ERROR: Could not find bundle binary for "main"
ERROR: "error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: (No such file or directory)\n"
ERROR: "error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: (No such file or directory)\n"
ERROR: "error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: (No such file or directory)\n"
WARNING:
WARNING: Could not find any external Qt frameworks to deploy in "main"
WARNING: Perhaps macdeployqt was already used on "main" ?
WARNING: If so, you will need to rebuild "main" before trying again.
ERROR: Could not find bundle binary for "main"
ERROR: "error: /Library/Developer/CommandLineTools/usr/bin/strip: can't open file: (No such file or directory)\n"
ERROR: ""
My hope was that macdeployqt would collect all needed resources for me. Any idea why this is not working?
How can macdeployqt be used to collect all needed dependencies for the main binary?
If I convert my main to an app via lipo -create -output universall_app main and do then a /usr/local/opt/qt5/bin/macdeployqt universall_app I get the same error message.
The CMake approach
To make sure that there is no general problem with my system setup I tried to use CMake to build a Qt5 application:
git clone https://github.com/euler0/mini-cmake-qt.git
cmake -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5 .
make -j
This produces an example.app.
With a double click on this application bundle,
the application can be started.
This worked on my system.
Future directions
It seems that rules_apple can be used to create an application bundle.
I am not sure if I need to transform my Qt application binary to an app bundle to be able to execute it.
One could use --sandbox_debugto identify what Bazel is doing and dtruss for the CMake version to compare the differences.
I am currently not sure what trying to do next and hope for an easy solution. I am also fine with a Qt6 solution.
Update: Alternative Answer
It would also be helpful if someone can point out how to build a minimal Qt application using make only on macOS and a brew installed Qt5 or tell me what the linker and compiler options must look like.
I followed your steps with Mac OSX 10.15.7, Qt (installed by homebrew) 5.15.1 and both bazel 4.2.2-homebrew and 5.0.0-homebrew and initially I could not build the project from git:
* 3fe5f6c - (4 weeks ago) Add macOS support — Vertexwahn (HEAD -> add-macos-support, origin/add-macos-support)
This is the result that I get when building:
% bazel build --cxxopt=-std=c++17 //...
DEBUG: /private/var/tmp/_bazel_home/761aafaa2237a9607dd915f1f52bca3e/external/com_justbuchanan_rules_qt/qt_configure.bzl:43:14: Installation available on the default path: /usr/local/opt/qt5
INFO: Analyzed 14 targets (0 packages loaded, 0 targets configured).
INFO: Found 14 targets...
ERROR: /Users/home/Git/my_repo/bazel_rules_qt/tests/qt_qml/BUILD:4:10: Compiling tests/qt_qml/main.cc failed: (Aborted): wrapped_clang failed: error executing command external/local_config_cc/wrapped_clang '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -O0 -DDEBUG '-std=c++11' ... (remaining 38 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
tests/qt_qml/main.cc:1:10: fatal error: 'QtQml/QQmlApplicationEngine' file not found
#include <QtQml/QQmlApplicationEngine>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Error in child process '/usr/bin/xcrun'. 1
INFO: Elapsed time: 0,594s, Critical Path: 0,32s
INFO: 3 processes: 3 internal.
FAILED: Build did NOT complete successfully
After playing around with headers and include paths in qt.BUILD:
diff --git a/qt.BUILD b/qt.BUILD
index 517c8db..8f110b5 100644
--- a/qt.BUILD
+++ b/qt.BUILD
## -28,11 +28,12 ## QT_LIBRARIES = [
cc_library(
name = "qt_%s_osx" % name,
# When being on Windows this glob will be empty
- hdrs = glob(["%s/**" % include_folder], allow_empty = True),
+ hdrs = glob(["include/%s/**" % include_folder], allow_empty = True),
includes = ["."],
linkopts = ["-F/usr/local/opt/qt5/lib"] + [
"-framework %s" % library_name.replace("5", "") # macOS qt libs do not contain a 5 - e.g. instead of Qt5Core the lib is called QtCore
],
+ strip_include_prefix= "include"
# Available from Bazel 4.0.0
# target_compatible_with = ["#platforms//os:osx"],
)
I could build and run the project:
% bazel build --cxxopt=-std=c++17 //...
DEBUG: /private/var/tmp/_bazel_home/761aafaa2237a9607dd915f1f52bca3e/external/com_justbuchanan_rules_qt/qt_configure.bzl:43:14: Installation available on the default path: /usr/local/opt/qt5
INFO: Analyzed 14 targets (1 packages loaded, 7422 targets configured).
INFO: Found 14 targets...
INFO: Elapsed time: 11,761s, Critical Path: 7,23s
INFO: 3 processes: 1 internal, 2 darwin-sandbox.
INFO: Build completed successfully, 3 total actions
% bazel run --cxxopt=-std=c++17 //tests/qt_resource:main
DEBUG: /private/var/tmp/_bazel_home/761aafaa2237a9607dd915f1f52bca3e/external/com_justbuchanan_rules_qt/qt_configure.bzl:43:14: Installation available on the default path: /usr/local/opt/qt5
INFO: Analyzed target //tests/qt_resource:main (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //tests/qt_resource:main up-to-date:
bazel-bin/tests/qt_resource/main
INFO: Elapsed time: 3,657s, Critical Path: 0,00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
opened resource file
file1
Related to your question whether the linker options are correct
-F/usr/local/opt/qt5/Frameworks -framework QtCore
Yes they are correct, you could alternatively use -F/usr/local/opt/qt5/lib (as you are already using in qt.BUILD) as all the files under the Frameworks folder are links to the lib folder.
With macdeployqt and lipo I get the same results as in the OP even after the test is running successfully.

Boost build fails after upgrade to 1.72.0 - same target twice

Hello great minds of stackoverflow. My project builds Boost via a CMake ExternalProject_Add command. The b2 build command is as follows:
b2 -j${num_processors} -d 0 --layout=versioned threading=multi architecture=x86 address-model=64 link=shared --with-system --with-thread --with-date_time --with-chrono --with-atomic variant=${config_type} --prefix=${UNRELEVANT_PATH} --stagedir=${UNRELEVANT_PATH} install stage
num_processors, config_type, and UNRELEVANT_PATH are CMake variables for the number of cores on the build machine, build variant type, and paths for installation. This command works for Boost 1.62 using gcc 4.8.1 and Visual Studio 2015. We're now upgrading to Boost 1.72.0 and it is failing with this error on both compilers:
Performing configuration checks
- default address-model : 64-bit
- default architecture : x86
- lockfree boost::atomic_flag : yes
error: Name clash for '<p/my/path/to/boost/lib/cmake/boost_atomic-1.72.0>boost_atomic-config.cmake'
error:
error: Tried to build the target twice, with property sets having
error: these incompatible properties:
error:
error: - none
error: - none
error:
error: Please make sure to have consistent requirements for these
error: properties everywhere in your project, especially for install
error: targets.
I've done nothing but replace the source files for boost from 1.62 to 1.72.0. I couldn't find any relevant differences in the b2 documentation between those versions. Did I miss something?
I've tried removing the --with-atomic flag and it just fails on the next library with the same error. I've tried different options for --layout, threading, and architecture with no luck. Any suggestions on what I should investigate further to resolve this?
Apparently I've been doing it wrong this whole time. You shouldn't set --prefix and --stagedir to the same location. Previous iterations of boost don't seem to care about this issue. One of the later versions started caring which caused my problem.

Failed to build Dockerfile.devel with error -Werror=maybe-uninitialized

I am building tensorflow-server from source code, refer to doc, but it was failed.
My environment:
Linux 3.10.0-1062.12.1.el7.x86_64
Docker 19.03.8
Build command:
docker build --pull -t $USER/tensorflow-serving-devel -f tensorflow_serving/tools/docker/Dockerfile.devel
Error output:
ERROR: /root/.cache/bazel/_bazel_root/e53bbb0b0da4e26d24b415310219b953/external/upb/BUILD:57:1: C++ compilation of rule '#upb//:upb' failed (Exit 1)
external/upb/upb/table.c: In function 'upb_inttable_pop':
external/upb/upb/table.c:588:10: error: 'val.val' may be used uninitialized in this function [-Werror=maybe-uninitialized]
return val;
^~~
cc1: all warnings being treated as errors
Target //tensorflow_serving/model_servers:tensorflow_model_server failed to build
INFO: Elapsed time: 592.958s, Critical Path: 122.61s
INFO: 3550 processes: 3550 local.
FAILED: Build did NOT complete successfully
I've also faced this error when building latest version of Tensorflow Serving container. Looks like particular bazel version causes the error. I have found discussion under one of recent tensorflow serving updates - https://github.com/tensorflow/serving/commit/162f72949c6ecbe9e610182c923dec0aa5924cf2. I tried workaround suggested there, changing Tensorflow Serving branch from master to r2.1 by passing argument to docker build in such a way --build-arg TF_SERVING_VERSION_GIT_BRANCH=r2.1, it helped.

Homebrew - Boost failed to build on 10.10.5 Yosemite with layout=system and --build-from-source

I am attempting to build the Boost library from Homebrew. I am using layout=system to get an untagged build (based on this stackoverflow post), but the build does not go through. The error message is as follows:
error: Name clash for '<p/usr/local/Cellar/boost/1.58.0/lib>libboost_system.dylib'
error:
error: Tried to build the target twice, with property sets having
error: these incompatible properties:
error:
error: - <threading>multi
error: - <threading>single
error:
error: Please make sure to have consistent requirements for these
error: properties everywhere in your project, especially for install
error: targets.
Here is a link to the homebrew generated gist. Thank you in advance.
I created an issue on the Homebrew repository and was quickly assisted. I needed to use the option --without-single.
brew reinstall boost --build-from-source --without-single