[BRLTTY] Compiling BRLTTY for Android on Windows

Robert Pösel robyer at seznam.cz
Thu Mar 8 08:16:35 EST 2018


Hi,

I'm still struggling to compile BRLTTY for Android on Windows. I tried 
few different ways how to do that, but all failed. I will describe my 
attempts here. Note I followed the help in Documents/README.Android file.

1) Using Cygwin or MinGW - this path was a dead end. I was able to 
install the required tools like autogen, make, etc. but I got stuck at 
weird errors I don't even remember now. I don't think this is good way 
anyway.

2) On Windows 10 there is now Linux Subsystem feature which we can use 
directly instead of Cygwin / MinGW. I enabled it, installed Ubuntu, and 
tried compilation of BRLTTY there. It went much more easily, but I got 
stuck at the final "make -s" in Android/Application folder anyway.

Also it is worth mentioning there are various difficulties regarding 
this way:
- It is available only on Windows 10 and it requires some work to enable 
it and install it.
- When getting sources via Git checkout, repository must be configured 
with /autocrlf = false/, so files will have LF (not CRLF as default on 
Windows) line endings. Otherwise /autogen/ and other tools fails to work.
- We must download both Android SDK and Android NDK for linux and have 
it separate from our normal Android SDK/NDK for Windows which we are 
using for example in Android Studio.
- Just note that we must also use /"/mnt/c//some-directory" paths 
instead of "C:\some-directory" paths everywhere.

So /./autogen/ and /./cfg-andorid -q/ commands finished successfully, 
but there were configure warning which I don't know if are ok to ignore. 
See below:

/configure: WARNING: no commonly used jni installation directory//
//configure: WARNING: Cannot find ocamlc.//
//configure: WARNING: OCaml BrlAPI bindings not included//
//configure: WARNING: Tcl configuration script not found: tclConfig.sh//
//configure: WARNING: Tcl packages directory not found//
//configure: WARNING: Tcl BrlAPI bindings not included//
//configure: WARNING: dbus support not available//
//configure: WARNING: polkit support not available//
//configure: WARNING: louis support not available//
//configure: WARNING: dbus support not available/

Then when I tried /make -s/ in Android/Application directory and it 
failed with:

/make: android: Command not found//
//../../Android/common.mk:16: recipe for target 'local.properties' failed//
//make: *** [local.properties] Error 127/

So I created empty /local.properties/ file, and run command again. It 
started compiling and showed some warnings in C code and then whole 
build failed at this error:

/brltty/Android/Core/build.xml:55: sdk.dir is missing. Make sure to 
generate local.properties using 'android update project' or to inject it 
through the ANDROID_HOME environment variable./

So I tried to run /android update project/ and it failed with:

/The "android" command is deprecated.//
//For manual SDK, AVD, and project management, please use Android Studio.//
//For command-line tools, use tools\bin\sdkmanager.bat////and 
tools\bin\avdmanager.bat
Invalid or unsupported command "update project"/

I find out that all that command does is it creates /local.properties/ 
file with /sdk.dir/ property set to path to SDK directory. So for 
example /sdk.dir=/mnt/c/Android/SDK
/So I created this file in both Android/Application and Android/Core 
directories.
//

Then I run /make -s/ again and it failed with
//

/brltty/Android/Core/build.xml:90: Cannot find 
Android/SDK/tools/ant/build.xml imported from brltty/Android/Core/build.xml/

I find this question: 
https://stackoverflow.com/questions/42912824/the-ant-folder-is-suddenly-missing-from-android-sdk-did-google-remove-it 
where they say ant scripts were removed from SDK tools 25.3.0 (about 
year ago).
That means you are using some old SDK if building with your scripts 
still works ok for you. Note before I had also some similar problem with 
NDK, but since you started using latest version of NDK already, there 
was no problem at this time.

So I downloaded older SDK tools (version 25.2.5 as mentioned in the link 
above), then I had to install rest of Android SDK things like build 
tools 21.1.2 and android-16 and android-21 platforms.

Then I run /make -s/ again and it failed with this error:

/(...)
-code-gen:
[mergemanifest] No changes in the AndroidManifest files.
      [echo] Handling aidl files...
      [aidl] No AIDL files to compile.
      [echo] ----------
      [echo] Handling RenderScript files...
      [echo] ----------
      [echo] Handling Resources...
      [aapt] Generating resource IDs...
      [aapt] /mnt/d/Android/SDK-linux/build-tools/21.1.2/aapt: 1: 
/mnt/d/Android/SDK-linux/build-tools/21.1.2/aapt: Syntax error: "(" 
unexpected (expecting ")")
BUILD FAILED
/mnt/d/Android/SDK-linux/tools/ant/build.xml:649: The following error 
occurred while executing this line:
/mnt/d/Android/SDK-linux/tools/ant/build.xml:694: null returned: 2
/

I don't understand what is wrong now or how to continue.

3) Having standard Android Studio project with Gradle build system + 
CMake for native libraries would be perfect (and multiplatform) way to 
build BRLTTY for Android.

I am able to import BRLTTY Android/Application and Android/Core sources 
into new Android studio project and compile the Java code easily (after 
fixing some warnings/errors in some files). Then if I take compiled 
/brltty_core.so/ and /brltty_jni.so/ and other assets from your APK and 
include it into my APK, the final application works correctly. But 
problem is with compiling the native code. Android Studio uses CMake for 
building native code (also they still support /ndk-build/, but it's only 
for compatibility with old projects and they recommend to use CMake). I 
was able to prepare CMake script for compiling /brltty_jni.so/ and it 
worked correctly as it's source is only pretty simple /brltty_jni.c/ 
file. But I wasn't able to compile the /brltty_core.so/ file for 2 
reasons. Firstly I don't know what source files are compiled into 
/brltty_core.so/, as I'm not familiar with the Make and Ant scripts you 
use here. Secondly I tried to include at least some files like 
/brltty.c, core.c/ and some others I found in one makefile, but during 
compiling it showed various warnings and errors, which felt like I'm 
using incompatible compiler or something.


Can you help me with these issues somehow? Have you thought about using 
CMake for building whole BRLTTY project?

Thanks,
Robert Pösel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://brltty.com/pipermail/brltty/attachments/20180308/94f1ff61/attachment.html>


More information about the BRLTTY mailing list