Blitzmax and android

Started by kamashin, April 29, 2020, 11:21:36

Previous topic - Next topic

kamashin

Hi everyone,

been pulling my hair at compiling things for android, had a hard time installing every sdk as should be (got a hellish time figuring what to do since the latest android NDK doesn t have a gcc nor a g++ anymore, had to install previous versions)
and in the end, Blitzmax refuses to build, giving me this message:

QuoteCannot determine SDK target dir. ANDROID_SDK_TARGET or android.sdk.target option is not set, and auto-lookup failed.

While playing a bit with the config file, i understood that it's linked to the #addoption android.sdk.target "23" line of the custom.bmk, but tempering with it (removing the # and changing the number 23, 12... whatever didn t make it successful, and i really don't know what Blizmax expect)

Here is my custom.bmk

# Example options

# ** compiler optimisation **
setccopt optimization -O3

# ** specific architecture **
#setwin32ccopt arch -march=pentium3

#setmacx86ccopt arch -march=nocona
#setmacx86ccopt math -msse3



# ** android configuration **
# ** architecture is determined by build settings **
# ** NOTE : android build requires bmk resources folder at BlitzMax/resources **

addoption android.home "C:\Program Files\Android\Android Studio"
addoption android.sdk "C:\Program Files\Android\Android Studio"
addoption android.ndk "C:\Users\KamaShin\Downloads\android-ndk-r14b"
addoption android.toolchain.version "4.9"
addoption android.platform "12"
addoption ant.home "C:\Users\KamaShin\Downloads\apache-ant-1.9.14-bin\apache-ant-1.9.14"

# ** Optional SDK target **
#    Will try to determine valid target to update project.properties, if not set.
#addoption android.sdk.target "23"

# ** optional ant location **
# ** defaults to resources/apache-ant **

addoption ant.home "C:\Users\KamaShin\Downloads\apache-ant-1.9.14-bin\apache-ant-1.9.14"


If anyone has some greater knowledge about this, i would really appreciate it.

Also, there is a line in this custom.bmk: # ** NOTE : android build requires bmk resources folder at BlitzMax/resources **
not sure what those "bmk resources" are?

Thanks for reading me

kamashin

Found my own mistake, the path for the android sdk was wrong, i put the path or android studio, not ,the sdk installed by it... So it's a bit better, on to the next error message:
QuoteError creating class file 'C:/Games/CasseBrique/android-project-RetroBrik/src/com/blitzmax/app/BlitzMaxApp.java'

any idea?

kamashin

I m progressing, I managed to figure out i had to ind the required files on the internet, and put them myself in an android-project-gamename folder, next to the gamename.bmx that is currently being compiled

so compiling starts, and then i got this message, and i m starting to get stuck here:
QuoteC:/Games/BlitzMax/mod/brl.mod/blitz.mod/blitz_debug.c:39:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
  for (int j = low; j <= high- 1; j++) {
  ^
C:/Games/BlitzMax/mod/brl.mod/blitz.mod/blitz_debug.c:39:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code

Any idea here?

Derron

I reached out to Brucey in the BlitzMax(NG) discord chat channel here:
https://discord.gg/udSSJkj

if you are a discord user already (or want to join - for free) then do not hesitate to ask questions there too.


@ C99
Seems it needs to set some options

Some modules do it that way:


?win32
ModuleInfo "CC_OPTS: -DLIBCLIPBOARD_BUILD_WIN32"
?linux
ModuleInfo "CC_OPTS: -DLIBCLIPBOARD_BUILD_X11"
?macos
ModuleInfo "CC_OPTS: -DLIBCLIPBOARD_BUILD_COCOA"
?


But I am doubting much that this is what needs to be altered ... I am pretty clueless on these things.


bye
Ron

markcwm


kamashin

@Derron, thanks for the tip, though i doubt the code can help, reaching Brucey might very much help, i will go there

@markcwm i already followed this tutorial, actually, and after much suffering, i could reach the state of my last message... Sadly, nothing in this tutorial seem to point at compiling error inside blitzmax itself for C99 or C11 issues, thanks anyway :)

it's like the compiler uses C99 or C11 parameter when compiling for windows but not for android though it would need to...

markcwm

#6
What is the gcc compiler version you're using? It could be if you use the older 5.1 it works, I haven't tested android since I used that. It's easy to change version if using NG, just get the MinGW32 folder in v0.87 and rename MinGW32x64 and x86 folders.

kamashin

Going to try this, don't really know what version of minGW i'm using, i just downloaded the latest package from the official site

markcwm

Okay, well make sure you rebuild all your modules (at least brl and pub) or you may get conflicts. Look in Help>About MaxIDE under GCC version, or anywhere in Cmd type "gcc --version".

kamashin

ok, i tried getting what i think is minGW 5.1.4, tried rebuilding all the modules, i get this error:
Quotecc1plus.exe: error: unrecognized command line option "-std=c++17"
Build Error: failed to compile (1) C:/Games/BlitzMax/mod/audio.mod/libopenmpt.mod/openmpt/common/FileReader.cppcc1plus.exe: error: unrecognized command line option "-std=c++17"

Process complete

if i try to compile my game now, it doesn t work anymore even for windows
QuoteBuilding RetroBrik
[ 22%] Processing:Animation.bmx
[ 22%] Processing:Brique.bmx
[ 22%] Processing:Medias.bmx
[ 23%] Processing:Particles.bmx
[ 23%] Processing:Player.bmx
[ 23%] Processing:Bille.bmx
[ 23%] Processing:Bonus.bmx
[ 23%] Processing:Teleport.bmx
[ 23%] Processing:RetroBrik.bmx
[ 62%] Compiling:Medias.bmx.release.win32.x86.incbin.c
[ 85%] Compiling:Animation.bmx.release.win32.x86.c
[ 85%] Compiling:Brique.bmx.release.win32.x86.c
[ 85%] Compiling:Medias.bmx.release.win32.x86.c
[ 85%] Compiling:Particles.bmx.release.win32.x86.c
[ 85%] Compiling:Player.bmx.release.win32.x86.c
[ 85%] Compiling:Bille.bmx.release.win32.x86.c
[ 86%] Compiling:Bonus.bmx.release.win32.x86.c
[ 86%] Compiling:Teleport.bmx.release.win32.x86.c
[ 86%] Compiling:RetroBrik.bmx.gui.release.win32.x86.c
C:/Games/CasseBrique/.bmx/Animation.bmx.release.win32.x86.c:133: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Animation.bmx.release.win32.x86.c:139: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Animation.bmx.release.win32.x86.c:145: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Animation.bmx.release.win32.x86.c:151: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Animation.bmx.release.win32.x86.c:157: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Animation.bmx.release.win32.x86.c:163: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Animation.bmx.release.win32.x86.c:169: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Animation.bmx.release.win32.x86.c:175: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Animation.bmx.release.win32.x86.c:181: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Animation.bmx.release.win32.x86.c:187: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Animation.bmx.release.win32.x86.c:193: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Animation.bmx.release.win32.x86.c:199: error: unknown field `var_address' specified in initializer
C:/Games/CasseBrique/.bmx/Animation.bmx.release.win32.x86.c:205: error: unknown field `var_address' specified in initializer
C:/Games/CasseBrique/.bmx/Animation.bmx.release.win32.x86.c:211: error: unknown field `var_address' specified in initializer
Build Error: failed to compile (1) C:/Games/CasseBrique/.bmx/Animation.bmx.release.win32.x86.cC:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:200: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:206: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:212: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:218: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:224: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:230: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:236: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:242: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:248: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:254: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:260: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:266: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:272: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:278: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:284: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:290: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:296: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:302: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:308: error: unknown field `var_address' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:314: error: unknown field `var_address' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:320: error: unknown field `var_address' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:326: error: unknown field `var_address' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:364: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:370: error: unknown field `field_offset' specified in initializer
C:/Games/CasseBrique/.bmx/Brique.bmx.release.win32.x86.c:376: error: unknown field `var_address' specified in initializer

Process complete

I must be doing something wrong, but I'm not sure what
And in blitzmax ide it says GCC Version unavailable

kamashin

Would you have a link to download minGW 5.1 ready for blitzmax??? cause, google gives me hell, with several version of minGW all over the place, i m kinda lost

markcwm

Okay, sorry I shouldn't have told you to swap out your MinGW for an older one, it used to work with v0.93, so here's a link to v0.87 with GCC 5.1 as found on the Bmx-NG releases. I've been using v0.93 for 2 or 3 years now, I'm only just upgrading to v0.120 now.

kamashin

No problem, rolling bakc isn't hard, finding what works and how is a lot harder :D

Downloading the 0.87 now, i ll see if it works for android compiling, i don't mind keeping 2 version of BMax if it works ^^

kamashin

It seems to be working, except for one tiny little detail, I m using SColor8 type, which BMax 0.87 doesn t seem to know
I'll try to work around it, but other than that, compilation both for windows and android went up to 98% so, looking good...
Thanks a lot mate, making progress here ^^

kamashin

I'm on the verge of something, everything seem to compile fine with the version you gave me, but just at the end, i get a failed to create apk message.
Any idea?

QuoteBuilding RetroBrik
[ 13%] Processing:linkedlist.bmx
[ 36%] Compiling:linkedlist.bmx.release.android.armeabi.c
[ 46%] Archiving:linkedlist.release.android.armeabi.a
[ 81%] Processing:Animation.bmx
[ 82%] Processing:Brique.bmx
[ 83%] Processing:Medias.bmx
[ 84%] Processing:Particles.bmx
[ 85%] Processing:Player.bmx
C:\Users\KamaShin\Downloads\android-ndk-r14b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ar.exe: creating C:/BlitzMax 0.87/mod/brl.mod/linkedlist.mod/linkedlist.release.android.armeabi.a
[ 86%] Compiling:Animation.bmx.release.android.armeabi.c
[ 87%] Compiling:Brique.bmx.release.android.armeabi.c
[ 88%] Compiling:Medias.bmx.release.android.armeabi.c
[ 89%] Compiling:Particles.bmx.release.android.armeabi.c
[ 90%] Compiling:Player.bmx.release.android.armeabi.c
[ 91%] Processing:Bille.bmx
[ 92%] Compiling:Bille.bmx.release.android.armeabi.c
[ 93%] Processing:Bonus.bmx
[ 94%] Processing:Teleport.bmx
[ 95%] Compiling:Bonus.bmx.release.android.armeabi.c
[ 96%] Compiling:Teleport.bmx.release.android.armeabi.c
[ 97%] Processing:RetroBrik.bmx
[ 98%] Compiling:RetroBrik.bmx.gui.release.android.armeabi.c
[100%] Linking:RetroBrik
Error creating apk
Process complete