Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android SDK updated and dropped lots of things #587

Closed
ericoporto opened this issue Jan 19, 2019 · 4 comments
Closed

Android SDK updated and dropped lots of things #587

ericoporto opened this issue Jan 19, 2019 · 4 comments
Labels

Comments

@ericoporto
Copy link
Member

ericoporto commented Jan 19, 2019

I am trying to build the ndk the binaries, and it's not possible since Android SDK updated minimum plataform API to 16 instead of 14, and dropped mips architecture. The scripts below need to be updated. Another change is the lack of gcc in Android SDK now.

buildall.sh.zip
makestandalones.sh.zip

The arm-linux-androideabi-gcc included in the android ndk toolchain is a lie, it's a weird link to clang and it is failing in the config tests for freetype...
screenshot from 2019-01-19 12-50-06

./buildall.sh 
~/git/ags/libsrc ~/git/ags/Android/buildlibs
allegro-4.4.2.tar.gz: OK
dumb-0.9.3.tar.gz: OK
freetype-2.4.12.tar.bz2: OK
libogg-1.3.2.tar.gz: OK
libtheora-20150828-gfbb2758.tar.bz2: OK
libtheora-20160525-g50df933.tar.bz2: OK
libtremor-20150108-r19427.tar.bz2: OK
libvorbis-1.3.5.tar.gz: OK
lua-5.1.5.tar.gz: OK
~/git/ags/Android/buildlibs
~/git/ags/Android/buildlibs/armeabi ~/git/ags/Android/buildlibs
~/git/ags/Android/buildlibs/armeabi/freetype-2.4.12 ~/git/ags/Android/buildlibs/armeabi

FreeType build system -- automatic system detection

The following settings are used:

  platform                    unix
  compiler                    /platforms/android-16/arm/bin/arm-linux-androideabi-gcc
  configuration directory     ./builds/unix
  configuration rules         ./builds/unix/unix.mk

If this does not correspond to your system or settings please remove the file
`config.mk' from this directory then read the INSTALL file for help.

Otherwise, simply type `make' again to build the library,
or `make refdoc' to build the API reference (the latter needs python).

Generating modules list in ./objs/ftmodule.h...
* module: truetype  (Windows/Mac font files with extension *.ttf or *.ttc)
* module: type1     (Postscript font files with extension *.pfa or *.pfb)
* module: cff       (OpenType fonts with extension *.otf)
* module: cid       (Postscript CID-keyed fonts, no known extension)
* module: pfr       (PFR/TrueDoc font files with extension *.pfr)
* module: type42    (Type 42 font files with no known extension)
* module: winfnt    (Windows bitmap fonts with extension *.fnt or *.fon)
* module: pcf       (pcf bitmap fonts)
* module: bdf       (bdf bitmap fonts)
* module: sfnt      (helper module for TrueType & OpenType formats)
* module: autofit   (automatic hinting module)
* module: pshinter  (Postscript hinter module)
* module: raster    (monochrome bitmap renderer)
* module: smooth    (anti-aliased bitmap renderer)
* module: smooth    (anti-aliased bitmap renderer for LCDs)
* module: smooth    (anti-aliased bitmap renderer for vertical LCDs)
* module: psaux     (Postscript Type 1 & Type 2 helper module)
* module: psnames   (Postscript & Unicode Glyph name handling)
done.
cd builds/unix; /bin/sh ./configure  '--host=arm-linux-androideabi' '--prefix=/home/erico/git/ags/Android/nativelibs/armeabi' '--without-zlib' '--disable-shared'
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-linux-androideabi
checking for arm-linux-androideabi-gcc... /platforms/android-16/arm/bin/arm-linux-androideabi-gcc
checking whether the C compiler works... no
configure: error: in `/home/erico/git/ags/Android/buildlibs/armeabi/freetype-2.4.12/builds/unix':
configure: error: C compiler cannot create executables
See `config.log' for more details
builds/unix/detect.mk:86: recipe for target 'setup' failed
make: *** [setup] Error 77

A different issue of Freetype with NDK is reported here -> android/ndk#614

I can say building GCC with NDK toolchain is a waste of time because the errors a too cryptic. If someone is crazy they can find it here but I totally don't recommend it.

Edit: Noticed Google mantains their Freetype here : https://android.googlesource.com/platform/external/freetype/

Edit2: Some more interesting reading https://mortoray.com/2012/08/21/android-ndk-cross-compile-setup-libpng-and-freetype/

@ericoporto ericoporto changed the title Android Studio updated and dropped lots of things Android SDK updated and dropped lots of things Jan 21, 2019
@ghost
Copy link

ghost commented Jan 25, 2019

@ericoporto , I was able to start compilation with NDK r16, the one referenced in the Android/README.md.
Download link can be found here: http://developer.android.com/ndk/downloads/revision_history

I am not sure your issue (judging from the posted output) is related to freetype at all. It looks more like what happens when the toolchain is not created correctly, or paths are not matching script's expectations.

I am currently setting up Android tools from scratch after reinstalling Ubuntu, and I was at least able to begin compiling with "arm" toolchain.
UPDATE: successfully compiled libraries with "arm" toolchain.
UPDATE2: done with all three toolchains.

The readme misses couple of things, firstly it only links to documentation on creating a toolchain but does not give much detail on what has to be done. Also I found there's a bunch of tools that has to be present on your Linux to build every library. I may be updating our readme afterwards.

Of course this does not mean we should not update to further ndk if that's desired and will keep things working, but I know little about these things so will stick to existing instructions for now.

@ghost
Copy link

ghost commented Jan 25, 2019

Another thing that we forgot to add to readme is that if you are going to build Java apps from command line using "ant", then you need to download old SDK tools package because newer Android SDKs don't include ant directory anymore.

https://stackoverflow.com/questions/42912824/the-ant-folder-is-suddenly-missing-from-android-sdk-did-google-remove-it

Dl link: https://dl.google.com/android/repository/tools_r25.2.5-linux.zip

EDIT Important note: the "tools/ant" dir is not enough to make script work. It fails saying that "checkenv" is not a registered command. Since I had no time to research this I copied everything from the old tools (without overwriting existing files of course). It worked correctly after that.

Another thing missing in readme: this may be obvious to some, but you need to remember to install proper SDK (Android 4.1 / api version 16 in our case) using SDK Manager.

@ghost
Copy link

ghost commented Jan 26, 2019

Just confirming: I was able to build APK in ags3 branch.

Following information needs to be added to readme:

  1. Need to use older NDK r16b, may be downloaded here: http://developer.android.com/ndk/downloads/revision_history
  2. Need to make 3 toolchains using commands like:
    $NDK/build/tools/make_standalone_toolchain.py --arch arm --api 14; same for "x86" and "mips".
    If you don't specify "--install-dir" this will create archives in a working dir. Anyway the contents of toolchain should be copied to directories $NDK/platforms/android-14/arm, x86, mips.
  3. Following tools must be installed in system to build native libs: autoconf, automake, cmake, libtool.
  4. In order to build Java apps, you need to have installed: Android SDK for Android 4,1 (api level 16); this may be done through Android Studio's SDK manager.
  5. Install ant and openjdk.
  6. Download deprecated Android tools here: https://dl.google.com/android/repository/tools_r25.2.5-linux.zip and copy the contents of "tools" directory to "Android/Sdk/tools" (skipping existing files).

That's it, I think.

@ericoporto
Copy link
Member Author

ericoporto commented Feb 2, 2019

Found my error:

https://github.com/adventuregamestudio/ags/blob/master/Android/buildlibs/makestandalones.sh#L8

This rewrites my ndk home. So I was using:

https://github.com/adventuregamestudio/ags/blob/master/Android/README.md#native-3rd-party-libraries

And my NDK_HOME was being ignored. The idiot who wrote that line is myself! 😬

This issue can be closed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants