How to compile aFreeRDP on Linux - android

aFreeRDP is the Android client of the FreeRDP project.
I'm using 64 bit Ubuntu 15.04 Vivid.
My goal is to compile aFreeRDP. I'm at the finish line, but cannot cross it. I successfully installed the required packages, Android NDK, and then compiled the external openssl (the android shell script does that automatically). Then I generated make files. Interestingly neither
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/AndroidToolchain.cmake -DANDROID_NDK=/home/csaba/android-ndk -DFREERDP_EXTERNAL_SSL_PATH=/home/csaba/GitRepos/FreeRDP/external/openssl -DANDROID_SDK=/home/csaba/android-sdk-linux
nor
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/AndroidToolchain.cmake -DANDROID_NDK=/home/csaba/android-ndk -DFREERDP_EXTERNAL_SSL_PATH=/home/csaba/GitRepos/FreeRDP/external/openssl -DCMAKE_BUILD_TYPE=Debug -DANDROID_BUILD_JAVA=OFF -DANDROID_SDK=/home/csaba/android-sdk-linux -DFREERDP_EXTERNAL_JPEG_PATH=/home/csaba/GitRepos/FreeRDP/external/jpeg8d
produced any apk, but they happily compiled libfreerdp-android.so.
I need an apk, so I went to the client/Android/aFreeRDP and since I had a build.xml there, I said ant build install. The build process started, but then died at the resource compilation phase. I have the current level 23 android build tools and companion stuff with the Android SDK. I see in the source, that the source was originally targeted to level 21. I added level 21 SDK too, and tried to force maxSdkVersion to 21 in the AndroidManifest.xml, but that didn't help. The compilation log:
http://pastebin.com/Nc0mqGrQ
As you can see after resource errors
[aapt] Generating resource IDs...
[aapt] /home/csaba/GitRepos/FreeRDP/client/Android/appcompat_v7/res/values-v23/styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
[aapt]
[aapt] /home/csaba/GitRepos/FreeRDP/client/Android/appcompat_v7/res/values-v23/styles_base_text.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
[aapt]
it dies
BUILD FAILED
/home/csaba/android-sdk-linux/tools/ant/build.xml:597: The following error occurred while executing this line:
/home/csaba/android-sdk-linux/tools/ant/build.xml:649: The following error occurred while executing this line:
/home/csaba/android-sdk-linux/tools/ant/build.xml:694: null returned: 1
Comparing the level 21 and the level 23 resources, the level 21 has way more stuff, the level 23 has single entries, very vague. How can I fix this? Let me know what files should I post.
Update 1:
Get rid of an annoying issue with ADT, which could have affected this bug too: Eclipse Error: Error parsing ...\android-22\android-wear\armeabi-v7a\devices.xml
Unfortunately uninstalling the Wear images made the ADT error go away, but the aFreeRDP compilation error still remained.
Update 2:
I tried to go back in time and my goal was to have an Android SDK which provides 21, but doesn't have level 23.
I backed up my current Android SDK. SDK download tgz 22.6.2 (https://dl.google.com/android/android-sdk_r22.6.2-linux.tgz) only provides target 21. But SDK download tgz 23.0.0 (https://dl.google.com/android/android-sdk_r23-linux.tgz) already wants to upgrade to 24. So I cannot get the system to a state, when I don't have the target 23 (which indirectly causes errors somehow - more correctly, the level 24's compatibility facility for target 23 (which satisfies target 21)), but have the target 21.
(Bonus question: why Google makes it so hard to download older SDKs? I had to fiddle and guess URLs).
Update 3:
I managed to debug aFreeRDP from Android Studio (v 1.5) using the directions github.com/FreeRDP/FreeRDP/blob/master/docs/README.android

I want to post the same topic but you already made one so I will post here.
it should be comment but I dont have 50 reputation to comment so i make it answer here: Notes: (xxx = https://github.com in this post)
Reference Links:
xxx/FreeRDP/FreeRDP/wiki/Compilation
xxx/awakecoding/FreeRDP-Manuals/blob/master/Developer/FreeRDP-Developer-Manual.markdown
and other posts from internet
Goal: Build aFreeRDP for Android devices.
2 years ago I used to build it for Ubuntu 12 / 14 but now the build is broken.
A new environment needs to setup again:
-Windows 7 Enterprise 64 bit (MAIN OS)
-WMware WorkStation 10
-VM Ubuntu 15.10 Wily 64bit
Prepare Ubuntu with NDK10e, JDK7, SDK23...
shaun#ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.10
Release: 15.10
Codename: wily
Install JDK
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
Install ANDROID NDK
chmod a+x android-ndk-r10e-linux-x86_64.bin
./android-ndk-r10e-linux-x86_64.bin
sudo chown -R root:root /home/shaun/Main/android-ndk-r10e
sudo mv /home/shaun/Main/android-ndk-r10e /opt
export NDK=/opt/android-ndk-r10e
Install ANDROID SDK
Download and extract android-sdk_r23.0.2-linux.tgz
sudo mv /home/shaun/Main/android-sdk-linux /opt/android-sdk
shaun#ubuntu:/opt/android-sdk/tools$ ./android
Install dependences GIT / CMAKE / GCC
sudo apt-get install \
build-essential git-core cmake \
libssl-dev \
libx11-dev libxext-dev libxinerama-dev libxcursor-dev libxkbfile-dev \
libxv-dev libxi-dev libxdamage-dev libxrender-dev libxrandr-dev \
libasound2-dev libcups2-dev libpulse-dev \
libavutil-dev libavcodec-dev \
libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libcunit1-dev libdirectfb-dev xmlto doxygen libxtst-dev
sudo apt-get install lib32stdc++6
sudo apt-get install lib32z1
GET FreeRDP
git clone git://github.com/FreeRDP/FreeRDP.git
cd FreeRDP
Add PATH
shaun#ubuntu:~$ gedit ~/.bashrc
export ANDROID_NDK=/opt/android-ndk-r10e
export ANDROID_SDK=/opt/android-sdk
export FREERDP_EXTERNAL_SSL_PATH=/home/shaun/Main/FreeRDP-master/external/Android-external-openssl-ndk-static
export PATH=$PATH:$FREERDP_EXTERNAL_SSL_PATH
export PATH="$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$ANDROID_NDK"
from FreeRDP-->run ./scripts/android_setup_build_env.sh
--> see long output .... then at the end you see:
Prepared external libraries, you can now build the application.
Finally run:
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/AndroidToolchain.cmake -DANDROID_NDK=$ANDROID_NDK -DANDROID_SDK=$ANDROID_SDK -DFREERDP_EXTERNAL_SSL_PATH=$FREERDP_EXTERNAL_SSL_PATH -DFREERDP_EXTERNAL_JPEG_PATH="/home/shaun/Main/FreeRDP/external/jpeg8d" -DANDROID_NATIVE_API_LEVEL:STRING=L -DCMAKE_MAKE_PROGRAM=$ANDROID_NDK/prebuilt/linux-x86/bin/make -DCMAKE_BUILD_TYPE=Debug -DANDROID_BUILD_JAVA=OFF -L .
make
After this make, I have all libs i need but still fail to have APK:...
...long output....
Total time: 2 seconds
client/Android/aFreeRDP/CMakeFiles/android-package.dir/build.make:50: recipe for target 'client/Android/aFreeRDP/bin/aFreeRDP-debug.apk' failed
make[2]: * [client/Android/aFreeRDP/bin/aFreeRDP-debug.apk] Error 1
CMakeFiles/Makefile2:2494: recipe for target 'client/Android/aFreeRDP/CMakeFiles/android-package.dir/all' failed
make[1]: * [client/Android/aFreeRDP/CMakeFiles/android-package.dir/all] Error 2
Makefile:136: recipe for target 'all' failed
make: *** [all] Error 2
==========================
Import to ECLIPSE and build from Eclipse sucessfully -- APK and application run on all my devices again with new features most advanced feature is microphone redirection works as well :-)
But Still not work in ANDROID STUDIO , Still trying :(, please let me know if you have it work in AS. Thanks

I started with the 23.0 SDK tgz, upgraded one round (not upgrading up to Android 6.0). Then the troublesome xml files are copied over from the Android SDK. So I deleted that values-v23 folder from the SDK. I also modified the AndroidManifest.xml of the aFreeRDP and set minSdkVersion to 17 from 14. The directory deletion certainly helped, I'm not sure if the other two steps contributed, but I have an apk now. I consider this an ugly hack, only a workaround though. Because So I won't mark this as an answer for now.
Update:
I started from a totally updated Android SDK, and the minSdkVersion bump from 14 to 17 also doesn't matter. The only thing which made the error go away is the invasive removal of that values-v23 directory from inside the Android SDK.
Note:
The compilation is simpler than it was a year/couple of years ago. The android_setup_build_env.sh takes care of downloading and compiling ssl library and other stuff.

Related

Limiting the number of clang++.exe instances running during a build

While building my android project, cmake runs several instances of clang++.exe that eat up my machine's resources. Is there a way to limit this? Would such a solution lead to longer build times?
Here is a screenshot of my resource map: resource status
I have the following package versions:
android studio: 4.0.1
ndk: 21.3.6528147
cmake:3.10.2
Your screenshot indicates you are generating for the Ninja build system... so...
If building through the CMake executable, documented here, you would use:
cmake --build . -- -j 8
which would build with up to 8 CPUs in parallel. (Change 8 to however many instances you'd like.)
If just building using Ninja directly, you would use something like:
ninja -j 8
to achieve the same effect.

`gomobile build` and `gomobile install` throws "gomobile: EOF"

I'm trying to build an android application using gomobile but the commands gomobile install and gomobile build fail with gomobile: EOF . Before this error I was getting this error:
# golang.org/x/mobile/gl
In file included from /root/go/src/golang.org/x/mobile/gl/gl.go:17:0:
work.h:6:23: fatal error: GLES2/gl2.h: No such file or directory
compilation terminated. but it was fixed with yum install make gcc mesa-libGLES-devel mesa-libEGL-devel.
The application is mostly a networking application. Here are the imports. Do only certain packages work with gomobile or all of them?
"golang.org/x/mobile/app"
"golang.org/x/net/websocket"
"os/exec"
"flag"
"fmt"
log "github.com/golang/glog"
"io/ioutil"
"net"
"net/http"
"net/url"
"strconv"
OS: Fedora 22.
More info: I'm able to build https://github.com/golang/mobile/blob/master/example/network/main.go so I can only assume the issue is specific to my application.
It failed because AndroidManifest.xml was empty.

PowerVR Android sample: makefile not working

I'm having a hard time setting up PowerVR SDK for Android on Windows 8 64, assuming I met all requirements:
Android SDK (fresh Eclipse)
Android NDK
Cygwin (with make)
PowerVR Android SDK 3.0
I can perfectly make and run an Android NDK sample. However, the same process fails for building any PowerVR sample (from the SDK). Here's the output when I try to run the makefile:
$ ndk
Compile++ thumb : OGLES2Texturing <= OGLES2Texturing.cpp
arm-linux-androideabi-g++.exe: error: C:/cygwin///cygdrive/c/Users/stfn/workspaces/android/03_Texturing/jni/OGLES2Texturing.cpp: No such file or directory
arm-linux-androideabi-g++.exe: fatal error: no input files
compilation terminated.
/cygdrive/c/android-ndk-r8d/build/core/build-binary.mk:269: recipe for target `obj/local/armeabi/objs/OGLES2Texturing//cygdrive/c/Users/stfn/workspaces/android/03_Texturing/jni/OGLES2Texturing.o' failed
make: * [obj/local/armeabi/objs/OGLES2Texturing//cygdrive/c/Users/stfn/workspaces/android/03_Texturing/jni/OGLES2Texturing.o] Error 1
I suppose the error should be related to a wrong path given to the compiler. To me it looks like a mixture of standard Windows and Cygwin/Unix paths: * C:/cygwin///cygdrive/c/Users/stfn/...*
If been through so many makefiles now trying to resolve this issue but I just don't know where else to look. This is the first time I tried messing with the NDK. I'm afraid this could be my last.
Any help would be greatly appreciated
1.in the Android.mk file, for the PVRSDKDIR, set the path of your project folder in your workspace.
2.Copy the build, tools, and shell folders from the powervr sdk folder to your project folder

cocos2d-2.0-rc2-x-2.0.1 Hello World sample doesn't work using cygwin on windows8

I am unable to build helloWorld sample to get .so to run it in eclipse. I have imported project successfully and changed variable to my root path as required. this is my build_native.sh. I am pasting the only change I made in that file
NDK_ROOT_LOCAL=/cygdrive/e/android-ndk-r8
COCOS2DX_ROOT_LOCAL=/cygdrive/e/cocos2d
And my NDK is working fine because I have executed HelloWorld sample of NDK successfully. My SDK version is 20 and NDK version is 8 and I am using cygwin above than 1.7.. I have executed the chown on my NDK directory.. But when I run the command ./build_native.sh in HelloWorld sample program for cocos2d I get this error
E:/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/../lib/gcc/arm- linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/png.a: No such file: Permission denied
collect2: ld returned 1 exit status
and when I search for png.a in my NDK directory window can't locate that file. I am confused whether it's a permission error or File isn't there. But I have the latest NDK if file isn't there how come anyone will able to run cocos2d-x??? Need Help!!!
It seems like the permissions on built files were missing when I tried as well.
$ ls -l obj/local/armeabi/png.a
---------- 1 someuser Domain Users 912618 Jul 12 18:23 obj/local/armeabi/png.a
There is a link suggested on the forum which doesn't seem to be accessible right now.
Anyway, to fix, you can set the permission on the files.
$ cd obj/local/armeabi/
$ chmod 664 *.a
$ cd ../../..
Edit: A better fix may be to set the default permissions in /etc/fstab to
none /cygdrive cygdrive binary,noacl,posix=0,user 0 0
Following this, you should be able to run ./build_native.sh.
A command you could use to locate all files below the current directory which have no (read/write) permission available on them is find . -type f -perm 0
See this answer to set write permissions on all files below your working directory.
Consider going through a tutorial on chmod to understand the concept of permissions in linux/unix in case you're unfamiliar with them.

Error with building Android NDK Project

I wand build project in windows, I get same Errors:
bash C:\linux\android-ndk1\ndk-build V=1
cygwin warning:
MS-DOS style path detected: C:\dev\android\workspace4_android\FFWall
Preferred POSIX equivalent is: /cygdrive/c/dev/android/workspace4_android/FFWall
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Android NDK: ERROR:jni/Android.mk:bambuser-libavcore: LOCAL_SRC_FILES points to a missing file
/cygdrive/c/linux/android-ndk1/build/core/prebuilt-library.mk:43: *** Android NDK: Aborting . Stop.
Android NDK: Check that jni/ffmpeg-android/build/ffmpeg/armeabi/lib/libavcore.so exists or that its path is correct
Another way building:
C:\art\android-ndk\ndk-build V=1
Cannot run program "C:\art\android-ndk\ndk-build": Launching failed
Error: Program "C:/art/android-ndk/ndk-build" is not found in PATH
PATH=[C:\Art\android-ndk;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Program Files\PC Connectivity Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\MATLAB\R2011a\runtime\win32;C:\Program Files\MATLAB\R2011a\bin;C:\Program Files\MATLAB\R2007b\bin;C:\Program Files\MATLAB\R2007b\bin\win3;C:\dev\android\android-sdk-windows\tools;C:\cygwin\bin;C:/art/android-ndk/;C:\linux\android-ndk-r7b;C:\dev\android\eclipse]
Why this happened?
From: http://developer.android.com/sdk/ndk/overview.html#reqs
Required development tools
For all development platforms, GNU Make 3.81 or later is required. Earlier versions of GNU Make might work but have not been tested.
A recent version of awk (either GNU Awk or Nawk) is also required.
For Windows, Cygwin 1.7 or higher is required. The NDK will not work with Cygwin 1.5 installations.
Meaning, that you will have to install Cygwin. After that you can call the ndk-build like:
$ProjectPath> /cygdrive/c/myNdkPath/ndk-build
Please also check the "Getting Started" part of:
http://developer.android.com/sdk/ndk/index.html

Categories

Resources