Preshared library loading error - IDEs, Libraries, & Programming Tools

Hi all,
i am kinda new here, so this might not be the best section to post such topic, so if there is more appropriate section would be good if moderators would move it there.
Now lets go to the problem:
I have downloades master revision of AOSP from git. Compiled all OS source in linux. After that compiled native/cmds/screenshot source with mmm command, just before compiling changed so that it would produce me shared library with .so extension instead of executable.
This way I got predefined shared library which I attached to hello-jni sample app from android-ndk-r10.
Everything compiled and built in eclipse without any errors, and I install that app on physical device (tried on samsung galaxy s2 with android 4.1.2 and samsung galaxy s5 with android version 4.4) Everything here is still ok, but if i try opening that app i am getting such error:
Code:
08-08 15:32:33.832: E/AndroidRuntime(12001): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]: 1694 cannot locate '__strrchr_chk'...
and this happens when i try loading that screenshot library with such code:
Code:
static {
System.loadLibrary("screenshot");
}
If anyone has had similar problems or have any ideas what might be wrong, I am happy to hear it.

Related

Thoughts on native binutils

I did an extensive search to try and find if anyone built binutils to run native on android and came up empty. I did, however, find someone who claims to have gotten Fortran to compile and run on android (specificimpulses.blogspot.com/2011/01/my-android-speaks-fortran-yours-can-too.html) He seems to have problems at the linker phase. I was wondering what people thought about the possibility. I would like to mess around with arm assembler on my android device whilst out and about...
So this is awesome, I set the build and the host environment to arm-android-eabi and I magickally got out i686-elf binaries that run on my linux workstation...amazing! I didn't know that cirrus made a processor with the smarts to automagically execute arm-android-eabi target code when presented with it...
../binutils-2.19.1/configure --prefix=/opt/compilers/gcc/native-android --build=arm-android-eabi --host=arm-android-eabi --target=arm-android-eabi --with-sysroot=../android-ndk-r5/platforms/android-8/arch-arm
So in addition to that I tried to wipe my path clean and point only to the binutils and gcc under the ndk-toolchain directory but it gave me the infamous 'cannot create working executable'....wow? ya think, config?
Anyone know how to turn off the test for building working executables when cross compiling, or perhaps to point in the configure script options where to find crti.o which is what was missing at the link phase?
Strike that, I mean Via. my workstation uses a via processor, not that that is important here...
Success! Well, in as much as I was able to compile binaries of some of the binutils and run them on my g-tab. I haven't tried to assemble a piece of code and link it yet. What I did was use the info in android-ndk-r5/docs/STANDALONE-TOOLCHAIN.html
which suggested that I run:
$NDK/build/tools/make-standalone-toolchain.sh --platform=android-5 --install-dir=/tmp/my-android-toolchain
which created a standalone toolchain self enclosed. I then set path carefully so I was pointing to the toolchain directory's bins. Then I ran configure using
../binutils-2.19.1/configure --prefix=/root/android --host=arm-android-eabi --target=arm-android-eabi
and made a few comments to code--real hacks like casting &stat.time to a time_t * and changing #ifdef tests to force inclusion of the correct code. I also had to link:
ln -s /root/my-android-toolchain/bin/arm-linux-androideabi-ar /root/my-android-toolchain/arm-android-eabi-ar
just because I was tired and didn't want to f**k with the compile script to get it to point to the correct set of toolchain binaries. In the end, I copied over nm-new, ld-new, as-new, and strip-new to my gtab and ran them and got errors that I expected like:
as-new aa.s
Error: can't open aa.s for reading: No such file or directory. Indicating that at least gas was running native on my gtab...
Of course, that is a first tiny step....
Btb, I had to unzip into the /data directory on android for the executables to run. Ran them in a terminal emulator...

Getting Android source in Eclipse on Windows 7 [solved]

Hi all, I'm just starting getting into App development and I want to attach the Android source code into Eclipse so that I can reference it locally. Is there anyone here who has experience doing this on Windows who is willing to walk me through it?
Alternatively, I'll go it on my own if someone could help me get past this one roadblock. Thus far I've installed Python and msysGit (and updated my PATH variable accordingly) so that I can use git and repo. Something isn't working however and repo runs into an error that I can't seem to figure out. I'm contemplating uninstalling all that and starting from scratch with Cygwin.
Here's a tutorial on setting up Eclipse on windows (albeit over a year old so no guarantees) link
personally I would dual boot linux... it was a breeze setting it up and there's plenty of tutorials for that.
You could install ubuntu (i think) side by side with win7 using wubi, as if it were a program or something. That way you're not messing with partitions.
I already have Eclipse set up. This is not the problem. I'm having trouble downloading the Android source code - NOT the SDK - on my Windows PC. Specifically, I always run into errors when I try to use "repo init -u blah blah" as instructed on the android source page. If someone has successfully done this on Windows, I'd like someone to give me some guidance, because either I'm doing something wrong or my setup is not correct.
Right now I'm trying to use Cygwin (basically creates a linux environment inside Windows). The last time I tried using repo, I got this:
EDIT: Code removed. I found a solution, outlined below, for anyone else who wants to get the Android source into Eclipse.
Okay, I got the source code, it was actually pretty easy to do, and I didn't even need repo to do it . For those who may find this useful, here's how.
0. It is assumed you have already installed both Eclipse and the Android SDK. If you don't have those yet, download them and set those up. If you aren't on Windows but still want to know how to get the source and import it into Eclipse, you can skip step 1.
1. Install Cygwin on your computer. During the installation, you will be presented with a package explorer and you can choose specific packages to install. Choose whatever you like, but make sure to include automake, bison, curl, flex, gcc, git, gnupg, python, zip, and an editor of your choice, like nano or vim (you can use the search field at the top to find these quickly).
This will basically give you a Linux shell on Windows whose root directory is something you've designated, like C:\cygwin.
2. A few more things to set up. Fire up Cygwin and make a bin folder in your home directory. Add this directory to your PATH variable, then cd into it.
Code:
mkdir ~/bin
PATH=~/bin:$PATH
cd bin
This blog post has code for a python script that will be used later. Make a new file using an editor of your choice. Copy the code and save the file as anything you want (I named it "pack.py"). When you're done, cd back to your home directory.
3. Downloading source. From your home directory (or a subdirectory if you wish), use git to clone the platform frameworks base into a new directory (here I've called it "android").
Code:
git clone http://android.git.kernel.org/platform/frameworks/base.git android
cd into that directory and examine the git tags.
Code:
cd android
git tag
You'll get a list of tags. Choose the one that matches the API level you want to build your project(s) in. I'm using API level 10, so I chose android-2.3.3_r1. That's what you're going to check out.
Code:
git checkout android-2.3.3_r1
4. Reorganizing the source code. You need to locate all the java source files and restructure everything into a directory structure that matches the package naming. Fortunately, that script from earlier does exactly this and then zips it up into a nice little package for you called "sources.zip".
Code:
python ~/bin/pack.py
5. Move this zip file to the proper SDK platform folder. Since I downloaded sources for API level 10, I want to move this zip file to
Code:
C:\android-sdk-windows\platforms\android-[B]10[/B]
You can do this with your regular old file explorer on Windows. Extract the contents into a subfolder named "sources".
6. Get Eclipse to recognize them. Open up a project (or start a new one) whose target is the API level you just did all that stuff for. In the package explorer, right-click the project root and click "Refresh". Now when you browse the class files under project-root/android 2.3.3/android.jar/whatever, you'll see actual source code instead of that nasty "Source not found" page.
Enjoy ^_^

Request to Deveopers only!!!

Hi Devs!!!!
I am a Software Engineer and i have a pretty good knowledge of C & Java.
But the problem is that i don't know anything about Linux, how to cook roms or what should be used to open files such as splboot, miniloader...
if any body could help me out with this i think i'd be useful in contributing to the success of our MISSION FREE XPERIA X8...
I need to know exactly how these things work so that i could start with development. Though i get less time in weekdays as I am working but i can definitely work upon these things in weekends and would love to help in any sort possible.
Any kind of explanation, links would be useful..
Thanks!!!
To work with Linux kernel: you need a Linux distro, some development packages, and Linux source
To work with Android source: you may want to start with Android Open Source Project, download the SDK, NDK. There is also instruction to get the source, build, and test. Later, look at the modifications provided by CyanogenMod, or VillianROM, or CodeAurora.
Good luck
Thanks buddy...i hope these links would help me..
hey doixanh!!!
i downloaded jdk, git.tar.gz, python.tar.gz
but i am unable to use it....i was reading the documentation on Android Open Source on how to use it but it doesn't seem to be helpful.
The command that i am trying is ::
repo init -u git://android.git.kernel.org/platform/manifest.git
and m getting the followinig error ::
Traceback (most recent call last):
File "/home/mohit/bin/repo", line 603, in <module>
main(sys.argv[1:])
File "/home/mohit/bin/repo", line 570, in main
_Init(args)
File "/home/mohit/bin/repo", line 184, in _Init
_CheckGitVersion()
File "/home/mohit/bin/repo", line 213, in _CheckGitVersion
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
File "/usr/lib/python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
--------------------------------------------
i am completly new to linux and so i'd be glad if u can help me out in getting started...
awaiting your reply..
Thanks
hey doixanh!!
i am stuck at a point...need your help to go further.
i downloaded the android kitchen yesterday but didn't find much use of it.(plz tell me if i am wrong)
i followed the steps mentioned on the Android Source website and it said to check out the source from git hub using the $ repo sync command.. i did that but it started downloading everything from there which i think we don't require...so now i want to know what all sources do i need to checkout from git hub so that i can work upon those.,,also if you could tell me how to open and modify .ko files(these are the kernel files i guess) i want to have a look into these files and see how things work in our device.
also what other things that i would need, plz let me know so that i can download them...as per now i have python 2.7, JDK 6, android kitchen, and android sdk...Is there any thing else that i would require..

[TOOL] [PROJECT] New bugreport analysis tool - open source project by Sony Ericsson

Hi all,
ChkBugReport is a tool that helps you analyze your crash files. Because this tool is such a great help for our internal developers at Sony Ericsson, and as a part of our ambition to step up our open source activities, we want to give all of you the chance to use it by making it open source. Pál Szász (XDA username: pal.szasz), a software developer at Sony Ericsson, is the creator of this tool and will monitor this thread for questions, discussions and suggestions. Feel free to have a look at the open source project and contribute to make it even better!
https://github.com/sonyericssondev/ChkBugReport
For the full story follow the full story in Developer World
/Karl-Johan Dahlström
Sony Ericsson Developer Program
Nice. Any intention of integrating this into some IDE ?
I haven't thought about IDE integration. What do you have in mind exactly?
What I'm working on is automatically opening the result in a browser when processing done (already in the source code, although I tested only in osx at the moment).
Another functionality in progress (not uploaded yet) is to use ADB to automatically save a bugreport. So you would just execute
Code:
chkbugreport --browser adb://
and it will save the bugreport, analyze it and open the result in a browser (as a bonus a screenshot is saved as well).
When this would be implemented I think it would be easy to add it as an external tool in eclipse and launch it from there.
pal.szasz said:
I haven't thought about IDE integration. What do you have in mind exactly?
What I'm working on is automatically opening the result in a browser when processing done (already in the source code, although I tested only in osx at the moment).
Another functionality in progress (not uploaded yet) is to use ADB to automatically save a bugreport. So you would just execute
Code:
chkbugreport --browser adb://
and it will save the bugreport, analyze it and open the result in a browser (as a bonus a screenshot is saved as well).
When this would be implemented I think it would be easy to add it as an external tool in eclipse and launch it from there.
Click to expand...
Click to collapse
One possible IDE integration would be for the report to have linkable parts to the source code when applicable.
Also selecting the process from a windows, having UI buttons starting and stopping the capture of profiling data would be a bonus.
Anyway, the application works very well, and thumbs up for open sourcing this tool .
BTW in my case I've came across some missing resources when generating output:
Code:
Writing chapter: Trace charts/Thread-17 (Thread-18)...
Writing chapter: Main thread activity...
Writing footer...
Cannot find resource: /style.css
Cannot find resource: /icons.png
Cannot find resource: /ftrace-legend-dred.png
Cannot find resource: /ftrace-legend-black.png
Cannot find resource: /ftrace-legend-yellow.png
Cannot find resource: /ftrace-legend-red.png
Cannot find resource: /ftrace-legend-cyan.png
Cannot find resource: /ftrace-legend-dcyan.png
Cannot find resource: /pcy_p0.png
Cannot find resource: /pcy_p1.png
Cannot find resource: /pcy_p2.png
Copying extra resources...
Cannot find resource: /pcy_p3.png
Cannot find resource: /pcy_p4.png
Cannot find resource: /pcy_un.png
Cannot find resource: /pcy_rt.png
Cannot find resource: /pcy_fg.png
Cannot find resource: /pcy_bg.png
Cannot find resource: /main.js
Cannot find resource: /jquery.js
Cannot find resource: /jquery.cookie.js
Cannot find resource: /jquery.jstree.js
Cannot find resource: /jquery.hotkeys.js
Cannot find resource: /jquery.tablesorter.js
Cannot find resource: /jquery.tablednd.js
Cannot find resource: /themes/classic/d.png
Cannot find resource: /themes/classic/dot_for_ie.gif
Cannot find resource: /themes/classic/throbber.gif
Cannot find resource: /themes/classic/style.css
Cannot find resource: /themes/blue/desc.gif
Cannot find resource: /themes/blue/bg.gif
Cannot find resource: /themes/blue/style.css
Cannot find resource: /themes/blue/asc.gif
DONE!
Regarding the resource errors: did you used the precompiled binary or compiled the source code yourself? If it's the later one, how did you compile it? While developing I use eclipse, and I have the "res" folder added a source folder as well. This way the contents of the res folder will be copied to the jar. If you compiled it in some other way, then probably the resources from "res" where not packed into the jar. Building with the ant file should work as well ("ant -f chkbugreport.xml" if I remember correctly)
Regarding the IDE integration: yes, linking/binding the source code would be nice. For tracing data there is already something in progress: running "chkbugreport -t adb://" will show a window to select a process and start/stop it's profiling, but since that code uses code from the android sdk, I need to check how I can link the two codes together (since one of the codes is GPL, the other is Apache) before I can publish it.
I uploaded the changes for adb support. Now an extra jar file is needed: ddmlib.jar. You can find this either in the source code repo, or in the android sdk (a recent one is needed).
I updated the wrapper script as well, to use ddmlib.jar. However if the ddmlib.jar is missing, then the tool will still work like before, simply the new functionality will be missing, which is:
Code:
chkbugreport --browser adb://
The above command will run the bugreport tool on the phone (if it's connected to the PC, of course), processes it and open the result in the browser. As extra bonus, a screenshot is saved as well ;-)
Code:
chkbugreport --browser -t adb://
This will show a window, where you can select which process to trace. Click START then STOP, and the tracefile will be created and processed (and opened in the browser). BUT: there are some limitations:
* adb must be run as root (the tracefile is saved to the /data partition), which means either run en ENG build or USERDEBUG (but then you must first execute "adb root")
* it seems that the fileformat for traceview files have changed, the tool currently supports only version 1, so this will not work if you have a recent android version. I'll fix this later.
pal.szasz said:
Regarding the resource errors: did you used the precompiled binary or compiled the source code yourself? If it's the later one, how did you compile it? While developing I use eclipse, and I have the "res" folder added a source folder as well. This way the contents of the res folder will be copied to the jar. If you compiled it in some other way, then probably the resources from "res" where not packed into the jar. Building with the ant file should work as well ("ant -f chkbugreport.xml" if I remember correctly)
Regarding the IDE integration: yes, linking/binding the source code would be nice. For tracing data there is already something in progress: running "chkbugreport -t adb://" will show a window to select a process and start/stop it's profiling, but since that code uses code from the android sdk, I need to check how I can link the two codes together (since one of the codes is GPL, the other is Apache) before I can publish it.
Click to expand...
Click to collapse
I compiled my own using IDEA, but since I didn't get any errors during compilation (I think) I didn't assume I was missing something in the compilation process.
About the other changes, why not output the traces to /sdcard ? Since that one is always R/W to all users should work right? I say this without actually having looked at the code behind the magic, so perhaps is not a valid suggestion.
I am planning to add support for that as well (i.e. the user can select where to save the tracelogs). AFAIK the sdcard is only readable for everyone by default, apps need to have a certain permission (something with WRITE_EXTERNAL_STORAGE) in order to be able to write to sdcard. But if you are debugging your own app, that's not a problem.
I haven't updated this thread in a looong time. I'm pretty close to put up some more detailed documentation and examples, hopefully I can do it tomorrow.
Meanwhile as a teaser here is an example report generated from a bugreport: http://sonyericssondev.github.com/ChkBugReport/examples/bugreport_aidldeadlock_out/index.html
The shell user does have permissions to write to sdcard, so if you're doing that via adb it should be good.
Sent from my GT-P1000
Well, finally I had time to add some documentation: https://github.com/sonyxperiadev/ChkBugReport/wiki (it's not complete, but at least a good start)
Also source code is pushed and added a new precompiled jar (I started to add the version number in the filename so I can keep the old versions as well): https://github.com/sonyxperiadev/ChkBugReport/downloads
And as usual, any kind of feedback is welcome
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
New link: https://github.com/sonyxperiadev/ChkBugReport
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Since I cannot edit the first post (since it was not created by me), and the link is broken, I started a new thread: http://forum.xda-developers.com/showthread.php?p=34960691
clear post
pal.szasz said:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
New link: https://github.com/sonyxperiadev/ChkBugReport
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Click to expand...
Click to collapse
There are many people, new to development.
Always try to post step by step instruction which will help others....
Is there anyone here that can look at a bug report that popped up on my friend's phone and be able to tell who hacked her phone? She is in bitter custody battle and we are trying to prove it is the ex doing this with intent for court purposes. Please help! If willing please respond and I will give a private email address to private message due to complex circumstances and we all fear for child and our lives. Thanks in advance.
Hi, what are these colorful icons mean in the VM traces info?

Help Please! Android C/C++: Where to find selinux/selinux.h and ctuils, properties.h

edited (solution): I forgot I had another thread on this same basic topic. You have to merge AOSP + Device Sources + Hardware Drives and set it up to build the sources.
https://forum.xda-developers.com/android/software/toolbox-c-struct-define-toolname-tool-s-t3568409
If I try to compile my own customize 'toolbox' binary for example, I can't find the headers anywhere in the toolchains or included headers. I can search them down from Google sources but I gave up after tools.h. I have a feeling this is NOT the way I am supposed to be doing it.
Is there a shared library on my device that I pull off to get these headers? (lib?????.so).. Where do I get headers for Android/log.h and cutils properties.h and selinux.h ??? Or are we not supposed to compile these binaries on a Ubuntu machine? (do I compile them on the device itself?)
ediit: (here's compiling it another way, obviously I can make a hack easily but working with Android is so much harder.)
arm-linux-gnueabi-gcc -static -march=armv8-a toolbox.c -o toolbox
toolbox.c:6:25: fatal error: android/log.h: No such file or directory
compilation terminated.
edit, solved i think
I think it's stand alone toolchain not defined. If that's not the answer, it's a fun answer so I'm playing with that. If I don't have the answer I will pass the question up, download sources and start trying to compile Android proper. (which is my new goal now, I want open source phone and I want to compile my own OS 100%, besides the closed sources, it's so exciting!!) ~so much for sleep

Categories

Resources