V8 build for android on mac - android

I try to build v8 for android on mac. My steps are below :
Install depot_tools
fetch v8
cd v8
git checkout branch-name (last stable version for android)
echo "target_os = ['android']" >> ../.gclient && gclient sync --nohooks
make android_arm.release android_ndk_root=[full path to ndk]
It says that
no archive symbol table (run ranlib)
I search this issue. There is a bug for this state. But it is not solved yet.
I try to create d8 and push the android device. How can I do it?
EDIT
v8 guide provides building with GN.
I pass the ndk-root path using gn gen out.gn/arm.release/ --args='is_debug=false android_ndk_root="/path/android-ndk" target_os="android" arm_arch="armv7-a" android_sdk_root="/path/android-sdk-r25" v8_static_library=true android_ndk_version="r11b"'
Then I run ninja -C out.gn/arm.release/, the error is below :
ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/libgcc.a', needed by 'obj/libv8_base.a', missing and no known rule to make it
That is right. Because my libgcc under 4.9 folder not 4.9.x. How can I set libgcc path?

The up-to-date build instructions are at https://github.com/v8/v8/wiki/Cross-compiling-for-ARM. Anything that says "make android_arm" is outdated.
However, I don't know if building for Android on Mac is supported. It definitely works on Linux (so you could try in a VM). If something doesn't work, and you want to make it work, we'd happily accept patches; see https://github.com/v8/v8/wiki/Contributing.

you do not need to set ANDROID_NDK.
step 5:"target_os = ['android']" >> ../.gclient && gclient sync" will download ndk to "third_party/android_tools/ndk"
ndk_version must >= 12.b

We integrated V8 to Skype for Android and open-sourced the docker build script:
https://github.com/Microsoft/v8-docker-buildscript
Feel free to re-use it. It is not completely fair solution, but it is reproducible build on any OS.
V8 team supports Linux build infrastructure also it is well documented.
We succeed building it on Mac but found it too hard to maintain in working condition. At the end we had to patch the Android NDK while chrome build script checkouts working version of NDK and all other required tools.
With docker script any engineer in the team could build the engine from scratch no mater which OS he uses.

Related

AOSP: How to build /platform/frameworks/base or /platform/frameworks/support separately in Android Studio

Is there a way to build AOSP's /platform/frameworks/base package source or support library source separately in Android Studio.
I wanted to read the framework (base and support) code in Android Studio and since I didn't want to be bothered about the rest of the packages in AOSP, I only imported the mirrored repo of these two packages as two separate projects in Android Studio. I want to browse through the code by using "jump to source" shortcut (cmd/ctrl+click) of the IDE. But this handy feature won't simply work properly in Android Studio. When I try to jump to the method definition which belongs to a different java source file (It says - "Cannot find declaration to go to"). This limitation of source editor is due to gradle build failure. The project just won't build and throws the following error.
Error:You need a symlink in prebuilts/sdk/99 that points to
prebuilts/sdk/current.Without it, studio cannot understand current
SDK. ln -s ../../prebuilts/sdk/current ../../prebuilts/sdk/99
Is there a way to fix this. I know I can simply browse the source code on http://androidxref.com/ too, but it's not as convenient and powerful as your IDE.
This is possible (having Android Studio be able to show you the framework code and let you use the usual IDE tools), though compiling won't work.
But the detail in your question seems to indicate you don't actually care about compiling, just about viewing/editing.
The first steps listed here:
http://ronubo.blogspot.com/2016/01/debugging-aosp-platform-code-with.html
might work for you. Basically:
Build your AOSP platform
( . build/envsetup.sh && lunch - && make ...)
Create the Android Studio project for importing to
( mmm development/tools/idegen && development/tools/idegen/idegen.sh )
Import the project
( open android.ipr from Android Studio)
Not without a huge effort.
For very many reasons.Ex:
1.the framework depends on different HALs and libraries from system/bionic/external
2.Compiling the framework uses specific tools from linux(flex,bison,libgl etc..)
3.Framework is built using the Android.mk system and needs a lot of flags and compilation macros from build/
I also can't imagine a motivation to do what you are trying to do. If it's going to run on any device, bare in mind device manufacturers modify the framework heavily, even the small ones. Actually the chipset manufacturers modify it and give it to manufacturers that modify it even more.
Error:You need a symlink in prebuilts/sdk/99 that points to prebuilts/sdk/current.Without it, studio cannot understand current SDK. ln -s ../../prebuilts/sdk/current ../../prebuilts/sdk/99
This notice already tell you should run the command:
ln -s ../../prebuilts/sdk/current ../../prebuilts/sdk/99
To tell build system use 'current version sdk' in prebuilts/sdk/current directory replace the temp sdk version 99.
could you try it?

Trying to run simple monkeyrunner python script, 'importerror no module named os'

I have the android emulator/SDK installed on my computer, and I'm trying to run a simple python script, but it fails on the 'import os' line (which should be standard!)
Here's my script:
import os
print os.environ['PATH']
works fine when I run it against the actual python executable as
python test.py
but when I do
monkeyrunner.bat test.py
I get the error listed in the title of this question. I've uninstalled/reinstalled python several times, with no luck. Tried adding a PYTHONPATH ENV varaible, no luck. Set the python install dir to be in the PATH ENV variable. Kind of at my wits end, I think monkeyrunner runs on jython but I don't know if I can manage the jython install that comes with the SDK
The issue is that the latest versions of the Android SDK include jython-2.5.3 which do not have the os and other importable libraries built in. I found an old copy of the SDK and used the old JAR which appears to have that embedded in it those libraries.
The solution of this problem (and the problem itself explained) can be found at http://dtmilano.blogspot.ca/2013/05/monkeyrunner-importerror-no-module.html.
Basically, you have to replace jython-2.5.3.jar by jython-standalone-2.5.3.jar, at least until Android SDK Tools Rev. 22.0.1 is out.
all by itself in the jython interpreter
If you're using the jython packaged with the Android SDK, it doesn't include an 'os' module by default. You'll need to grab one, and put it in there, or use another interpreter.
I resolved this issue with java 1.7.0_21.

Project from https://android.googlesource.com

If I download a project from https://android.googlesource.com to what Android API version will it be compatable ?
I have cloned a project.
Then created a project in Eclipse in that name with its res, src and manifest.xml, but still its shows error with some variables declaration missing , some functions arguments changed/not correct etc.
Any idea?
I'm using sdk_r08, and android 2.3 project working well.
Does the project from https://android.googlesource.com need any dependent files? If so what do I need to get those files?
Is there any extra arguments that I can set in git clone to get the project in a specific version?
You need to use the repo tool , then you can use the -b parameter to checkout a specific branch, see repo documentation for examples.
Actually you cannot load only a single project into eclipse since the whole OS tree is mutually dependent,
you have to checkout the whole source code, make a compile and then copy the .classpath in the root folder of the build and create a java project using this classpath. and ONLY then will you be able to load a project.
however note that the AOSP compiles only on 64bit Ubuntu 10.04 (version and distro is mostly because of library versions and dependencies, I've seen people do it on fedora and suse)
the compile is horrific however you ARE compiling an OS from scratch so ...
it takes about 5 hours on a dualcore pentium u 3gigs of ram..
and about 20 mins on i7 with running
make -j16
after importing everything in eclipse you can work with individual applications like, Launcher, Contacts, Calendar, Phone.. etc..
however to actually install anything on a real device (without flashing the whole rom) you have to refactor/rename the project package declaration since most of them are com.android.* which means the device will not override the default app installed
in short, after setting up the workstation:
(don use -b gingerbread since it is the bleeding edge branch, numbered versions are production branches so bugs are minimal)
repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.4_r1
repo sync
. build/envsetup.sh
lunch 1
make -j8
most of the flags I am using are explained in the tutors below...
More info on the subject:
Workstation setup : http://source.android.com/source/initializing.html
Downloading source ; http://source.android.com/source/downloading.html
Building : http://source.android.com/source/building.html
and most important.. howtos...
http://www.youtube.com/watch?v=1_H4AlQaNa0
http://www.youtube.com/watch?v=rFqELLB1Kk8

How can I compile Dalvik to run it locally on Linux?

What are the minimal steps necessary (including retrieving the source code) to compile and run just the Dalvik virtual machine on Linux?
Actually , I got Dalvik working on my elementary OS installation.
First download the Android AOSP source tree using https://source.android.com/source/downloading.html. Wait for it to download (2 hours for me cloning only the current commits and Marshmallow branch)
After running build/envsetup.sh while in the source tree run lunch full_x86-eng. Then type make -jN (replace N with number of cores).
WAIT. This took me about 1 hour on an AMD-4500M laptop. Newer ccomputers may be as low as half and hour and older ones might take half a day.
Change directory to !!AOSP-PATH!!/out/host/linux-x86/bin/ and run export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:!!AOSP-PATH!!/out/host/linux-x86/obj/lib/ or
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:!!AOSP-PATH!!/out/host/linux-x86/lib
or export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:!!AOSP-PATH!!/out/host/linux-x86/lib64
TRY ALL OF THESE
and then
./dalvikvm --32. If you try to run without the --32 option it will crash (don't know why)
Working Marshmallow Dalvik. To get the GUI apps working you will need to do some more porting and coding which is another project which I am working on.
Took me half a day to figure this out.
References
http://milk.com/kodebase/dalvik-docs-mirror/docs/hello-world.html
Use sabayon Linux. This is a distro that can natively run Android programs and all Linux ones too.
Actually, that's rather android running on Dalvik and the underlying system is already linux.
I guess running a bare Dalvik VM on a desktop linux box is just a matter of getting the sources and compile it.
The GUI stuff is something else.
You are not the only one with this idea, and that is great in internet society terms.
This is probably what you are looking for: http://www.android-x86.org/.
Those guys ported android over to x86.
It still works as an OS, so I'm not sure if you can run Linux and Android(Linux) together without using VirtualBox.
Dalvik runs on Android. The authors of Dalvik are only worrying about it running on Android, as far as we are aware.
Various groups have indicated they are working on getting Dalvik outside of Android. You are probably best off finding and talking to them.
In other words, there are no official instructions of the type you seek.
Sorry!
Getting apps designed for Android to run on Linux is going to be tricky. However, it is possible to run a Dalvik VM on Linux. In fact, this GitHub project has a pre-compiled binary of Dalvik VM for Linux, ready to use! Check the associated blog post for information about how the binary was compiled and how to use it.
Learn to program Java \ C \ C++ and other frameworks
Modify the Android source (I think app_process or something) so it shows a windows on the Linux desktop (learn X11 / Wayland APIs)
Below is a simpile base for you to start with
www.android-x86.org/getsourcecode
Getting Android-x86 source code
First, follow this page to configure your build environment. Then
mkdir android-x86
cd android-x86
repo init -u git.android-x86.org/manifest -b $branch
repo sync
Where $branch is any branch name described in the previous section. This will point the projects created or modified by android-x86 to our git server. All the other projects still point to AOSP.
We also have a git mirror server on SourceForge.net. To use it, you only need to change the repo init command to
repo init -u git.code.sf.net/p/android-x86/manifest -b $branch

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error:
/c/Users/Andrew Rabon/bin/repo: line
23: exec: python: not found
I've downloaded repo and put it in ~/bin like it says, and I've installed Python. I wonder what the issue could be.
For reference, I'm using msysgit on Windows Vista, I understand msysgit is limited, but I hope it can at least pull the android source.
I ended up creating a VirtualBox vm with Ubuntu installed. Followed the directions on the source code site and then zipped up the source and copied it over via file share to my windows machine. It's a bulky solution but it's the most straightforward as you don't have to deal with cryptic scripting issues.
I imagine that you could make msysgit and repo work with some tweaking,
In particular, I think there is an advantage in using Cygwin. It seems to have superior handling of case sensistive file names. This might be irrelevant for the main Android code base, but I know for a fact that it is necessary for the Linux kernel.
You cannot build Android on Windows. However, you should be able to use repo to pull the source code. I've done this. I imagine you must be using Cygwin. You'll need Python 2.4 (according to Get Source) and make sure you don't have any other Python installations on Windows or Cygwin that are overriding it. Check your version using the python interactive shell.

Categories

Resources