Author Topic: AGS engine Android port  (Read 175753 times)

Re: AGS engine Android port
« Reply #720 on: 30 Dec 2017, 22:05 »
You read right Snarky, if I understood, touch needs to be a click but still keep the state of the left mouse button pressed while the finger is pressed on the screen. At least this is how I understand the mouse works in AGS, it emits the mouse click event on click and not on release.

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #721 on: 30 Dec 2017, 22:26 »
You read right Snarky, if I understood, touch needs to be a click but still keep the state of the left mouse button pressed while the finger is pressed on the screen.

Maybe I did not understand your previous explanations, what is the difference between "longclick" mode set in config and what you want to achieve?

Re: AGS engine Android port
« Reply #722 on: 31 Dec 2017, 00:08 »
To trigger long click, you have to hold your finger and wait until the device vibrates, and then the longclick is processed. The idea would be that once the screen is touched, the mouse button is already considered down.:/ Also as is, to remove the finger, you have to click with the finger again. CW don't worry. (I really don't like how written text makes me sound like I am ungrateful...)

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #723 on: 31 Dec 2017, 00:40 »
CW don't worry. (I really don't like how written text makes me sound like I am ungrateful...)
The purpose I am asking is to learn more about Android port, because so far I only used it few times on emulator :).

Re: AGS engine Android port
« Reply #724 on: 04 Jan 2018, 05:07 »
Having grown up in foster care I realize one thing. Good things are rare and should be treated with care..
This thing that all of you do is a good thing. I'll be 50 in a few days and wanted to reflect the fact that I respect what all you guys do!!
Thank you for allowing me to enjoy :)
sincerely.
« Last Edit: 04 Jan 2018, 05:15 by sawyer »

Re: AGS engine Android port
« Reply #725 on: 11 Jan 2018, 03:44 »
:cheesy: P.S.   Think it will ever happen, ya know,
update with no link fail so all games can truly be portable?
easy .apk install for dummies....lol :)
« Last Edit: 11 Jan 2018, 03:46 by sawyer »

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #726 on: 11 Jan 2018, 22:39 »
@eri0o, I found why it does not find allegro.h for you.

There were patched allegro sources for Android right in our repository earlier. Nick Sonneveld has removed them and added download & patch script instead. But he did not change instructions in Readme.

You now have to perform "Native 3rd party libraries" step before doing "Native engine library".

Firstly, you need to have "curl" utility installed. (Maybe it is standard, but my Ubuntu did not have it)

Then:
Quote
The scripts require standalone toolchains for all Android platforms and they have to be available on the PATH. See https://developer.android.com/ndk/guides/standalone_toolchain.html for instructions on creating the standalone toolchains.


EDIT
Well, I looked into the NDK/toolchains, and there are already several toolchains created. Problem is that when I run buildall.sh, I get this:

Quote
cd builds/unix; /bin/sh ./configure '--host=arm-linux-androideabi' '--prefix=/home/ikm/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... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/ikm/git/ags/Android/buildlibs/armeabi/freetype-2.4.12/builds/unix':
configure: error: C compiler cannot create executables

Not sure what is missing and how to proceed from here.

EDIT2:
I was able to find out that "configure: error: C compiler cannot create executables" was caused by gcc error "Unrecognized command '-mthumb'". That's all I can add at this point.
« Last Edit: 29 Jan 2018, 00:03 by Crimson Wizard »

Re: AGS engine Android port
« Reply #727 on: 03 Feb 2018, 18:37 »
Hope this works out so everyone can enjoy.
Either way, what each of you do is truly something special.
All the personal time you each put into these games/engines, is something I myself am truly thankful for.
Your selflessness truly lifts my spirits!
So to everyone involved, you are appricated!!  8-)
« Last Edit: 03 Feb 2018, 18:41 by sawyer »

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #728 on: 06 Feb 2018, 12:57 »
Continuing....

Well, I looked into the NDK/toolchains, and there are already several toolchains created. Problem is that when I run buildall.sh, I get this:

Quote
cd builds/unix; /bin/sh ./configure '--host=arm-linux-androideabi' '--prefix=/home/ikm/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... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/ikm/git/ags/Android/buildlibs/armeabi/freetype-2.4.12/builds/unix':
configure: error: C compiler cannot create executables

Not sure what is missing and how to proceed from here.

EDIT2:
I was able to find out that "configure: error: C compiler cannot create executables" was caused by gcc error "Unrecognized command '-mthumb'". That's all I can add at this point.

Alright, a bit of a progress here.

1) First of all, I managed to create standalone toolchains myself, although I had to modify the script that does that, because the existing one did not work for me. I honestly don't know why, maybe it refers to an old version of NDK.

What I had to do is open Android/buildlibs/makestandalones.sh and in the line -
Code: Bash
  1. $NDK_HOME/build/tools/make-standalone-toolchain.sh --platform=$PLATFORM --install-dir=$INSTALL_DIR --arch=$arch
remove the "--platform=$PLATFORM" part.
Code: Bash
  1. $NDK_HOME/build/tools/make-standalone-toolchain.sh --install-dir=$INSTALL_DIR --arch=$arch
That said, I am not sure whether this was even needed, since some toolchains were already included in NDK distributive.


2) Now, regarding actual library building.
Apparently I misunderstood how the building script works. I thought it somehow refers to the toolchains explicitly, but no, I had to add all the necessary toolchain into PATH. I guess that makes sense (also documentation page mentioned this, albeit non-explicitly, which I missed).

Straight to the point, each toolchain you are using must be referenced in $PATH.
For example, I created a toolchain in "~/ndk-standalone/android-9/arm". Then I had to add following path to $PATH: "~/ndk-standalone/android-9/arm/bin".
Then, the building process will actually be using a gcc compiler from Android toolchain, rather than the one from your system.

3) After that I was even able to finally launch library compilation. Then it failed while compiling "lua" library (why does it need lua anyway... probably for lua plugin?).

Anyway, at that point I've stumbled into a problem with my virtual machine running out of disk space... which was unexpected. I will continue after fixing that...


UPDATE:

4) Had to install autoconf, automake, cmake, libtool utilities (required to build some of the libs).

5) So far managed to compile freetype, allegro and dumb libraries.
Other libraries: lua and ogg failed with similar errors:
Quote
undefined reference to 'stderr'
undefined reference to 'stdout'
undefined reference to 'signal'
undefined reference to 'rand'
Tremor and theora could not be built without ogg.

Errors may be related to this:
https://github.com/android-ndk/ndk/issues/410
https://github.com/openssl/openssl/issues/445
« Last Edit: 06 Feb 2018, 13:24 by Crimson Wizard »

Re: AGS engine Android port
« Reply #729 on: 07 Feb 2018, 01:54 »
Hey, I just built love2d for android today, Lua wouldn't build for armeabi because it's support has been dropped, but will build for armeabi-v7a. (in love's case)

I am looking into the project, and for some reason the ndkenv file inside each platform in buildlibs (x86, mips, ...) has the wrong root path. I think first you need to install the toolchains using makestandalones.sh and them use the paths to update ndkenv. Also the project expects Android-9, which is old as hell, I would try with at least 14. Unfortunately, I already spent a lot of time on love2d today, so I will probably only be seriously looking into this tomorrow.  (I felt a lot of pressure from the forums, from 'the future of' discussions, so I had to be away for some time)

Right now I got until (even if I skip armeabi and go directly to armeabi-v7a, so it's not the same case as Lua for love2d apparently)
Add spoiler tag for Hidden:
Code: Adventure Game Studio
  1. lua.o:lua.c:function laction: error: undefined reference to 'signal'
  2. lua.o:lua.c:function l_message: error: undefined reference to 'stderr'
  3. lua.o:lua.c:function l_message: error: undefined reference to 'stderr'
  4. lua.o:lua.c:function pushline: error: undefined reference to 'stdout'
  5. lua.o:lua.c:function pushline: error: undefined reference to 'stdin'
  6. lua.o:lua.c:function docall: error: undefined reference to 'signal'
  7. lua.o:lua.c:function docall: error: undefined reference to 'signal'
  8. lua.o:lua.c:function dotty: error: undefined reference to 'stdout'
  9. lua.o:lua.c:function pmain: error: undefined reference to 'stderr'
  10. liblua.a(lauxlib.o):lauxlib.c:function panic: error: undefined reference to 'stderr'
  11. liblua.a(lauxlib.o):lauxlib.c:function luaL_loadfile: error: undefined reference to 'stdin'
  12. liblua.a(lbaselib.o):lbaselib.c:function luaB_print: error: undefined reference to 'stdout'
  13. liblua.a(ldblib.o):ldblib.c:function db_debug: error: undefined reference to 'stdin'
  14. liblua.a(liolib.o):liolib.c:function luaopen_io: error: undefined reference to 'stdin'
  15. liblua.a(liolib.o):liolib.c:function luaopen_io: error: undefined reference to 'stdout'
  16. liblua.a(lmathlib.o):lmathlib.c:function math_randomseed: error: undefined reference to 'srand'
  17. liblua.a(lmathlib.o):lmathlib.c:function math_random: error: undefined reference to 'rand'
  18. collect2: error: ld returned 1 exit status
  19. make[2]: *** [lua] Error 1
  20. make[2]: Leaving directory `/home/USERNAME/git/ags/Android/buildlibs/armeabi/lua-5.1.5/src'
  21. make[1]: *** [generic] Error 2
  22. make[1]: Leaving directory `/home/USERNAME/git/ags/Android/buildlibs/armeabi/lua-5.1.5/src'
  23. make: *** [generic] Error 2
  24.  
« Last Edit: 07 Feb 2018, 01:57 by eri0o »

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #730 on: 07 Feb 2018, 01:57 »
eri0o, you basically described same thing I mentioned in the previous post :).

E: Unless I am mistaken, I could have actually installed version 14 of NDK.
« Last Edit: 07 Feb 2018, 02:00 by Crimson Wizard »

Re: AGS engine Android port
« Reply #731 on: 07 Feb 2018, 01:58 »
Sorry Crimson, I had to start somewhere. But hey, I ignored everything you said and eventually felled in the same route, so this must be positive somehow :O

Re: AGS engine Android port
« Reply #732 on: 07 Feb 2018, 03:06 »
Good work guys, it's exciting seeing your progress even if I don't understand half the stuff :)

Re: AGS engine Android port
« Reply #733 on: 08 Feb 2018, 03:18 »
Hey CW! The lua thing, following this below appears to solve for lua. Now I hit the same error as below in libogg

Change the Lua patch, in line 23 use:
-CFLAGS= -O2 -Wall $(MYCFLAGS)
+CFLAGS= -O2 -Wall $(MYCFLAGS) -D__ANDROID_API__=$API

ags/Android/patches/liblua.patch
Add spoiler tag for Hidden:
Code: Adventure Game Studio
  1. diff -Naur src/llex.c src/llex.c
  2. --- src/llex.c  2007-12-27 14:02:25.000000000 +0100
  3. +++ src/llex.c  2012-07-30 12:19:06.628478800 +0200
  4. @@ -176,9 +176,8 @@
  5.  
  6.  static void trydecpoint (LexState *ls, SemInfo *seminfo) {
  7.    /* format error: try to update decimal point separator */
  8. -  struct lconv *cv = localeconv();
  9.    char old = ls->decpoint;
  10. -  ls->decpoint = (cv ? cv->decimal_point[0] : '.');
  11. +  ls->decpoint = '.';
  12.   buffreplace(ls, old, ls->decpoint);  /* try updated decimal separator */
  13.    if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) {
  14.      /* format error with correct decimal point: no more options */
  15. diff -Naur src/Makefile src/Makefile
  16. --- src/Makefile        2008-01-19 20:37:58.000000000 +0100
  17. +++ src/Makefile        2012-07-30 12:10:36.058644700 +0200
  18. @@ -7,17 +7,12 @@
  19.  # Your platform. See PLATS for possible values.
  20.  PLAT= none
  21.  
  22. -CC= gcc
  23. -CFLAGS= -O2 -Wall $(MYCFLAGS)
  24. +CFLAGS= -O2 -Wall $(MYCFLAGS) -D__ANDROID_API__=$API
  25.  AR= ar rcu
  26.  RANLIB= ranlib
  27.  RM= rm -f
  28.  LIBS= -lm $(MYLIBS)
  29.  
  30. -MYCFLAGS=
  31. -MYLDFLAGS=
  32. -MYLIBS=
  33. -
  34.  # == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
  35.  
  36.  PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
  37. @@ -93,7 +88,7 @@
  38.         $(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" MYLIBS="-Wl,-E -lreadline"
  39.  
  40.  generic:
  41. -       $(MAKE) all MYCFLAGS=
  42. +       $(MAKE) all
  43.  
  44.  linux:
  45.         $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
  46.  


You need to add the same flag (I think) in the ogg.sh script, in the part it passes the CFlags, but I couldn't find out where ogg.sh comes from!

Edit: ok, found a download.sh script that takes libraries from magical machines in Amazon. Edit2: yet it doesn't look that the ogg.sh comes from there...

Add spoiler tag for Hidden:
eri0o@SUPERCOMPUTER:~/git/ags$ find . -iname ogg.sh
./iOS/buildlibs/armv7/ogg.sh
./iOS/buildlibs/x86_64/ogg.sh
./iOS/buildlibs/armv7s/ogg.sh
./iOS/buildlibs/i386/ogg.sh
./iOS/buildlibs/arm64/ogg.sh
./Android/buildlibs/armeabi-v7a/ogg.sh
./Android/buildlibs/armeabi/ogg.sh
./Android/buildlibs/x86/ogg.sh
./Android/buildlibs/mips/ogg.sh
eri0o@SUPERCOMPUTER:~/git/ags$ grep --recursive ogg.sh *
Android/buildlibs/buildall.sh:   ./ogg.sh   
iOS/buildlibs/buildall.sh:   ./ogg.sh


ogg.sh must be like this below (I tested and it works, but I couldn't find a clean way to for it to be like this)
Add spoiler tag for Hidden:
Code: Bash
  1. #!/bin/bash
  2.  
  3. set -e
  4.  
  5. source ./ndkenv
  6.  
  7. SRC_DIR=libogg-1.3.2
  8. rm -rf $SRC_DIR
  9. mkdir $SRC_DIR
  10. tar xf ../../../libsrc/libogg-1.3.2.tar.gz --strip-components=1 -C $SRC_DIR
  11.  
  12. pushd $SRC_DIR
  13.  
  14. export CFLAGS="$NDK_CFLAGS -fsigned-char -D__ANDROID_API__=\$API"
  15. export LDFLAGS="$NDK_LDFLAGS"
  16.  
  17. ./configure --host=$NDK_HOST_NAME --prefix=$NDK_ADDITIONAL_LIBRARY_PATH --disable-shared
  18.  
  19. make
  20. make install
  21.  
  22. popd
  23.  
  24. rm -rf $SRC_DIR
  25.  


Edit3: I am not very smart. It come like this from the repository already. I need to modify it directly.

Edit4: Ok, now for some reason allegro.sh fails on line 17 saying it can't find cmake, but ndk has cmake, so I don't know yet what's wrong...

Edit5: I didn't have cmake, and NDK requires a newer cmake then the offered by Ubuntu repo. Installed newest cmake using pip install cmake . In allegro.sh, I also changed line 31 to use:
  -DCMAKE_TOOLCHAIN_FILE=~/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake

which points to my correct cmake toolchain for Android. Unfortunately, I now fail with the following

Add spoiler tag for Hidden:
Code: Bash
  1. -- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
  2. CMake Error at CMakeLists.txt:962 (get_target_property):
  3.   get_target_property() called with non-existent target "allegrogl".
  4.  
  5.  
  6. CMake Error at CMakeLists.txt:962 (get_target_property):
  7.   get_target_property() called with non-existent target "loadpng".
  8.  
  9.  
  10. CMake Error at CMakeLists.txt:962 (get_target_property):
  11.   get_target_property() called with non-existent target "logg".
  12.  
  13.  
  14. CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
  15. Please set them or make sure they are set and tested correctly in the CMake files:
  16. RT_LIBRARY
  17.     linked by target "allegro" in directory /home/erico/git/ags/Android/buildlibs/armeabi-v7a/allegro-4.4.2
  18.  
  19. -- Configuring incomplete, errors occurred!
  20. See also "/home/erico/git/ags/Android/buildlibs/armeabi-v7a/allegro-4.4.2/CMakeFiles/CMakeOutput.log".
  21. See also "/home/erico/git/ags/Android/buildlibs/armeabi-v7a/allegro-4.4.2/CMakeFiles/CMakeError.log".
  22.  
  23.  

Edit6: Apparently, cmake looks the missign targets here : ~/Android/Sdk/ndk-bundle/platforms/android-14/arch-arm/usr/lib/ . I am not completely sure if this is true or either if the missing things are libraries. Question : which libpng version should be used with Allegro 4.4.2 ? Trying what is written here: https://stackoverflow.com/questions/14263016/adding-libpng-in-android-ndk-project . Tried. It doesn't change, it still can't find libpng. I removed the compiled libs from the Sdk directories because it doesn't seem to be the correct place. Tried placing in NDK_ADDITIONAL_LIBRARY_PATH but it didn't work too.

Letting full error below, noticed a missing: OSS_COMPILES message too.

Add spoiler tag for Hidden:
Code: Bash
  1. ~/git/ags/Android/buildlibs/armeabi-v7a/allegro-4.4.2$ cmake . -G "Unix Makefiles" -DWANT_TESTS=off -DWANT_EXAMPLES=off -DWANT_TOOLS=off -DWANT_LOGG=off -DWANT_ALLEGROGL=off -DSHARED=off -DCMAKE_C_FLAGS="$NDK_CFLAGS -fsigned-char" -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" -DCMAKE_LD_FLAGS="$NDK_LDFLAGS"   -DCMAKE_TOOLCHAIN_FILE=~/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DCMAKE_INSTALL_PREFIX=$NDK_ADDITIONAL_LIBRARY_PATH
  2. -- Performing Test ALLEGRO_USE_CONSTRUCTOR
  3. -- Performing Test ALLEGRO_USE_CONSTRUCTOR - Failed
  4. -- Could NOT find OSS (missing: OSS_COMPILES)
  5. -- Checking for module 'alsa'
  6. --   No package 'alsa' found
  7. -- Checking for module 'jack'
  8. --   No package 'jack' found
  9. -- Could NOT find PNG (missing: PNG_PNG_INCLUDE_DIR)
  10. CMake Error at CMakeLists.txt:962 (get_target_property):
  11.   get_target_property() called with non-existent target "allegrogl".
  12.  
  13.  
  14. CMake Error at CMakeLists.txt:962 (get_target_property):
  15.   get_target_property() called with non-existent target "loadpng".
  16.  
  17.  
  18. CMake Error at CMakeLists.txt:962 (get_target_property):
  19.   get_target_property() called with non-existent target "logg".
  20.  
  21.  
  22. CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
  23. Please set them or make sure they are set and tested correctly in the CMake files:
  24. RT_LIBRARY
  25.     linked by target "allegro" in directory /home/USERNAME/git/ags/Android/buildlibs/armeabi-v7a/allegro-4.4.2
  26.  
  27. -- Configuring incomplete, errors occurred!
  28. See also "/home/USERNAME/git/ags/Android/buildlibs/armeabi-v7a/allegro-4.4.2/CMakeFiles/CMakeOutput.log".
  29. See also "/home/USERNAME/git/ags/Android/buildlibs/armeabi-v7a/allegro-4.4.2/CMakeFiles/CMakeError.log".
  30.  
  31.  

Edit7: Re-reading what CW has said, he WAS able to build allegro, so I am doing something wrong, but I don't know what yet...

I am leaving a git diff of my ags git directory to the master at the time I was trying to do this, maybe it's useful in the future. I can't pursue this tomorrow since I need to work on my games too.

Add spoiler tag for Hidden:
Code: Adventure Game Studio
  1. diff --git a/Android/buildlibs/armeabi-v7a/allegro.sh b/Android/buildlibs/armeabi-v7a/allegro.sh
  2. index 2b97658..8b00f1d 100755
  3. --- a/Android/buildlibs/armeabi-v7a/allegro.sh
  4. +++ b/Android/buildlibs/armeabi-v7a/allegro.sh
  5. @@ -14,6 +14,10 @@ pushd $SRC_DIR
  6.  # Platform independent patch
  7.  patch -p0 < ../../../patches/liballegro-4.4.2.patch
  8.  
  9. +echo ${ANDROID_NDK}
  10. +
  11. +echo ""
  12. +
  13.  cmake . -G "Unix Makefiles" \
  14.         -DWANT_TESTS=off \
  15.         -DWANT_EXAMPLES=off \
  16. @@ -24,9 +28,10 @@ cmake . -G "Unix Makefiles" \
  17.         -DCMAKE_C_FLAGS="$NDK_CFLAGS -fsigned-char" \
  18.         -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" \
  19.         -DCMAKE_LD_FLAGS="$NDK_LDFLAGS" \'
  20. -       -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-android-gcc.cmake \
  21. +  -DCMAKE_TOOLCHAIN_FILE=~/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake \
  22.         -DCMAKE_INSTALL_PREFIX=$NDK_ADDITIONAL_LIBRARY_PATH
  23.  
  24. +       #-DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-android-gcc.cmake \
  25.  make
  26.  make install
  27.  
  28. diff --git a/Android/buildlibs/armeabi-v7a/ndkenv b/Android/buildlibs/armeabi-v7a/ndkenv
  29. index cf9fdfb..f3bf4e3 100644
  30. --- a/Android/buildlibs/armeabi-v7a/ndkenv
  31. +++ b/Android/buildlibs/armeabi-v7a/ndkenv
  32. @@ -5,7 +5,7 @@ get_abs_path() {
  33.  
  34.  unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
  35.  
  36. -export NDK_PLATFORM_ROOT=/opt/android-ndk-r10e-standalone/android-9/arm
  37. +export NDK_PLATFORM_ROOT=/home/USERNAME/Android/Sdk/ndk-bundle/platforms/android-14/arm
  38.  export NDK_PLATFORM_NAME=armeabi-v7a
  39.  export NDK_HOST_NAME=arm-linux-androideabi
  40.  export NDK_ADDITIONAL_LIBRARY_PATH=$(get_abs_path "../../nativelibs/$NDK_PLATFORM_NAME")
  41. diff --git a/Android/buildlibs/armeabi-v7a/ogg.sh b/Android/buildlibs/armeabi-v7a/ogg.sh
  42. index 53dd200..8f058f5 100755
  43. --- a/Android/buildlibs/armeabi-v7a/ogg.sh
  44. +++ b/Android/buildlibs/armeabi-v7a/ogg.sh
  45. @@ -11,7 +11,7 @@ tar xf ../../../libsrc/libogg-1.3.2.tar.gz --strip-components=1 -C $SRC_DIR
  46.  
  47.  pushd $SRC_DIR
  48.  
  49. -export CFLAGS="$NDK_CFLAGS -fsigned-char"
  50. +export CFLAGS="$NDK_CFLAGS -fsigned-char -D__ANDROID_API__=\$API"
  51.  export LDFLAGS="$NDK_LDFLAGS"
  52.  
  53.  ./configure --host=$NDK_HOST_NAME --prefix=$NDK_ADDITIONAL_LIBRARY_PATH --disable-shared
  54. diff --git a/Android/buildlibs/armeabi/ndkenv b/Android/buildlibs/armeabi/ndkenv
  55. index 0df6781..1a01191 100644
  56. --- a/Android/buildlibs/armeabi/ndkenv
  57. +++ b/Android/buildlibs/armeabi/ndkenv
  58. @@ -5,7 +5,7 @@ get_abs_path() {
  59.  
  60.  unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
  61.  
  62. -export NDK_PLATFORM_ROOT=/opt/android-ndk-r10e-standalone/android-9/arm
  63. +export NDK_PLATFORM_ROOT=/home/USERNAME/Android/Sdk/ndk-bundle/platforms/android-14/arm
  64.  export NDK_PLATFORM_NAME=armeabi
  65.  export NDK_HOST_NAME=arm-linux-androideabi
  66.  export NDK_ADDITIONAL_LIBRARY_PATH=$(get_abs_path "../../nativelibs/$NDK_PLATFORM_NAME")
  67. diff --git a/Android/buildlibs/armeabi/ogg.sh b/Android/buildlibs/armeabi/ogg.sh
  68. index 21062a3..56ed267 100755
  69. --- a/Android/buildlibs/armeabi/ogg.sh
  70. +++ b/Android/buildlibs/armeabi/ogg.sh
  71. @@ -11,7 +11,7 @@ tar xf ../../../libsrc/libogg-1.3.2.tar.gz --strip-components=1 -C $SRC_DIR
  72.  
  73.  pushd $SRC_DIR
  74.  
  75. -export CFLAGS="$NDK_CFLAGS -fsigned-char"
  76. +export CFLAGS="$NDK_CFLAGS -fsigned-char -D__ANDROID_API__=\$API"
  77.  export LDFLAGS="$NDK_LDFLAGS"
  78.  
  79.  ./configure --host=$NDK_HOST_NAME --prefix=$NDK_ADDITIONAL_LIBRARY_PATH --disable-shared
  80. diff --git a/Android/buildlibs/buildall.sh b/Android/buildlibs/buildall.sh
  81. index b813057..73dec33 100755
  82. --- a/Android/buildlibs/buildall.sh
  83. +++ b/Android/buildlibs/buildall.sh
  84. @@ -6,7 +6,7 @@ pushd ../../libsrc
  85.  ./download.sh
  86.  popd
  87.  
  88. -for arch in armeabi armeabi-v7a x86 mips
  89. +for arch in  armeabi-v7a x86 mips
  90.  do
  91.         rm -rf ../nativelibs/$arch
  92.         mkdir -p ../nativelibs/$arch
  93. diff --git a/Android/buildlibs/makestandalones.sh b/Android/buildlibs/makestandalones.sh
  94. index 7f327cd..65fb734 100755
  95. --- a/Android/buildlibs/makestandalones.sh
  96. +++ b/Android/buildlibs/makestandalones.sh
  97. @@ -5,18 +5,18 @@
  98.  set -e
  99.  
  100.  # Last committed pre-compiled libs were with R8
  101. -NDK_HOME=/opt/android-ndk-r10e
  102. +NDK_HOME=/home/USERNAME/Android/Sdk/ndk-bundle
  103.  
  104.  # android-9 is minimum to support mips and x86
  105. -PLATFORM=android-9
  106. +PLATFORM=android-14
  107.  
  108.  # standalone toolchains cannot share same directory
  109. -NDK_STANDALONE=/opt/android-ndk-r10e-standalone/$PLATFORM
  110. +NDK_STANDALONE=/home/USERNAME/Android/Sdk/ndk-bundle/platforms/$PLATFORM
  111.  
  112.  for arch in arm x86 mips
  113.  do
  114.      INSTALL_DIR=$NDK_STANDALONE/$arch
  115.      mkdir -p $INSTALL_DIR
  116. -    $NDK_HOME/build/tools/make-standalone-toolchain.sh --platform=$PLATFORM --install-dir=$INSTALL_DIR --arch=$arch
  117. +    $NDK_HOME/build/tools/make-standalone-toolchain.sh --install-dir=$INSTALL_DIR --arch=$arch --force
  118.  done
  119.  
  120. diff --git a/Android/buildlibs/mips/ndkenv b/Android/buildlibs/mips/ndkenv
  121. index f1f7c78..9c06777 100644
  122. --- a/Android/buildlibs/mips/ndkenv
  123. +++ b/Android/buildlibs/mips/ndkenv
  124. @@ -5,7 +5,7 @@ get_abs_path() {
  125.  
  126.  unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
  127.  
  128. -export NDK_PLATFORM_ROOT=/opt/android-ndk-r10e-standalone/android-9/mips
  129. +export NDK_PLATFORM_ROOT=/home/USERNAME/Android/Sdk/ndk-bundle/platforms/android-14/mips
  130.  export NDK_PLATFORM_NAME=mips
  131.  export NDK_HOST_NAME=mipsel-linux-android
  132.  export NDK_ADDITIONAL_LIBRARY_PATH=$(get_abs_path "../../nativelibs/$NDK_PLATFORM_NAME")
  133. diff --git a/Android/buildlibs/mips/ogg.sh b/Android/buildlibs/mips/ogg.sh
  134. index 53dd200..8f058f5 100755
  135. --- a/Android/buildlibs/mips/ogg.sh
  136. +++ b/Android/buildlibs/mips/ogg.sh
  137. @@ -11,7 +11,7 @@ tar xf ../../../libsrc/libogg-1.3.2.tar.gz --strip-components=1 -C $SRC_DIR
  138.  
  139.  pushd $SRC_DIR
  140.  
  141. -export CFLAGS="$NDK_CFLAGS -fsigned-char"
  142. +export CFLAGS="$NDK_CFLAGS -fsigned-char -D__ANDROID_API__=\$API"
  143.  export LDFLAGS="$NDK_LDFLAGS"
  144.  
  145.  ./configure --host=$NDK_HOST_NAME --prefix=$NDK_ADDITIONAL_LIBRARY_PATH --disable-shared
  146. diff --git a/Android/buildlibs/x86/ndkenv b/Android/buildlibs/x86/ndkenv
  147. index d0710f4..2fb380f 100644
  148. --- a/Android/buildlibs/x86/ndkenv
  149. +++ b/Android/buildlibs/x86/ndkenv
  150. @@ -5,7 +5,7 @@ get_abs_path() {
  151.  
  152.  unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
  153.  
  154. -export NDK_PLATFORM_ROOT=/opt/android-ndk-r10e-standalone/android-9/x86
  155. +export NDK_PLATFORM_ROOT=/home/USERNAME/Android/Sdk/ndk-bundle/platforms/android-14/x86
  156.  export NDK_PLATFORM_NAME=x86
  157.  export NDK_HOST_NAME=i686-linux-android
  158.  export NDK_ADDITIONAL_LIBRARY_PATH=$(get_abs_path "../../nativelibs/$NDK_PLATFORM_NAME")
  159. diff --git a/Android/buildlibs/x86/ogg.sh b/Android/buildlibs/x86/ogg.sh
  160. index 53dd200..8f058f5 100755
  161. --- a/Android/buildlibs/x86/ogg.sh
  162. +++ b/Android/buildlibs/x86/ogg.sh
  163. @@ -11,7 +11,7 @@ tar xf ../../../libsrc/libogg-1.3.2.tar.gz --strip-components=1 -C $SRC_DIR
  164.  
  165.  pushd $SRC_DIR
  166.  
  167. -export CFLAGS="$NDK_CFLAGS -fsigned-char"
  168. +export CFLAGS="$NDK_CFLAGS -fsigned-char -D__ANDROID_API__=\$API"
  169.  export LDFLAGS="$NDK_LDFLAGS"
  170.  
  171.  ./configure --host=$NDK_HOST_NAME --prefix=$NDK_ADDITIONAL_LIBRARY_PATH --disable-shared
  172. diff --git a/Android/patches/liblua.patch b/Android/patches/liblua.patch
  173. index 4d040bc..759ce81 100644
  174. --- a/Android/patches/liblua.patch
  175. +++ b/Android/patches/liblua.patch
  176. @@ -20,7 +20,8 @@ diff -Naur src/Makefile src/Makefile
  177.   PLAT= none
  178.  
  179.  -CC= gcc
  180. - CFLAGS= -O2 -Wall $(MYCFLAGS)
  181. +-CFLAGS= -O2 -Wall $(MYCFLAGS)
  182. ++CFLAGS= -O2 -Wall $(MYCFLAGS) -D__ANDROID_API__=$API
  183.   AR= ar rcu
  184.   RANLIB= ranlib
  185.   RM= rm -f
  186. diff --git a/debian/ags+libraries/hooks/B00_copy_libs.sh b/debian/ags+libraries/hooks/B00_copy_libs.sh
  187. index 7f34e12..c3c3825 100755
  188. --- a/debian/ags+libraries/hooks/B00_copy_libs.sh
  189. +++ b/debian/ags+libraries/hooks/B00_copy_libs.sh
  190. @@ -1,7 +1,7 @@
  191.  #!/bin/sh
  192.  set -e
  193.  
  194. -BINDMOUNT=
  195. +BINDMOUNT=/home/USERNAME/git/ags/ags+libraries
  196.  BIT=32
  197.  
  198.    set +x
  199. diff --git a/debian/changelog b/debian/changelog
  200. index 5fb163c..1bf9500 100644
  201. --- a/debian/changelog
  202. +++ b/debian/changelog
  203. @@ -1,4 +1,4 @@
  204. -ags (3~git-1) UNRELEASED; urgency=low
  205. +ags (3.4.1.7) UNRELEASED; urgency=low
  206.  
  207.    * some release
  208.  
  209.  

edit8: adding link for topic in allegro forums: https://www.allegro.cc/forums/thread/617273/1035262#target

edit9: Nick confirmed the steps are indeed run the Android/buildlibs first, being 1) http://makestandalones.sh  and then 2) http://buildall.sh . so I really don't know why it doesn't build for me. My machine is Ubuntu 16.04 64-bits so if someone ever reads this, this is all the info :/
« Last Edit: 12 Feb 2018, 12:32 by eri0o »

Re: AGS engine Android port
« Reply #734 on: 14 Feb 2018, 02:26 »
Ok, I deleted everything, cloned the Repo again, followed the README closely, and did my modifications regarding the lua and ogg. Below are my modifications.

myGitDiff.dif
Add spoiler tag for Hidden:
Code: Adventure Game Studio
  1. diff --git a/Android/buildlibs/armeabi-v7a/ndkenv b/Android/buildlibs/armeabi-v7a/ndkenv
  2. index cf9fdfb..6e3d130 100644
  3. --- a/Android/buildlibs/armeabi-v7a/ndkenv
  4. +++ b/Android/buildlibs/armeabi-v7a/ndkenv
  5. @@ -5,7 +5,7 @@ get_abs_path() {
  6.  
  7.  unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
  8.  
  9. -export NDK_PLATFORM_ROOT=/opt/android-ndk-r10e-standalone/android-9/arm
  10. +export NDK_PLATFORM_ROOT=~/Android/Sdk/ndk-bundle/platforms/android-14/arm
  11.  export NDK_PLATFORM_NAME=armeabi-v7a
  12.  export NDK_HOST_NAME=arm-linux-androideabi
  13.  export NDK_ADDITIONAL_LIBRARY_PATH=$(get_abs_path "../../nativelibs/$NDK_PLATFORM_NAME")
  14. @@ -15,3 +15,5 @@ export ACLOCAL_PATH=$NDK_ADDITIONAL_LIBRARY_PATH/share/aclocal
  15.  
  16.  export NDK_CFLAGS=" -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 "
  17.  export NDK_LDFLAGS=" -march=armv7-a -Wl,--fix-cortex-a8 "
  18. +export CC=~/Android/Sdk/ndk-bundle/platforms/android-14/arm/bin/arm-linux-androideabi-gcc
  19. +export CXX=~/Android/Sdk/ndk-bundle/platforms/android-14/arm/bin/arm-linux-androideabi-g++
  20. diff --git a/Android/buildlibs/armeabi-v7a/ogg.sh b/Android/buildlibs/armeabi-v7a/ogg.sh
  21. index 53dd200..8f058f5 100755
  22. --- a/Android/buildlibs/armeabi-v7a/ogg.sh
  23. +++ b/Android/buildlibs/armeabi-v7a/ogg.sh
  24. @@ -11,7 +11,7 @@ tar xf ../../../libsrc/libogg-1.3.2.tar.gz --strip-components=1 -C $SRC_DIR
  25.  
  26.  pushd $SRC_DIR
  27.  
  28. -export CFLAGS="$NDK_CFLAGS -fsigned-char"
  29. +export CFLAGS="$NDK_CFLAGS -fsigned-char -D__ANDROID_API__=\$API"
  30.  export LDFLAGS="$NDK_LDFLAGS"
  31.  
  32.  ./configure --host=$NDK_HOST_NAME --prefix=$NDK_ADDITIONAL_LIBRARY_PATH --disable-shared
  33. diff --git a/Android/buildlibs/armeabi/ndkenv b/Android/buildlibs/armeabi/ndkenv
  34. index 0df6781..db11d13 100644
  35. --- a/Android/buildlibs/armeabi/ndkenv
  36. +++ b/Android/buildlibs/armeabi/ndkenv
  37. @@ -5,7 +5,7 @@ get_abs_path() {
  38.  
  39.  unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
  40.  
  41. -export NDK_PLATFORM_ROOT=/opt/android-ndk-r10e-standalone/android-9/arm
  42. +export NDK_PLATFORM_ROOT=~/Android/Sdk/ndk-bundle/platforms/android-14/arm
  43.  export NDK_PLATFORM_NAME=armeabi
  44.  export NDK_HOST_NAME=arm-linux-androideabi
  45.  export NDK_ADDITIONAL_LIBRARY_PATH=$(get_abs_path "../../nativelibs/$NDK_PLATFORM_NAME")
  46. @@ -14,3 +14,5 @@ export PKG_CONFIG_PATH=$NDK_ADDITIONAL_LIBRARY_PATH/lib/pkgconfig
  47.  export ACLOCAL_PATH=$NDK_ADDITIONAL_LIBRARY_PATH/share/aclocal
  48.  
  49.  export NDK_CFLAGS=" -mthumb "
  50. +export CC=~/Android/Sdk/ndk-bundle/platforms/android-14/arm/bin/arm-linux-androideabi-gcc
  51. +export CXX=~/Android/Sdk/ndk-bundle/platforms/android-14/arm/bin/arm-linux-androideabi-g++  
  52. diff --git a/Android/buildlibs/armeabi/ogg.sh b/Android/buildlibs/armeabi/ogg.sh
  53. index 21062a3..56ed267 100755
  54. --- a/Android/buildlibs/armeabi/ogg.sh
  55. +++ b/Android/buildlibs/armeabi/ogg.sh
  56. @@ -11,7 +11,7 @@ tar xf ../../../libsrc/libogg-1.3.2.tar.gz --strip-components=1 -C $SRC_DIR
  57.  
  58.  pushd $SRC_DIR
  59.  
  60. -export CFLAGS="$NDK_CFLAGS -fsigned-char"
  61. +export CFLAGS="$NDK_CFLAGS -fsigned-char -D__ANDROID_API__=\$API"
  62.  export LDFLAGS="$NDK_LDFLAGS"
  63.  
  64.  ./configure --host=$NDK_HOST_NAME --prefix=$NDK_ADDITIONAL_LIBRARY_PATH --disable-shared
  65. diff --git a/Android/buildlibs/makestandalones.sh b/Android/buildlibs/makestandalones.sh
  66. index 7f327cd..d4ecd64 100755
  67. --- a/Android/buildlibs/makestandalones.sh
  68. +++ b/Android/buildlibs/makestandalones.sh
  69. @@ -5,18 +5,18 @@
  70.  set -e
  71.  
  72.  # Last committed pre-compiled libs were with R8
  73. -NDK_HOME=/opt/android-ndk-r10e
  74. +NDK_HOME=~/Android/Sdk/ndk-bundle
  75.  
  76.  # android-9 is minimum to support mips and x86
  77. -PLATFORM=android-9
  78. +PLATFORM=android-14
  79.  
  80.  # standalone toolchains cannot share same directory
  81. -NDK_STANDALONE=/opt/android-ndk-r10e-standalone/$PLATFORM
  82. +NDK_STANDALONE=~/Android/Sdk/ndk-bundle/platforms/$PLATFORM
  83.  
  84.  for arch in arm x86 mips
  85.  do
  86.      INSTALL_DIR=$NDK_STANDALONE/$arch
  87.      mkdir -p $INSTALL_DIR
  88. -    $NDK_HOME/build/tools/make-standalone-toolchain.sh --platform=$PLATFORM --install-dir=$INSTALL_DIR --arch=$arch
  89. +    $NDK_HOME/build/tools/make-standalone-toolchain.sh  --force --platform=$PLATFORM --install-dir=$INSTALL_DIR --arch=$arch
  90.  done
  91.  
  92. diff --git a/Android/buildlibs/mips/ndkenv b/Android/buildlibs/mips/ndkenv
  93. index f1f7c78..8156536 100644
  94. --- a/Android/buildlibs/mips/ndkenv
  95. +++ b/Android/buildlibs/mips/ndkenv
  96. @@ -5,7 +5,7 @@ get_abs_path() {
  97.  
  98.  unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
  99.  
  100. -export NDK_PLATFORM_ROOT=/opt/android-ndk-r10e-standalone/android-9/mips
  101. +export NDK_PLATFORM_ROOT=~/Android/Sdk/ndk-bundle/platforms/android-14/mips
  102.  export NDK_PLATFORM_NAME=mips
  103.  export NDK_HOST_NAME=mipsel-linux-android
  104.  export NDK_ADDITIONAL_LIBRARY_PATH=$(get_abs_path "../../nativelibs/$NDK_PLATFORM_NAME")
  105. @@ -15,3 +15,5 @@ export ACLOCAL_PATH=$NDK_ADDITIONAL_LIBRARY_PATH/share/aclocal
  106.  
  107.  # NDK before R8b turns on "-mno-shared" in MIPS toolchain which disables -fpic
  108.  export NDK_CFLAGS=" -fpic "
  109. +export CC=~/Android/Sdk/ndk-bundle/platforms/android-14/mips/bin/mipsel-linux-android-gcc
  110. +export CXX=~/Android/Sdk/ndk-bundle/platforms/android-14/mips/bin/mipsel-linux-android-g++  
  111. diff --git a/Android/buildlibs/mips/ogg.sh b/Android/buildlibs/mips/ogg.sh
  112. index 53dd200..8f058f5 100755
  113. --- a/Android/buildlibs/mips/ogg.sh
  114. +++ b/Android/buildlibs/mips/ogg.sh
  115. @@ -11,7 +11,7 @@ tar xf ../../../libsrc/libogg-1.3.2.tar.gz --strip-components=1 -C $SRC_DIR
  116.  
  117.  pushd $SRC_DIR
  118.  
  119. -export CFLAGS="$NDK_CFLAGS -fsigned-char"
  120. +export CFLAGS="$NDK_CFLAGS -fsigned-char -D__ANDROID_API__=\$API"
  121.  export LDFLAGS="$NDK_LDFLAGS"
  122.  
  123.  ./configure --host=$NDK_HOST_NAME --prefix=$NDK_ADDITIONAL_LIBRARY_PATH --disable-shared
  124. diff --git a/Android/buildlibs/x86/ndkenv b/Android/buildlibs/x86/ndkenv
  125. index d0710f4..ea2176f 100644
  126. --- a/Android/buildlibs/x86/ndkenv
  127. +++ b/Android/buildlibs/x86/ndkenv
  128. @@ -5,10 +5,14 @@ get_abs_path() {
  129.  
  130.  unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
  131.  
  132. -export NDK_PLATFORM_ROOT=/opt/android-ndk-r10e-standalone/android-9/x86
  133. +export NDK_PLATFORM_ROOT=~/Android/Sdk/ndk-bundle/platforms/android-14/x86
  134.  export NDK_PLATFORM_NAME=x86
  135.  export NDK_HOST_NAME=i686-linux-android
  136.  export NDK_ADDITIONAL_LIBRARY_PATH=$(get_abs_path "../../nativelibs/$NDK_PLATFORM_NAME")
  137.  export PATH=$NDK_PLATFORM_ROOT/bin:$PATH
  138.  export PKG_CONFIG_PATH=$NDK_ADDITIONAL_LIBRARY_PATH/lib/pkgconfig
  139.  export ACLOCAL_PATH=$NDK_ADDITIONAL_LIBRARY_PATH/share/aclocal
  140. +
  141. +
  142. +export CC=~/Android/Sdk/ndk-bundle/platforms/android-14/x86/bin/i686-linux-android-gcc
  143. +export CXX=~/Android/Sdk/ndk-bundle/platforms/android-14/x86/bin/i686-linux-android-g++  
  144. diff --git a/Android/buildlibs/x86/ogg.sh b/Android/buildlibs/x86/ogg.sh
  145. index 53dd200..8f058f5 100755
  146. --- a/Android/buildlibs/x86/ogg.sh
  147. +++ b/Android/buildlibs/x86/ogg.sh
  148. @@ -11,7 +11,7 @@ tar xf ../../../libsrc/libogg-1.3.2.tar.gz --strip-components=1 -C $SRC_DIR
  149.  
  150.  pushd $SRC_DIR
  151.  
  152. -export CFLAGS="$NDK_CFLAGS -fsigned-char"
  153. +export CFLAGS="$NDK_CFLAGS -fsigned-char -D__ANDROID_API__=\$API"
  154.  export LDFLAGS="$NDK_LDFLAGS"
  155.  
  156.  ./configure --host=$NDK_HOST_NAME --prefix=$NDK_ADDITIONAL_LIBRARY_PATH --disable-shared
  157. diff --git a/Android/patches/liblua.patch b/Android/patches/liblua.patch
  158. index 4d040bc..e717f0d 100644
  159. --- a/Android/patches/liblua.patch
  160. +++ b/Android/patches/liblua.patch
  161. @@ -20,7 +20,8 @@ diff -Naur src/Makefile src/Makefile
  162.   PLAT= none
  163.  
  164.  -CC= gcc
  165. - CFLAGS= -O2 -Wall $(MYCFLAGS)
  166. +-CFLAGS= -O2 -Wall $(MYCFLAGS)
  167. ++CFLAGS= -O2 -Wall $(MYCFLAGS) -D__ANDROID_API__=$AP
  168.   AR= ar rcu
  169.   RANLIB= ranlib
  170.   RM= rm -f
  171.  
Note: I think you can git apply my diff as a patch, but I haven't never actually tried. Since my experience with taking patches from html pages is poor, I also linked above a link to a copy of the diff in my github gist.

After applying the modifications in all files, you need to build things

Code: Bash
  1. export PATH=$PATH:~/Android/Sdk/ndk-bundle/
  2. cd git/ags/Android/buildlibs/
  3. ./makestandalones.sh
  4. ./buildall.sh
  5. cd ../library/
  6. ndk-build
  7.  

notice that doing that PATH export is very important. My environment is Ubuntu 16.04 and I used the Android Sdk and ndk installed through Android Studio 3.0.1

details of my Android Studio :
Android Studio 3.0.1
Build #AI-171.4443003, built on November 9, 2017
JRE: 1.8.0_152-release-915-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.13.0-32-generic


Finally, I was able to fail at the right spot



Now it appears what is needed, is to add those OpenGL defines, which was said here http://www.adventuregamestudio.co.uk/forums/index.php?topic=55681.msg636579076#msg636579076 and is pointed in the github issue here. I need to sleep now, and have no idea how to do that, but at least, now things build as they should.


« Last Edit: 14 Feb 2018, 02:44 by eri0o »

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #735 on: 14 Feb 2018, 02:46 »
eri0o, could you make a pull request of the changes you made to building Android libs? just a patch file will also work.

Quote
Now it appears what is needed, is to add those OpenGL defines, which was said here http://www.adventuregamestudio.co.uk/forums/index.php?topic=55681.msg636579076#msg636579076 and is pointed in the github issue here. I need to sleep now, and have no idea how to do that

Same way as other functions are connected through macros, there should be awhole bunch of these already.

I will probably be able to check this out tomorrow.
« Last Edit: 14 Feb 2018, 02:48 by Crimson Wizard »

Re: AGS engine Android port
« Reply #736 on: 14 Feb 2018, 03:06 »
Hey CW! Created the pull request here!.

This is my first pull request in a public project, so please check if I did any mistake! (nod)

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #737 on: 14 Feb 2018, 06:22 »
Hey CW! Created the pull request here!.

This is my first pull request in a public project, so please check if I did any mistake! (nod)

Ouch, I forgot to mention, could you do that in "release-3.4.1" branch? Because master already has some differences, and I'd like to be able to make a compilable 3.4.1 Android port.

Re: AGS engine Android port
« Reply #738 on: 14 Feb 2018, 11:25 »
Hey CW! Did a new pull request here!

I tested and it failed at the same lines.

Add spoiler tag for Hidden:
Code: Bash
  1. jni/../jni/../../../Engine/game/savegame.cpp:537:30: note: place parentheses around the '&&'
  2.       expression to silence this warning
  3.             crossFading <= 0 && !channels[SCHAN_MUSIC])
  4.                              ^
  5.             (                                         )
  6. 6 warnings generated.
  7. [armeabi] Compile++ arm  : agsengine <= ali3dogl.cpp
  8. warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option]
  9. warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option]
  10. In file included from jni/../jni/../../../Engine/gfx/ali3dogl.cpp:19:
  11. In file included from jni/../jni/../../../Engine/gfx/ali3dogl.h:24:
  12. In file included from jni/../jni/../../../Common/gfx/bitmap.h:49:
  13. jni/../jni/../../../Common/gfx/allegrobitmap.h:84:17: warning: 'this' pointer cannot be null in
  14.       well-defined C++ code; pointer may be assumed to always convert to true
  15.       [-Wundefined-bool-conversion]
  16.         return !this || !_alBitmap;
  17.                ~^~~~
  18. In file included from jni/../jni/../../../Engine/gfx/ali3dogl.cpp:23:
  19. In file included from jni/../jni/../../../Engine/platform/base/agsplatformdriver.h:24:
  20. In file included from jni/../jni/../../../Engine/ac/datetime.h:21:
  21. In file included from jni/../jni/../../../Engine/ac/dynobj/scriptdatetime.h:21:
  22. In file included from jni/../jni/../../../Engine/ac/dynobj/cc_agsdynamicobject.h:18:
  23. In file included from jni/../jni/../../../Engine/ac/dynobj/cc_dynamicobject.h:23:
  24. In file included from jni/../jni/../../../Engine/script/runtimescriptvalue.h:21:
  25. In file included from jni/../jni/../../../Engine/script/script_api.h:24:
  26. jni/../jni/../../../Engine/ac/runtime_defines.h:135:9: warning: 'HWND' macro redefined
  27.       [-Wmacro-redefined]
  28. #define HWND long
  29.         ^
  30. jni/../jni/../../../Engine/gfx/ogl_headers.h:45:9: note: previous definition is here
  31. #define HWND void*
  32.         ^
  33. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:466:7: fatal error: use of undeclared identifier
  34.       'glSwapIntervalEXT'
  35.   if (glSwapIntervalEXT)
  36.       ^
  37. 4 warnings and 1 error generated.
  38. make: *** [obj/local/armeabi/objs/agsengine/gfx/ali3dogl.o] Error 1
  39.  
  40.  

---- below this line I don't know what I am doing ----

Edit1: The failing is atually related to SwapInterval and the fact that you can't (apparently) control V-Sync in Android. Below is a modification of ali3dogl.cpp that actually fails in glCreateShader. I just removed things related to V-Sync with if !defined (ANDROID_VERSION) so I am not sure this won't break anything.

ags/Engine/gfx/ali3dogl.cpp

Where this version fails:
jni/../jni/../../../Engine/gfx/ali3dogl.cpp:621:8: fatal error: use of undeclared identifier
      'glCreateShader'
  if (!glCreateShader)


Edit2: Right below the first if defined (ANDROID_VERSION) I added (idea came from here):
#include <GLES2/gl2.h>

In the project.properties, I modified the target from 16 to 14.
# Project target.
target=android-14


And then it failed with a lot of things.

Add spoiler tag for Hidden:
Code: Bash
  1. ...
  2. [armeabi] Compile arm    : agsengine <= aautil.c
  3. warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option]
  4. 1 warning generated.
  5. [armeabi] Compile arm    : agsengine <= midi.c
  6. warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option]
  7. 1 warning generated.
  8. [armeabi] SharedLibrary  : libagsengine.so
  9.  
  10. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:717: error: undefined reference to 'glCreateShader'
  11. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:718: error: undefined reference to 'glShaderSource'
  12. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:719: error: undefined reference to 'glCompileShader'
  13. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:721: error: undefined reference to 'glGetShaderiv'
  14. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:729: error: undefined reference to 'glCreateProgram'
  15. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:730: error: undefined reference to 'glAttachShader'
  16. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:731: error: undefined reference to 'glLinkProgram'
  17. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:734: error: undefined reference to 'glGetProgramiv'
  18. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:742: error: undefined reference to 'glDetachShader'
  19. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:743: error: undefined reference to 'glDeleteShader'
  20. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:746: error: undefined reference to 'glGetUniformLocation'
  21. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:747: error: undefined reference to 'glGetUniformLocation'
  22. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:748: error: undefined reference to 'glGetUniformLocation'
  23. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:738: error: undefined reference to 'glDeleteProgram'
  24. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:738: error: undefined reference to 'glDeleteShader'
  25. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:762: error: undefined reference to 'glGetShaderiv'
  26. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:764: error: undefined reference to 'glGetProgramiv'
  27. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:767: error: undefined reference to 'glGetShaderInfoLog'
  28. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:769: error: undefined reference to 'glGetProgramInfoLog'
  29. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:754: error: undefined reference to 'glDeleteProgram'
  30. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:754: error: undefined reference to 'glDeleteProgram'
  31. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:754: error: undefined reference to 'glDeleteProgram'
  32. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:1092: error: undefined reference to 'glUseProgram'
  33. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:1127: error: undefined reference to 'glUseProgram'
  34. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:1119: error: undefined reference to 'glUniform1i'
  35. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:1120: error: undefined reference to 'glUniform3f'
  36. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:1121: error: undefined reference to 'glUniform3f'
  37. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:1150: error: undefined reference to 'glUniform1i'
  38. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:1151: error: undefined reference to 'glUniform1f'
  39. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:1152: error: undefined reference to 'glUniform1f'
  40. jni/../jni/../../../Engine/gfx/ali3dogl.cpp:1264: error: undefined reference to 'glUseProgram'
  41. /home/USERNAME/git/ags/Android/buildlibs/armeabi/allegro-4.4.2/src/allegro.c:619: error: undefined reference to 'stderr'
  42. /home/USERNAME/git/ags/Android/buildlibs/armeabi/allegro-4.4.2/src/allegro.c:503: error: undefined reference to 'stdout'
  43. /home/USERNAME/git/ags/Android/buildlibs/armeabi/allegro-4.4.2/src/unicode.c:2294: error: undefined reference to 'atof'
  44. jni/../jni/../../nativelibs/armeabi/lib/libdumb.a(rendsig.o):rendsig.c:function duh_sigrenderer_set_callback: error: undefined reference to 'stderr'
  45. jni/../jni/../../nativelibs/armeabi/lib/libdumb.a(rendsig.o):rendsig.c:function duh_sigrenderer_set_analyser_callback: error: undefined reference to 'stderr'
  46. jni/../jni/../../nativelibs/armeabi/lib/libdumb.a(itread.o):itread.c:function it_load_sigdata: error: undefined reference to 'stderr'
  47. clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  48. make: *** [obj/local/armeabi/libagsengine.so] Error 1
  49.  
  50.  

CW, I will wait you do this correctly, since I have no idea how to do this.
« Last Edit: 14 Feb 2018, 13:35 by eri0o »

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: AGS engine Android port
« Reply #739 on: 15 Feb 2018, 00:27 »
Quote
Edit2: Right below the first if defined (ANDROID_VERSION) I added
#include <GLES2/gl2.h>

This header should be included in ogl_headers.h, where <GLES/gl.h> is.

Firstly we need to find out whether gl2.h is enough, secondly if there are still functions that have different names (if there are) should be remapped using defines, similar to how other GL functions are remapped, e.g.
Code: C++
  1. #define glGenFramebuffersEXT glGenFramebuffersOES
  2. #define glDeleteFramebuffersEXT glDeleteFramebuffersOES
  3.  
IDK if that is needed, so just mentioning FYI.


But not sure if that would be enough.
I was going to try that out after I am able to build it.

Right now I am very concerned about changing platform versions, from platform-9 to 14 in library scripts, and the one you mentioned later in project-properties, because I have no idea how that work and what could be broken by doing that.
E: I found platform version history here: https://en.wikipedia.org/wiki/Android_version_history
E2: Also some similar discussion, for reference: https://github.com/koreader/koreader-base/issues/332


What bothers me also is whether these shader functions are supported on all Android devices or not. And what will happen if we demand it inclusion into program. For instance, Windows version works with function pointers which it first tries to get from OpenGL's DLL. If it fails, it can simply check for that and skip some code during drawing.

There's an alternative solution, when the functions that are not found right now will be declared as ints = 0, and similarily skipped during drawing. This will disable tinting on mobile devices (at least with OpenGL means), but at least won't break anything that already exists.

PS. Ideally the OpenGL renderer should be rewritten, having some generic OpenGL API exposed, and the inner workings hidden in implementations, one for each platform. But that will take some time to do.
« Last Edit: 15 Feb 2018, 01:20 by Crimson Wizard »