Google Play New problem : 64bits

All topics about ZGameEditor goes here.

Moderator: Moderators

User avatar
Ats
Posts: 727
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

Does your project make direct OpenGL calls from ZGE scripting?
If you're talking about Omeganaut, yes, I use OpenGL direct calls for the fog and for setting the VR viewports, but I can comment out TExternalFunctionCall just to try if it compiles. Just to be sure, do I comment the whole thing from 1977 { TExpExternalFuncCall } to 2461 {$ifend}, or less?

I compiled test.pas using :

Code: Select all

Path C:\Android\android-ndk-r18b\toolchains\aarch64-linux-android-4.9\prebuilt\windows-x86_64\bin
C:\FPC\a64\bin\i386-win32\ppcrossa64 -B -MDelphi -Sghi -O3 -Tandroid -XXis -vw -Filib\arm-linux -FlC:\Android\android-ndk-r18b\platforms\android-28\arch-arm64\usr\lib -Fu. -Fu..\.. -FUlib\arm-linux\ -FEjava\libs\arm64-v8a\ -olibzgeandroid.so -dANDROID -dMINIMAL -Xd -al test.pas
(not sure about that either)

But here's the resulted test.s :

Code: Select all

	.file "test.pas"
// Begin asmlist al_procedures

.section .text.n_p$test_$$_f$longint$longint
	.balign 8
.globl	P$TEST_$$_F$LONGINT$LONGINT
	.type	P$TEST_$$_F$LONGINT$LONGINT,@function
P$TEST_$$_F$LONGINT$LONGINT:
// [test.pas]
// [4] begin
	stp	x29,x30,[sp, #-16]!
	mov	x29,sp
	stp	x19,x19,[sp, #-16]!
// Var x1 located in register w0
// Var x2 located in register w1
// [5] writeln('test');
	bl	fpc_get_output
	mov	x19,x0
	adrp	x2,:got:_$TEST$_Ld1
	ldr	x2,[x2, :got_lo12:_$TEST$_Ld1]
	mov	x1,x19
	movz	w0,#0
	bl	fpc_write_text_shortstr
	bl	fpc_iocheck
	mov	x0,x19
	bl	fpc_writeln_end
	bl	fpc_iocheck
// [6] end;
	ldr	x19,[sp], #16
	ldp	x29,x30,[sp], #16
	ret
.Le0:
	.size	P$TEST_$$_F$LONGINT$LONGINT, .Le0 - P$TEST_$$_F$LONGINT$LONGINT

.section .text.n_main
	.balign 8
.globl	PASCALMAIN
	.type	PASCALMAIN,@function
PASCALMAIN:
.globl	main
	.type	main,@function
main:
// [8] begin
	stp	x29,x30,[sp, #-16]!
	mov	x29,sp
	bl	fpc_initializeunits
// [9] f(1,2);
	movz	w1,#2
	movz	w0,#1
	bl	P$TEST_$$_F$LONGINT$LONGINT
// [10] end.
	bl	fpc_do_exit
	ldp	x29,x30,[sp], #16
	ret
.Le1:
	.size	main, .Le1 - main

.section .text
// End asmlist al_procedures
// Begin asmlist al_globals

.section .data.rel.n_INITFINAL
	.balign 8
.globl	INITFINAL
	.type	INITFINAL,@object
INITFINAL:
	.quad	2,0
	.quad	INIT$_$SYSTEM
	.quad	0,0
	.quad	FINALIZE$_$OBJPAS
.Le2:
	.size	INITFINAL, .Le2 - INITFINAL

.section .data.rel.n_FPC_THREADVARTABLES
	.balign 8
.globl	FPC_THREADVARTABLES
	.type	FPC_THREADVARTABLES,@object
FPC_THREADVARTABLES:
	.long	1
	.quad	THREADVARLIST_$SYSTEM$indirect
.Le3:
	.size	FPC_THREADVARTABLES, .Le3 - FPC_THREADVARTABLES

.section .data.rel.ro.n_FPC_RESOURCESTRINGTABLES
	.balign 8
.globl	FPC_RESOURCESTRINGTABLES
	.type	FPC_RESOURCESTRINGTABLES,@object
FPC_RESOURCESTRINGTABLES:
	.quad	0
.Le4:
	.size	FPC_RESOURCESTRINGTABLES, .Le4 - FPC_RESOURCESTRINGTABLES

.section .data.rel.n_FPC_WIDEINITTABLES
	.balign 8
.globl	FPC_WIDEINITTABLES
	.type	FPC_WIDEINITTABLES,@object
FPC_WIDEINITTABLES:
	.quad	0
.Le5:
	.size	FPC_WIDEINITTABLES, .Le5 - FPC_WIDEINITTABLES

.section .data.rel.n_FPC_RESSTRINITTABLES
	.balign 8
.globl	FPC_RESSTRINITTABLES
	.type	FPC_RESSTRINITTABLES,@object
FPC_RESSTRINITTABLES:
	.quad	0
.Le6:
	.size	FPC_RESSTRINITTABLES, .Le6 - FPC_RESSTRINITTABLES

.section .fpc.n_version
	.balign 16
	.type	__fpc_ident,@object
__fpc_ident:
	.ascii	"FPC 3.3.1 [2019/07/18] for aarch64 - Android"
.Le7:
	.size	__fpc_ident, .Le7 - __fpc_ident

.section .data.rel.n___stklen
	.balign 8
.globl	__stklen
	.type	__stklen,@object
__stklen:
	.quad	8388608
.Le8:
	.size	__stklen, .Le8 - __stklen

.section .data.rel.n___heapsize
	.balign 8
.globl	__heapsize
	.type	__heapsize,@object
__heapsize:
	.quad	0
.Le9:
	.size	__heapsize, .Le9 - __heapsize

.section .data.rel.n___fpc_valgrind
	.balign 8
.globl	__fpc_valgrind
	.type	__fpc_valgrind,@object
__fpc_valgrind:
	.byte	0
.Le10:
	.size	__fpc_valgrind, .Le10 - __fpc_valgrind

.section .data.rel.ro.n_FPC_RESLOCATION
	.balign 8
.globl	FPC_RESLOCATION
	.type	FPC_RESLOCATION,@object
FPC_RESLOCATION:
	.quad	0
.Le11:
	.size	FPC_RESLOCATION, .Le11 - FPC_RESLOCATION
// End asmlist al_globals
// Begin asmlist al_typedconsts

.section .rodata.n__$TEST$_Ld1
	.balign 8
.globl	_$TEST$_Ld1
_$TEST$_Ld1:
	.ascii	"\004test\000"
.Le12:
	.size	_$TEST$_Ld1, .Le12 - _$TEST$_Ld1
// End asmlist al_typedconsts
.section .note.GNU-stack,"",%progbits
User avatar
VilleK
Site Admin
Posts: 2334
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Google Play New problem : 64bits

Post by VilleK »

Try commenting out the whole implementation of TExpExternalFuncCall.Execute for android.

Something like this:

Code: Select all

{$if defined(android)}
procedure TExpExternalFuncCall.Execute(Env : PExecutionEnvironment);
begin
    Platform_Error('External function call not yet implemented for Android 64-bit');
end;
This way you should be able to try with a simple project and see if the basics are working.
User avatar
Ats
Posts: 727
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

So here are the new compilations warnings and fatal error:

Code: Select all

ZClasses.pas(585,5) Warning: Constructor should be public
ZMath.pas(652,1) Warning: Function result variable does not seem to be initialized
GLDrivers.pas(572,32) Warning: Conversion between ordinals and pointers is not portable
GLDrivers.pas(577,43) Warning: Conversion between ordinals and pointers is not portable
GLDrivers.pas(586,40) Warning: Conversion between ordinals and pointers is not portable
GLDrivers.pas(949,54) Warning: Conversion between ordinals and pointers is not portable
GLDrivers.pas(955,63) Warning: Conversion between ordinals and pointers is not portable
GLDrivers.pas(962,56) Warning: Conversion between ordinals and pointers is not portable
ZApplication.pas(1105,8) Warning: Conversion between ordinals and pointers is not portable
Renderer.pas(805,17) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
Renderer.pas(972,23) Warning: Local variable "TextBuf" does not seem to be initialized
Renderer.pas(1465,20) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
Renderer.pas(1466,20) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
Renderer.pas(1606,66) Warning: Local variable "ScaledGravity" does not seem to be initialized
ZExpressions.pas(649,5) Warning: Function result variable does not seem to be initialized
ZExpressions.pas(1901,28) Warning: Local variable "Dest" does not seem to be initialized
ZExpressions.pas(2603,36) Warning: Local variable "V" does not seem to be initialized
ZBitmap.pas(289,24) Warning: Local variable "NewMemory" does not seem to be initialized
ZPlatform_Android.inc(63,59) Fatal: Can't find unit SyncObjs used by ZPlatform
User avatar
VilleK
Site Admin
Posts: 2334
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Google Play New problem : 64bits

Post by VilleK »

This unit should exist. Maybe it is only a issue of case. Try changing SyncObjs to "syncobjs" in ZPlatform_Android.inc.
User avatar
Ats
Posts: 727
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

It did not work.
If that could help, I searched for that lib in the FPC-a64 folder:
C:\FPC\a64\units\aarch64-android\fcl-base\synsobj.o
C:\FPC\a64\units\aarch64-android\fcl-base\synsobj.ppu
C:\FPC\a64\units\aarch64-android\fcl-base\synsobj.rsj
C:\FPC\a64\units\i386-win32\fcl-base\synsobj.o
C:\FPC\a64\units\i386-win32\fcl-base\synsobj.ppu
C:\FPC\a64\units\i386-win32\fcl-base\synsobj.rsj

And I just tried to recompile ZGE android 32 and it worked with those warnings:

Code: Select all

ZClasses.pas(585,5) Warning: Constructor should be public
ZMath.pas(652,1) Warning: Function result variable does not seem to be initialized
Renderer.pas(805,17) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
Renderer.pas(972,23) Warning: Local variable "TextBuf" does not seem to be initialized
Renderer.pas(1465,20) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
Renderer.pas(1466,20) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
Renderer.pas(1606,66) Warning: Local variable "ScaledGravity" does not seem to be initialized
ZExpressions.pas(649,5) Warning: Function result variable does not seem to be initialized
ZExpressions.pas(1901,28) Warning: Local variable "Dest" does not seem to be initialized
ZExpressions.pas(2603,36) Warning: Local variable "V" does not seem to be initialized
ZBitmap.pas(289,24) Warning: Local variable "NewMemory" does not seem to be initialized
ZClasses.pas(731,5) Warning: Constructor should be public
ZClasses.pas(802,6) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
ZClasses.pas(803,14) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
ZClasses.pas(1223,1) Warning: Function result variable does not seem to be initialized
ZClasses.pas(1347,23) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
ZClasses.pas(2154,15) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
ZClasses.pas(3992,19) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
ZClasses.pas(3992,38) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
BitmapProducers.pas(342,18) Warning: Local variable "Y" does not seem to be initialized
BitmapProducers.pas(341,18) Warning: Local variable "X" does not seem to be initialized
BitmapProducers.pas(983,34) Warning: Local variable "CP" does not seem to be initialized
Steering.pas(493,37) Warning: Local variable "ClosestPoint" does not seem to be initialized
ImplicitMeshes.pas(196,5) Warning: Constructor should be public
ZFile.pas(236,23) Warning: Local variable "NameBuf" does not seem to be initialized
And after reading through https://wiki.lazarus.freepascal.org/Uni ... find_units
"This page is about the most dreaded, prominent error of Pascal: unit not found or can't find unit."

Here's the log of zge compilation for a64 using -vut
(in the attached zip file, log is too long for the forum and I can't upload plain txt file)
Attachments
console_log.zip
(8.73 KiB) Downloaded 496 times
User avatar
VilleK
Site Admin
Posts: 2334
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Google Play New problem : 64bits

Post by VilleK »

Ats wrote: Wed Jul 24, 2019 9:31 am It did not work.
If that could help, I searched for that lib in the FPC-a64 folder:
C:\FPC\a64\units\aarch64-android\fcl-base\synsobj.o
C:\FPC\a64\units\aarch64-android\fcl-base\synsobj.ppu
C:\FPC\a64\units\aarch64-android\fcl-base\synsobj.rsj
C:\FPC\a64\units\i386-win32\fcl-base\synsobj.o
C:\FPC\a64\units\i386-win32\fcl-base\synsobj.ppu
C:\FPC\a64\units\i386-win32\fcl-base\synsobj.rsj
"synsobj"??? That is really weird, there isn't such a file on the Freepsacal repo: https://github.com/graemeg/freepascal/s ... _q=synsobj

Could it be a typo in the Fpc arm build script? Which revision and branch of Fpc are you using?
User avatar
Ats
Posts: 727
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

Sorry, it is my typo... it is syncobjs instead.
User avatar
VilleK
Site Admin
Posts: 2334
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Google Play New problem : 64bits

Post by VilleK »

Try adding

"-FuC:\FPC\a64\units\aarch64-android\fcl-base"

to the ZGE build command.
User avatar
Ats
Posts: 727
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

It went a bit further :D
Here's the new error log:

Code: Select all

ZClasses.pas(585,5) Warning: Constructor should be public
ZMath.pas(652,1) Warning: Function result variable does not seem to be initialized
GLDrivers.pas(572,32) Warning: Conversion between ordinals and pointers is not portable
GLDrivers.pas(577,43) Warning: Conversion between ordinals and pointers is not portable
GLDrivers.pas(586,40) Warning: Conversion between ordinals and pointers is not portable
GLDrivers.pas(949,54) Warning: Conversion between ordinals and pointers is not portable
GLDrivers.pas(955,63) Warning: Conversion between ordinals and pointers is not portable
GLDrivers.pas(962,56) Warning: Conversion between ordinals and pointers is not portable
ZApplication.pas(1105,8) Warning: Conversion between ordinals and pointers is not portable
Renderer.pas(805,17) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
Renderer.pas(972,23) Warning: Local variable "TextBuf" does not seem to be initialized
Renderer.pas(1465,20) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
Renderer.pas(1466,20) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
Renderer.pas(1606,66) Warning: Local variable "ScaledGravity" does not seem to be initialized
ZExpressions.pas(649,5) Warning: Function result variable does not seem to be initialized
ZExpressions.pas(1901,28) Warning: Local variable "Dest" does not seem to be initialized
ZExpressions.pas(2603,36) Warning: Local variable "V" does not seem to be initialized
ZBitmap.pas(289,24) Warning: Local variable "NewMemory" does not seem to be initialized
ZPlatform_Android.inc(512,38) Error: Call by var for arg no. 3 has to match exactly: Got "LongWord" expected "QWord"
ZPlatform_Android.inc(652,13) Warning: Conversion between ordinals and pointers is not portable
ZPlatform_Android.inc(711,41) Error: Call by var for arg no. 3 has to match exactly: Got "LongWord" expected "QWord"
ZPlatform_Android.inc(712,13) Warning: Conversion between ordinals and pointers is not portable
ZPlatform.pas(141) Fatal: There were 2 errors compiling module, stopping
User avatar
VilleK
Site Admin
Posts: 2334
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Google Play New problem : 64bits

Post by VilleK »

Try this:

Code: Select all

procedure Platform_InitAudio;
var
  id : qword;
and

Code: Select all

function Platform_CreateThread(ZThread : TZThread) : pointer;
var
  id : qword;
User avatar
Ats
Posts: 727
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

Next errors:

Code: Select all

ZPlatform_Android.inc(512,29) Error: Incompatible type for arg no. 1: Got "AudioCallback(Pointer):LongInt;", expected "<procedure variable type of function(Pointer):Int64;StdCall>"
ZPlatform_Android.inc(711,28) Error: Incompatible type for arg no. 1: Got "ThreadWrapper(Pointer):LongInt;", expected "<procedure variable type of function(Pointer):Int64;StdCall>"
User avatar
VilleK
Site Admin
Posts: 2334
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Google Play New problem : 64bits

Post by VilleK »

Looks like it should be

function AudioCallback(Data : pointer) : int64;

and

function ThreadWrapper(Data : pointer) : int64;

Btw, just deleted 34 new spam accounts on these forums.
User avatar
Ats
Posts: 727
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

And here's the next error:

Code: Select all

ZClasses.pas(656,4) Fatal: Can't find unit zstream used by ZClasses
I suppose the source code I'm modifying will not be compatible to produce normal ZGE binaries? :D

I saw the spams this morning, I installed SpamBarrier on my forum (fluxbb), it really helps. You should take a look:
https://www.stopforumspam.com/mods#link_phpbb
User avatar
VilleK
Site Admin
Posts: 2334
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Google Play New problem : 64bits

Post by VilleK »

zstream is another Fpc unit: https://www.freepascal.org/docs-html/cu ... index.html

Please search for it and add it to the search path.

Thanks for the advice about anti-spam, I'll look into it. This morning there were 54 new accounts.
User avatar
Ats
Posts: 727
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Google Play New problem : 64bits

Post by Ats »

So I had to add a few more paths:

C:\FPC\a64\bin\i386-win32\ppcrossa64 -B -MDelphi -Sghi -O3 -Tandroid -XXis -vw -Filib\arm-linux -FlC:\Android\android-ndk-r18b\platforms\android-28\arch-arm64\usr\lib -Fu. -Fu..\.. -FUlib\arm-linux\ -FEjava\libs\arm64-v8a\ -olibzgeandroid.so -dANDROID -dMINIMAL -Xd -FuC:\FPC\a64\units\aarch64-android\fcl-base -FuC:\FPC\a64\units\aarch64-android\hash -FuC:\FPC\a64\units\aarch64-android\rtl-objpas -FuC:\FPC\a64\units\aarch64-android\paszlib zgeandroid.pas

Then I had to replace a few asm r0,r1 by x0,x1 in NanoJpeg.pas

Here's the final compilation log in case you want to take a look:

Code: Select all

ZClasses.pas(585,5) Warning: Constructor should be public
ZMath.pas(652,1) Warning: Function result variable does not seem to be initialized
GLDrivers.pas(572,32) Warning: Conversion between ordinals and pointers is not portable
GLDrivers.pas(577,43) Warning: Conversion between ordinals and pointers is not portable
GLDrivers.pas(586,40) Warning: Conversion between ordinals and pointers is not portable
GLDrivers.pas(949,54) Warning: Conversion between ordinals and pointers is not portable
GLDrivers.pas(955,63) Warning: Conversion between ordinals and pointers is not portable
GLDrivers.pas(962,56) Warning: Conversion between ordinals and pointers is not portable
ZApplication.pas(1105,8) Warning: Conversion between ordinals and pointers is not portable
Renderer.pas(805,17) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
Renderer.pas(972,23) Warning: Local variable "TextBuf" does not seem to be initialized
Renderer.pas(1465,20) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
Renderer.pas(1466,20) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
Renderer.pas(1606,66) Warning: Local variable "ScaledGravity" does not seem to be initialized
ZExpressions.pas(649,5) Warning: Function result variable does not seem to be initialized
ZExpressions.pas(1901,28) Warning: Local variable "Dest" does not seem to be initialized
ZExpressions.pas(2603,36) Warning: Local variable "V" does not seem to be initialized
ZBitmap.pas(289,24) Warning: Local variable "NewMemory" does not seem to be initialized
ZPlatform_Android.inc(652,13) Warning: Conversion between ordinals and pointers is not portable
ZClasses.pas(731,5) Warning: Constructor should be public
ZClasses.pas(802,6) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
ZClasses.pas(803,14) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
ZClasses.pas(1223,1) Warning: Function result variable does not seem to be initialized
ZClasses.pas(1347,23) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
ZClasses.pas(2154,15) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
ZClasses.pas(3068,14) Warning: Conversion between ordinals and pointers is not portable
ZClasses.pas(3992,19) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
ZClasses.pas(3992,38) Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
BitmapProducers.pas(342,18) Warning: Local variable "Y" does not seem to be initialized
BitmapProducers.pas(341,18) Warning: Local variable "X" does not seem to be initialized
BitmapProducers.pas(983,34) Warning: Local variable "CP" does not seem to be initialized
Steering.pas(493,37) Warning: Local variable "ClosestPoint" does not seem to be initialized
ImplicitMeshes.pas(196,5) Warning: Constructor should be public
ZFile.pas(236,23) Warning: Local variable "NameBuf" does not seem to be initialized
And now I have my libzgeandroid.so for arm64 !
I'll try to produce a simple zge apk after lunch.
Last edited by Ats on Wed Mar 03, 2021 5:20 pm, edited 1 time in total.
Post Reply