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

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.

Related

Yocto Add own Header and Lib file's to 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"

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

iOS Cydia THEOS, make install, Could not find deb package

I followed the instructions here and it happens in both tweak and app:
http://iphonedevwiki.net/index.php/Theos/Setup#Creating_a_Project
But I don't see any .deb files
RoverMR-2:testapp rover$ find . -name "deb"
Here are several relevant command output logs:
https://gist.github.com/anonymous/42b4a086d6b7ee792b08
I just see this in packages:
RoverMR-2:testapp rover$ ls -la .theos/packages/
total 8
drwxr-xr-x 3 rover staff 102 Apr 30 11:12 .
drwxr-xr-x 4 rover staff 136 Apr 30 11:12 ..
-rw-r--r-- 1 rover staff 1 Apr 30 11:12 com.mysite.testapp-0.0.1
RoverMR-2:testapp rover$ make package
/Users/rover/Documents/Dev/Cydia/Theos/apps/testapp/theos/makefiles/targets/Darwin/iphone.mk:41: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Making all for application testapp...
Copying resource directories into the application wrapper...
Compiling main.m...
Compiling testappApplication.mm...
Compiling RootViewController.mm...
Linking application testapp...
Stripping testapp...
Signing testapp...
Making stage for application testapp...
RoverMR-2:testapp rover$
RoverMR-2:testapp rover$ ls
Makefile RootViewController.h _ main.m testappApplication.mm
Resources RootViewController.mm control obj theos
RoverMR-2:testapp rover$
the error:
RoverMR-2:testapp rover$ make install
/Users/rover/Documents/Dev/Cydia/Theos/tweaks/testtweak/theos/makefiles/targets/Darwin/iphone.mk:41: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Could not find "./com.yourcompany.testtweak_0.0.1-10_iphoneos-arm.deb" to install. Aborting.
I posted an issue about this https://github.com/DHowett/theos/issues/120
Type make package install all at once in the tweak's directory.

'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

iOS Daemon app will not start (Jailbreak) when Installed it from Cydia

I developed a daemon that is tracking the location as given in the Chris Alvares webpage.
It is working fine if install it through SSH directly to the phone from mac terminal. It's not at all launching if I install the same daemon through Cydia. I am getting the error in the log as
Mar 3 16:07:11 Jailbreak-iPhone-5S installd[51] : 0×100590000
verify_signer_identity: MISValidateSignatureAndCopyInfo failed for
/Applications/Myapp.app/TsavoriteClient: 0xe800801c
Mar 3 16:07:11
Jailbreak-iPhone-5S installd[51] : 0×100590000 load_application_info:
Failed to validate binary at path /Applications/Myapp.app/Myapp:
0xe800801c. This binary may not work properly.
I tried all steps given in this post.
Any idea what's wrong here?
Finally found the solution after long debugging steps!
The problem is with the LaunchDaemon plist file ownership. If I copy plist from SSH the the file properties are as below
-rw-r--r-- 1 root wheel 461 Mar 3 15:20 com.Mycompany.Myapp.plist
If the LaunchDaemons copied by cydia the file properties are as below
-rw-r--r-- 1 503 staff 461 Mar 3 15:20 com.sourcebits.TsavoriteClient.plist
We need to change the LaunchDaemons plist file ownership before preparing the .deb file using the command
sudo chown -R root:wheel filePath

Resources