I use cmake to build my source code. It depend on a package named "spdlog".
I want to generate the sdk using yocto. SDK is correctly generated using populate_sdk but spdlog config cmake file is not shipped in SDK.
My receipe :
SUMMARY = "Spdlog"
DESCRIPTION = "Fast C++ logging library"
AUTHOR = "author name"
LICENSE = "CLOSED"
SECTION = "libs"
SRC_URI = "git://git#github.com/gabime/spdlog.git;branch=master;protocol=ssh"
SRCREV = "7088644d3f69f18b51671eb52dd49028fd858add"
PR = "r0"
PVBASE := "${PV}"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PVBASE}:"
PV = "${PVBASE}.${SRCPV}"
S = "${WORKDIR}/git"
inherit cmake pkgconfig
FILES_${PN} += "/usr/lib/cmake/spdlog/spdlogConfig.cmake \
/usr/lib/cmake/spdlog/spdlogConfigVersion.cmake \
"
But, we I install my SDK and try to use it to compil my code, it failed with this error :
Make Error at CMakeLists.txt:89 (find_package):
Could not find a package configuration file provided by "spdlog" with any
of the following names:
spdlogConfig.cmake
spdlogConfigVersion.cmake
When I check my build tmp/work/spdlog folder, I can see the files exported :
./image/usr/lib/cmake/spdlog/spdlogConfig.cmake
./sysroot-destdir/usr/lib/cmake/spdlog/spdlogConfig.cmake
./packages-split/spdlog/usr/lib/cmake/spdlog/spdlogConfig.cmake
./build/CMakeFiles/Export/lib/cmake/spdlog/spdlogConfig.cmake
./build/spdlogConfig.cmake
./package/usr/lib/cmake/spdlog/spdlogConfig.cmake
./recipe-sysroot-native/usr/share/cmake-3.8/Modules/FindPkgConfig.cmake
./recipe-sysroot-native/usr/share/cmake-3.8/Modules/UsePkgConfig.cmake
Do you have any idea about this issue ?
Every package from FILES_${PN}-dev will be available in Yocto SDK.
The solution for my issue is to set cmake required config file *.cmake under FILES_${PN}-dev.
Related
I am trying to make a recipe for a C++ app that uses libmariadb. While developing I was using vcpkg but now I want to use Yocto.
Here is the application_1.0.0.bb file:
# Metadata
SUMMARY = "Customer API Backend"
DESCRIPTION = "Customer API in C++ using gRPC"
# License is closed, no checksum to avoid warnings
LICENSE = "CLOSED"
LIC_FILE_CHKSUM = ""
DEPENDS = "protobuf protobuf-c protobuf-native grpc grpc-native openssl mariadb poco"
SRCREV = "${AUTOREV}"
SRC_URI = "git://git#gitlab.com/software/projects/embedded/application.git;protocol=ssh;branch=master;"
S = "${WORKDIR}/git"
inherit pkgconfig cmake
Here is the CMake part that poses problem with Yocto:
find_package(unofficial-libmariadb CONFIG REQUIRED)
find_package(Poco REQUIRED COMPONENTS Data DataMySQL)
target_link_libraries(database_api
PRIVATE
unofficial::libmariadb
Poco::DataMySQL
)
I get this error message during the configure step (CMake):
CMake Error at src/libraries/external_interfaces/database_api/CMakeLists.txt:20 (find_package):
Could not find a package configuration file probided by
"unofficial-libmariadb" with any of the following names:
unofficial-libmariadbConfig.cmake
unofficial-libmariadb-config.cmake
Add the installation prefix of "unofficial-libmariadb" to CMAKE_PREFIX_PATH
or set "unofficial-libmariadb_DIR" to a directory containing one of the
above files. If "unofficial-libmariadb" provides a separate development
package or SDK, be sure it has been installed.
I tried adding mariadb-native to the DEPENDS on the bitbake recipe but then I get this error messagewhen configuring mariadb-native`:
CMake Error at /home/oe-core/build/tmp/work/x86_64-linux/mariadb-native/10.7.5-r0/recipe-sysroot-native/usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find GnuTLS (missing: GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR)
(Required is at least version "3.3.24")
Call Stack (most recent call first):
(...)
-- Configuring incomplete, errors occurred!
Ok I figured it out by using more recent versions of the mariadb recipes + vcpkg mariadb port patches:
For the mariadb-native build:
Add a mariadb-native_%.bbappend in a recipes-dbs/mysql/ folder in your layer:
DEPENDS:append = " gnutls-native fmt-native"
Alternative is to have the more recent mariadb-native_%.bb recipe as it is already included. If, like me, you have 10.7.4 or something, the bbappend is required.
For the unofficial-mariadb target:
Using Yocto's devtool on mariadb recipe, I just reproduced the patches that vcpkg port of libmariadb has (found here: https://github.com/microsoft/vcpkg/tree/master/ports/libmariadb). The one that matters is the modification to libmariadb/CMakeLists.txt (but from mariadb recipe this is libmariadb/libmariadb/CMakeLists.txt since this is a higher repo layer). This patch export unofficial-libmariadb and also uses the unofficial:: namespace. This makes my project compatible.
I want to be able to use bazel to organize a simple kotlin project.
I am using the templates as listed in rules_kotlin (https://github.com/bazelbuild/rules_kotlin)
This is my BUILD file
load("#io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")
kt_jvm_library(
name = "redis-tools",
srcs = glob(["*.kt"]),
deps = [],
)
This is my WORKSPACE file
load("#bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
rules_kotlin_version = "legacy-1.3.0"
rules_kotlin_sha = "4fd769fb0db5d3c6240df8a9500515775101964eebdf85a3f9f0511130885fde"
http_archive(
name = "io_bazel_rules_kotlin",
urls = ["https://github.com/bazelbuild/rules_kotlin/archive/%s.zip" % rules_kotlin_version],
type = "zip",
strip_prefix = "rules_kotlin-%s" % rules_kotlin_version,
sha256 = rules_kotlin_sha,
)
load("#io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kotlin_repositories", "kt_register_toolchains")
kotlin_repositories() # if you want the default. Otherwise see custom kotlinc distribution below
kt_register_toolchains() # to use the default toolchain, otherwise see toolchains below
My kotlin file main.kt:
import java.util.Scanner
fun main(args: Array<String>) {
// Creates a reader instance which takes
// input from standard input - keyboard
val reader = Scanner(System.`in`)
print("Enter a number: ")
// nextInt() reads the next integer from the keyboard
var integer:Int = reader.nextInt()
// println() prints the following line to the output screen
println("You entered: $integer")
}
I use a very simple file to test my setup.
Without bazel, I can do these to build: kotlinc main.kt -include-runtime -d test.jar
then run it with java -jar test.jar
When I use bazel build ., bazel creates a few folders. I tried to run java -jar bazel-out/darwin-fastbuild/bin/redis-tools.jar but it failed.
$ java -jar bazel-out/darwin-fastbuild/bin/redis-tools.jar
no main manifest attribute, in bazel-out/darwin-fastbuild/bin/redis-tools.jar
Did I miss a target? How can I run the main.tk from the bazel output?
The jar you are trying to run is missing a manifest file which declares its main class.
For executing a binary, Bazel uses a shell script wrapper which includes the required jvm flags and its run-time dependencies.
Notice that you are using kt_jvm_library. This rule builds a shared dependency without the wrapper. To include a wrapper you should use the kt_jvm_binary rule. Then you can specify the main class by setting the main_class attribute.
Notice that you can use the bazel run :redis-tools to run the jar (use -s to see which script Bazel excuted)
You can also use bazel build :redis-tools_deploy.jar to build a "fat-jar" which will include the manifest.
I've made a custom recipe for a third-party library.
It contains:
BBCLASSEXTEND =+ "native nativesdk"
The recipe builds a static library, depends on virtual/kernel and copies some headers - relatively simple.
I'm trying to install this into the host SDK for cross-compilation, but I'm having some issues.
When I try adding:
TOOLCHAIN_HOST_TASK_append = " nativesdk-<recipe>"
... to local.conf and run bitbake core-image-weston -c populate_sdk, BitBake completes, but the headers and library are absent from the host SDK (for my host's architecture).
When I try adding:
TOOLCHAIN_HOST_TASK_append = " <package>-staticdev"
... I get the following error:
package <package>-staticdev-1.11.0-r0.aarch64 does not have a compatible architecture
Any help would be appreciated.
As you don't need native part of recipe to run something on host (build machine) but target part, you should add the following line to add it to SDK:
TOOLCHAIN_TARGET_TASK_append = " <package>-staticdev <package>-dev"
Description of the problem / feature request / question:
I am trying to use bazel to build TensorFlow Library. It builds fine.
Additional Feature :
I would like to add OpenCL code in one of the files of TensorFlow. Added all the required code
AND added the following in one of the build files (tensorflow/core/BUILD), considering 'opencl' as the root directory of opencl.
cc_library( name = "opencl", hdrs=glob(["opencl/include/CL/*h"]),
visibility =["//visibility:public"], )
cc_library( name="all_kernels" , visibility= ["//visibility:public"],
copts=tf_copts() + ["-Ithird_party/opencl/include"], deps= [
"//third_party/opencl", ],
example to reproduce the problem:
By running
bazel build //tensorflow/examples/android:tensorflow_demo --fat_apk_cpu=armeabi-v7a --copt="-Ithird_party/opencl/include"
Issues Faced while building :
error: undefined reference to 'clEnqueueReadBuffer'
error: undefined reference to 'clReleaseMemObject'
error: undefined reference to 'clReleaseMemObject'
etc
Environment info
Operating System: Ubuntu 17.04
Bazel version (output of bazel info release): release 0.5.1
relevant searching on web?
How to add external header files during bazel/tensorflow build
information or logs or outputs that would be helpful?
bazel-out/android-arm-linux-androideabi-4.9-v7a-gnu-libstdcpp-fastbuild/bin/tensorflow/core/kernels/libandroid_tensorflow_kernels.lo(conv_ops.o):conv_ops.cc:function
matrixMul(float*, float*, int, int, int, int, int, int): error:
undefined reference to 'clGetPlatformIDs'
I tried linking directly to libOpenCL.so as shown below by referring https://bazel.build/versions/master/docs/tutorial/cpp.html#adding-dependencies-on-precompiled-libraries
, but still same issue
cc_library( name = "opencl", srcs = glob(["lib/x86_64/.so"]), hdrs =
glob(["include/CL/.h"]), visibility = ["//visibility:public"], )
Please help me in resolving the issues
The libOpenCL.so was red in color in terminal, which meant it was archived, replaced the file and issue is resolved
I'm doing my first steps with Qt and QtWebEngine on an embedded board (i.MX6), using Yocto. Using provided example recipes, like the quicknanobrowser, works nicely on the target. So I can't confirm this answer which claims that WebEngine is not available on embedded platforms.
Now I want to write my own QML application and deploy it on the board. With the recipe meta-toolchain-qt5 I created an SDK and installed it. In QtCreator I set all paths to the SDK installation and tried to build it, but got this error:
Project ERROR: Unknown module(s) in QT: webengine
11:13:13: The process "/opt/poky/1.8/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake" exited with code 3.
It turned out that WebEngine was not included in the SDK. Thanks to this answer, I fixed that by putting the following to my own packagegroup-qt5-toolchain-target.bbappend file:
RDEPENDS_${PN} += " \
qtwebengine \
qtwebengine-qmlplugins \
qtquickcontrols-qmlplugins \
qtwebengine-examples \
"
Then reinstalled the SDK. Now it seems that all WebEngine files are available in the SDK installation (the zsh glob pattern below matches all directories in any subdirectory of /opt/poky/1.8/, which contain "webengine", case-insensitively):
% ls -1 -d (#i)/opt/poky/1.8/**/*webengine*(/)
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWebEngine/
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWebEngine/5.4.3/QtWebEngine/
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWebEngineWidgets/
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWebEngineWidgets/5.4.3/QtWebEngineWidgets/
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib/qt5/qml/QtWebEngine/
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/share/qt5/examples/webengine/
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/share/qt5/examples/webenginewidgets/
/opt/poky/1.8/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/share/qt5/translations/qtwebengine_locales/
Still, I get the same Unknown module error. This is independent of QtCreator, and can also be shown by directly calling qmake:
% source /opt/poky/1.8/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
% /opt/poky/1.8/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake /home/me/test/test.pro -r -spec linux-oe-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug
Project ERROR: Unknown module(s) in QT: webengine
The project itself should be fine, because it compiles and runs without problems on the Desktop installation.
Any ideas? Are there maybe still some files missing in the SDK? Where does qmake search for the modules? How can I tell qmake where to find the WebEngine installation?
In /opt/poky/1.8/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
add sh /opt/poky/1.8/sysroots/x86_64-pokysdk-linux/environment-setup.d/qt5.sh
This will set up the Qt5 environment.