Yocto Add own Header and Lib file's to sdk - sdk

i want to add .h and .lib files to a own created recipe to the sdk.
I use cmake to build my lib's, with the sdk i can build it.
My recipe name is served. (i want to add the served https://github.com/meltwater/served as a own recipe).
in my served_0.1.bb File i add following:
BBCLASSEXTEND = "native nativesdk"
RDEPENDS_${PN} += "nativesdk-served"
in the layer.conf i add:
TOOLCHAIN_TARGET_TASK_append = " served "
When i start to create my sdk with
bitbake core-image-base -c populate_sdk
ERROR: core-image-base-1.0-r0 do_populate_sdk: Could not invoke dnf. Command '/home/yocto/videoMon/build/tmp/work/raspberrypi4_64-poky-linux/core-image-base/1.0-r0/recipe-sysroot-native/usr/bin/dnf -v --rpmverbosity=info -y -c /home/yocto/videoMon/build/tmp/work/raspberrypi4_64-poky-linux/core-image-base/1.0-r0/sdk/image/opt/poky/3.2.4/sysroots/cortexa72-poky-linux/etc/dnf/dnf.conf --setopt=reposdir=/home/yocto/videoMon/build/tmp/work/raspberrypi4_64-poky-linux/core-image-base/1.0-r0/sdk/image/opt/poky/3.2.4/sysroots/cortexa72-poky-linux/etc/yum.repos.d --installroot=/home/yocto/videoMon/build/tmp/work/raspberrypi4_64-poky-linux/core-image-base/1.0-r0/sdk/image/opt/poky/3.2.4/sysroots/cortexa72-poky-linux --setopt=logdir=/home/yocto/videoMon/build/tmp/work/raspberrypi4_64-poky-linux/core-image-base/1.0-r0/temp --repofrompath=oe-repo,/home/yocto/videoMon/build/tmp/work/raspberrypi4_64-poky-linux/core-image-base/1.0-r0/oe-sdk-repo --nogpgcheck install packagegroup-base-extended packagegroup-core-boot packagegroup-core-standalone-sdk-target psplash-raspberrypi run-postinsts served target-sdk-provides-dummy' returned 1:
DNF version: 4.2.23
cachedir: /home/yocto/videoMon/build/tmp/work/raspberrypi4_64-poky-linux/core-image-base/1.0-r0/sdk/image/opt/poky/3.2.4/sysroots/cortexa72-poky-linux/var/cache/dnf
Added oe-repo repo from /home/yocto/videoMon/build/tmp/work/raspberrypi4_64-poky-linux/core-image-base/1.0-r0/oe-sdk-repo
User-Agent: falling back to 'libdnf': could not detect OS or basearch
repo: using cache for: oe-repo
oe-repo: using metadata from Sun 06 Jun 2021 03:50:26 PM UTC.
Last metadata expiration check: 0:00:01 ago on Sun 06 Jun 2021 03:50:26 PM UTC.
--> Starting dependency resolution
--> Finished dependency resolution
Error:
Problem: conflicting requests
nothing provides nativesdk-served needed by served-1.0+git0+2eb36b83fa-r0.cortexa72 (try to add '--skip-broken' to
skip uninstallable packages)
ERROR: Logfile of failure stored in:
/home/yocto/videoMon/build/tmp/work/raspberrypi4_64-poky-linux/core-image-base/1.0-r0/temp/log.do_populate_sdk.27092
ERROR: Task
(/home/yocto/videoMon/meta/recipes-core/images/core-image-base.bb:do_populate_sdk)
failed with exit code '1'
Have anyone an idea?
Bests

Assuming that you have a recipe for served which compiles without errors.
The step to add served .h and lib files to sdk is to add below line to local.conf
TOOLCHAIN_TARGET_TASK_append = " served "
And then run command
bitbake core-image-base -c populate_sdk
The lines below in your served recipe are causing errors and are not needed for SDK generation. Please remove them and try building your image again.
BBCLASSEXTEND = "native nativesdk"
RDEPENDS_${PN} += "nativesdk-served"

Related

Jenkins compiler warnings plugin not showing C or C++ source code

My build script includes
make clean
make all
make invokes gcc:
gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
my post-build step is to, "scan for compiler warnings" and I chose the parser for GNU C Compiler 4 (gcc).
Is that enough? Did I miss anything?
My console log shows
[WARNINGS] Parsing warnings in console log with parser GNU C Compiler 4 (gcc)
[WARNINGS] Computing warning deltas based on reference build #72
When I click on the compiler warnings chart and drill down to a single source file, I get
Copying the source file '../software_under_test/maths.c' from the workspace to the build folder '8410a4f3.tmp' on the Jenkins master failed.
02 Seems that the path is relative, however an absolute path is required when copying the sources.
03 Is the file 'maths.c' contained more than once in your workspace?
04 Is the file '../software_under_test/maths.c' a valid filename?
05 If you are building on a slave: please check if the file is accessible under '$JENKINS_HOME/[job-name]/../software_under_test/maths.c'
06 If you are building on the master: please check if the file is accessible under '$JENKINS_HOME/[job-name]/workspace/../software_under_test/maths.c'
07 java.io.IOException: Failed to copy ../software_under_test/maths.c to /home/mawg/.jenkins/jobs/plain_C_project/builds/73/workspace-files/8410a4f3.tmp
08 at hudson.FilePath.copyTo(FilePath.java:1991)
09 at hudson.plugins.analysis.util.Files.copyFilesWithAnnotationsToBuildFolder(Files.java:80)
10 at hudson.plugins.analysis.core.HealthAwareRecorder.copyFilesWithAnnotationsToBuildFolder(HealthAwareRecorder.java:312)
11 at hudson.plugins.analysis.core.HealthAwarePublisher.perform(HealthAwarePublisher.java:89)
12 at hudson.plugins.analysis.core.HealthAwareRecorder.perform(HealthAwareRecorder.java:259)
13 at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:75)
14 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
15 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
16 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
17 at hudson.model.Build$BuildExecution.post2(Build.java:185)
18 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
19 at hudson.model.Run.execute(Run.java:1766)
20 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
21 at hudson.model.ResourceController.execute(ResourceController.java:98)
22 at hudson.model.Executor.run(Executor.java:408)
23 Caused by: java.io.FileNotFoundException: ../software_under_test/maths.c (No such file or directory)
24 at java.io.FileInputStream.open(Native Method)
25 at java.io.FileInputStream.<init>(FileInputStream.java:146)
26 at hudson.FilePath$41.invoke(FilePath.java:2017)
27 at hudson.FilePath$41.invoke(FilePath.java:2012)
28 at hudson.FilePath.act(FilePath.java:991)
29 at hudson.FilePath.act(FilePath.java:969)
30 at hudson.FilePath.copyTo(FilePath.java:2012)
31 at hudson.FilePath.copyTo(FilePath.java:1986)
32 ... 14 more
What am I doing wrong?
This page says that the code is looking for the string "Entering directory" in the build output and the code verifies this.
I tweaked my make step to output that by adding the --print-directory to the make command and got
+ make all --print-directory
make: Entering directory `/home/mawg/workspace/unit_test_C_code_example_project/Debug'
Building file: ../test_scripts/test_maths.c
Invoking: GCC C Compiler
gcc -DUNIT_TEST -I"/home/mawg/workspace/unit_test_C_code_example_project/mocks" -I"/home/mawg/workspace/unit_test_C_code_example_project/software_under_test" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"test_scripts/test_maths.d" -MT"test_scripts/test_maths.d" -o "test_scripts/test_maths.o" "../test_scripts/test_maths.c"
Finished building: ../test_scripts/test_maths.c
etc, but that did not help.
So, can anyone tell me how to configure things so that I an drill down into the source code from the Jenkins compiler warnings plugin?
This was one of the first results when I had this problem, but I have since found that as of at least 2018-07 there is an advanced setting to “Resolve relative paths” (not sure when this was added), but this solved the same problem for me
Update:
After adding the Scan for compiler warnings Post Build action in Jenkins, there will be an Advanced button.
After clicking Advanced a list of options appears. Some way down this list there is a section titled Resolve relative paths, clicking on this solved my problem.
This was in the Warning plugin version 4.66
Solved!
I had the same Problem and got rid of it after following changes:
I set the at the Source Code Management-->Local module Directory
a Period following the checkout Folder of the Project i.e. "./project1"
I didnt have the "./" before.
I added also to the make command the Option --print-directory.
Now it works as expected!
Ok, solved!
The problem was that the makefile generated by Eclipse contain ed a relative path. Relative to the makefile directory that it, but the Jenkins compiler warning plugin was treating it as relative to the Jenkins workspace.
The solution is to edit the makeilfe. Do it once for a manually created makefile. If you use Eclipse it constantly regenerates the makefiles, so the trick is to edit the Jenkins shell script to change the makefile on the fly, immediately prior to building.
Note that I only changed the makefile for the Software Under Test directory. I am not interested in compiler warnings in Google Test, etc
So, now my Jenkins shell script starts
cd /home/mawg/workspace/unit_test_C_code_example_project/Debug
# Tweak the makefile to use an absolute path to the Software Under Test.
# If we use a relative path then the Jenkins comiler wanrings plugin
# cannot find the source code to display it, so that we can drill down
# into it and see the compiler warnings in situ.
sed 's|\.\./software_under_test/maths.c|/home/mawg/workspace/unit_test_C_code_example_project/software_under_test/maths.c|g' /home/mawg/workspace/unit_test_C_code_example_project/Debug/software_under_test/subdir.mk > /home/mawg/workspace/unit_test_C_code_example_project/Debug/software_under_test/subdir.mk.absolute
rm software_under_test/subdir.mk
mv software_under_test/subdir.mk.absolute software_under_test/subdir.mk
make clean
# The --print-directory option is required for the compiler warning plugin
make all --print-directory

ant debug failed to include gdb.setup in the apk file

I've been building (from a mac terminal) this native application successfully for a long time but today I've run across an error I can't seem to pin down. After tiring from all the javac warnings I upgraded to a newer version of ant. I'm not sure it is related but the timing is suspect. I can still build, deploy, and run my application but now I can no longer use ndk-gdb to debug the native part of the application. It appears on inspection that the gdb.setup file is not getting added to the debug apk.
here is the build sequence, abbreviated output, and information. I'm looking for suggestions on how to resolve the issue.
I've done a full clean on both NDK and ant builds
The android NDK version and android SDK versions are all up to date.
I use the built in ndk-bundle that gets loaded with the android studio sdk tools.
The devices we develop on are not rooted and is not an option.
hsmith$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
hsmith$ $ANT_HOME
-bash: /Users/hsmith/dk/ant/apache-ant-1.9.6: is a directory
hsmith$ ndk-build -j4 NDK_DEBUG=1
[armebi-v7a] Gdbserver : [arm-linux-androideabi-4.8] libs//gdbserver
[armebi-v7a] Gdbsetup : libs//gdb.setup
[armebi-v7a] Install : lib1.so => libs/armebi-v7a/lib1.so
[armebi-v7a] Install : lib2.so => libs/armebi-v7a/lib2.so
[armebi-v7a] Install : lib3.so => libs/armebi-v7a/lib3.so
hsmith$ ant debug
…
-package:
[apkbuilder] Found modified input file
[apkbuilder] Creating -debug-unaligned.apk and signing it with a debug key...
-post-package:
-do-debug:
[zipalign] Running zip align on final apk...
[echo] Debug Package: /Users/hsmith/packageFolder/bin/<package>-debug.apk
[propertyfile] Updating property file: /Users/hsmith/packageFolder/bin/build.prop
[propertyfile] Updating property file: /Users/hsmith/packageFolder/bin/build.prop
[propertyfile] Updating property file: /Users/hsmith/packageFolder/bin/build.prop
[propertyfile] Updating property file: /Users/hsmith/packageFolder/bin/build.prop
-post-build:
debug:
BUILD SUCCESSFUL
hsmith$ adb install -r ~/packageFolder/bin/-debug.apk
hsmith$ ndk-gdb adb --start
ERROR: Package is not debuggable ! You can fix that in two ways:
Rebuilt with the NDK_DEBUG=1 option when calling 'ndk-build'.
Modify your manifest to set android:debuggable attribute to "true",
then rebuild normally.
After one of these, re-install to the device!
I unzipped the apk file to find
unziped apk file/lib/target/
hsmith$ ls -la
total 48264
drwxr-xr-x 12 hsmith staff 408 Aug 25 14:50 .
drwxr-xr-x 5 hsmith staff 170 Aug 25 14:50 ..
-rwxr-xr-x 1 hsmith staff 409940 Jun 3 11:47 gdbserver
-rwxr-xr-x 1 hsmith staff 33920 Aug 25 14:44 lib1.so
-rwxr-xr-x 1 hsmith staff 165092 Aug 25 14:44 lib2.so
-rwxr-xr-x 1 hsmith staff 1614028 Aug 25 14:44 lib3.so
note there is no gdb.setup file
I don't use debuggable=true in the manifest because it isn't needed anymore however including it has no affect on the result.
UPDATE: https://code.google.com/p/android/issues/detail?id=183455
This is exactly the problem I'm having. if you copy the target gdb.setup file from the target directory to the ./lib directory you can get ndk-gdb to work; The COMPAT_ABI variable in ndk-gdb isn't being set correctly and sending the script into a spin. I hope they fix this one soon. almost three days wasted on a broken tool chain.
UPDATE: https://code.google.com/p/android/issues/detail?id=183455 This is exactly the problem I'm having. if you copy the target gdb.setup file from the target directory to the ./lib directory you can get ndk-gdb to work; The COMPAT_ABI variable in ndk-gdb isn't being set correctly and sending the script into a spin. I hope they fix this one soon. almost three days wasted on a broken tool chain.

Building OpenCV with CUDA support Error on transpose.cu

Recently I am trying to build OpenCV with CUDA support, and I met problem while building the module cudaarithm.
OpenCV source: git cloned from : http://github.com/Itseez/opencv.git
OpenCV branch: master branch
OpenCV commit:
`commit 5466e321b8c8f97536002a357e5b7ff49a5d2bf9, on Tue Feb 10 12:17:11 2015 +0000`
CUDA version: CUDA 6.5
Hardware: MacBook Pro (13-inch, Mid 2010)
GPU: NVIDIA GeForce 320M 256 MB
OS Version: OS X Yosemite
Steps I used:
1. cd in OpenCVSource, then mkdir myrelease, and cd myrelease
2. cmake -DPLANTUML_JAR=/usr/local/Cellar/plantuml/8002 -D BUILD_DOCS=1 -DPYTHON2_LIBRARY=/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib -DPYTHON2_INCLUDE_DIR=/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DPYTHON3_LIBRARY=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4m.dylib -DPYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/include/python3.4m -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -Wno-dev -DNVCC_FLAGS_EXTRA="-Xcompiler -stdlib=libstdc++; -Xlinker -stdlib=libstdc++" -DOPENCV_EXTRA_CXX_FLAGS=" -stdlib=libstdc++" -DOPENCV_EXTRA_EXE_LINKER_FLAGS="-stdlib=libstdc++" ..
3. make VERBOSE=1
Expect Result: Building success without error
Actual Result: when building OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu, error happend like below:
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(61): *error: identifier "getInputMat" is undefined*
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(67): *error: identifier "getOutputMat" is undefined*
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(92): *error: identifier "syncOutput" is undefined*
Then what action I take:
check the code and I found these undefined symboles are defined in OpenCVSource/modules/core/include/opencv2/core/private.cuda.hpp
check the code and I confrim that the "transpose.cu" file include "opencv2/core/private.cuda.hpp"
check the building log, and I the confirm the private.cuda.hpp is in the search path of header file
cp "opencv2/core/private.cuda.hpp" as another file "opencv2/core/hawk.hpp", and then edit "transpose.cu" to include this new file, and I found
the "undifined symbole error" disapeared.
Although this is a workable workaround, I would like know whether the original OpenCV source cannot be compiled.
All, I think I found the problem cause.
Before I met such problem, I've already build and install OpenCV using older code from the git repo. So that there already have header files in my /usr/local/include/opencv2, especially there is /usr/local/include/opencv2/core/private.cuda.hpp.
However, it is an older one that doesn't define the symbols reporting undefined in above question. At the same time I found during the building nvcc have -I/usr/local/include in the command line, so that it use wrong private.cuda.hpp. As you know it should use the one in OpenCVSource, not the older installed one.
I think the solution is to gracefully remove the original installed OpenCV from my computer, then build again. I am trying and I will report later.

compile vlc for android

I am trying to compile vlc for android in RHEL 6.4 (Santiago). I am following the instructions given in this page https://wiki.videolan.org/AndroidCompile. I am getting some errors.
First is when I build this, I get error in git.
error: unknown switch `B'. refer http://txt.do/6tjh for log
I changed the git checkout -B android ${TESTED_HASH} to git checkout -b android ${TESTED_HASH}. Then this error does not come
Then when I run sh compile.sh, I get following errors (refer http://tny.cz/bb552912 I have removed some part of log which had code to download packages like automake, protobuf, ragel etc)
rmdir: failed to remove /root/Documents/android/android/vlc/contrib/arm-linux-androideabi/include/freetype2/freetype/config': No such file or directory
make[1]: [install] Error 1 (ignored)
rmdir: failed to remove `/root/Documents/android/android/vlc/contrib/arm-linux-androideabi/include/freetype2/freetype': No such file or directory
make[1]: [install] Error 1 (ignored)
Then if I again run sh compile.sh, weird things happen. I don't get this error again, but it builds some library and then stops.
First it build libdvdcss and then stops (refer http://tny.cz/5f3ab58f)
It ends like
Libraries have been installed in:
/root/Documents/android/android/vlc/contrib/arm-linux-androideabi/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following:
add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution
add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
use the `-Wl,-rpath -Wl,LIBDIR' linker flag
have your system administrator add LIBDIR to `/etc/ld.so.conf'
make[2]: Leaving directory `/root/Documents/android/android/vlc/contrib/contrib-android-arm-linux-androideabi/dvdcss'
make[1]: Leaving directory `/root/Documents/android/android/vlc/contrib/contrib-android-arm-linux-androideabi/dvdcss'
touch .dvdcss
Then each time I run "sh compile.sh" it build one more library and then stops.
it has build following libraries
libopenjpeg (http://tny.cz/86236e8b)
libgpg-error http://tny.cz/26c5626b)
ffmpeg (http://tny.cz/1f05aa0f)
gmp
libgcrypt
iconv
nettle
libjpeg
Finally I get an following error and I am not able to do any after that (http://tny.cz/ed7798ea)
autopoint: * The AM_GNU_GETTEXT_VERSION declaration in your configure.ac file requires the infrastructure from gettext-0.18 but this version is older. Please upgrade to gettext-0.18 or newer.
autopoint: * Stop.
autoreconf: autopoint failed with exit status: 1
configure.in:20: error: possibly undefined macro: AM_PROG_LIBTOOL
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /root/Documents/android/android/vlc/extras/tools/build/bin/autoconf failed with exit status: 1
make: *[.ogg] Error 1
I am not able to find gettext package with version > .18 for RHEL 6.4. Maximum available is .17 which is installed
Is not this weird. Should not doing "sh compile.sh" build all libraries and I should not have to do this again and again.
Also Is RHEL 6.4 (Santiago) compatible for building vlc android
Any help for these errors

'FacebookSDK/FacebookSDK.h' file not found

I already installed the latest version of phonegap-facebook-plugin
But when i build the project, I got the error message below.
I tried many solutions mentioned at stackoverflow and other websites with no positive result.
com.phonegap.plugins.facebookconnect/FacebookConnectPlugin.m:11:
Et3arrafApp/Plugins/com.phonegap.plugins.facebookconnect/FacebookConnectPlugin.h:11:9: fatal error:
'FacebookSDK/FacebookSDK.h' file not found
#import <FacebookSDK/FacebookSDK.h>
^
1 error generated.
** BUILD FAILED **
The following build commands failed:
CompileC build/Et3arrafApp.build/Debug-iphonesimulator/Et3arrafApp.build/Objects-normal/i386/FacebookConnectPlugin.o Et3arrafApp/Plugins/com.phonegap.plugins.facebookconnect/FacebookConnectPlugin.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Error: /Users/apple/Desktop/et3arraf/platforms/ios/cordova/build: Command failed with exit code 65
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
I encountered the same problem today.
Installing this plugin using the plugin register does not work (for iOS) at the moment.
You must clone the repository (phonegap-facebook-plugin) to your local file system, say $HOME/src/phonegap-facebook-plugin. And then install the plugin pointing to that path, e.g. cordova plugin add $HOME/src/phonegap-facebook-plugin
...
It turns out that FacebookSDK.framework isn't installed properly when fetching through the plugin registry. It should look like this:
$ ls -l plugins/com.phonegap.plugins.facebookconnect/platforms/ios/FacebookSDK.framework/
total 24
lrwx------ 1 mjl staff 24 Aug 15 15:23 FacebookSDK -> ./Versions/A/FacebookSDK
lrwx------ 1 mjl staff 20 Aug 15 15:23 Headers -> ./Versions/A/Headers
lrwx------ 1 mjl staff 22 Aug 15 15:23 Resources -> ./Versions/A/Resources
drwx------ 4 mjl staff 136 Aug 15 15:23 Versions
But the symlinks aren't preserved when installing through the plugin registry... They are preserved when installing from the local file system though.
I had solved it by installing the plugin using --save option.
in my case I had downloaded the plugin to my computer and what I did is :
cordova plugin add --save <my downloaded plugin directory> --variable APP_ID=<app_id> --variable APP_NAME=<app_name>
The required file will be listed same as #mjl's result from ls -l plugins/com.phonegap.plugins.facebookconnect/platforms/ios/FacebookSDK.framework/
P/S: if you are using iTerm, you can drag the folder into your iTerm terminal and the full directory path will be type in automatically.
After more and more search around the web, I tried to re create the sym link of Headers, FacebookSDK and Resources and resolved
ln -s ./Versions/A/Headers Headers
and so on

Resources