Sergey Zubkov
Sergey Zubkov

Reputation: 115

Embarcadero RAD Delphi 10.3.3, cannot compile my app with Box2D library for 64-bits Android

Cannot compile my App for Android 64-bit with Delphi 10.3.3. My App is using Box2D library. While compile I get following errors:

[DCC Error] E2597 C:\Users\Public\Documents\Embarcadero\Studio\android-ndk-r17b\toolchains\aarch64-linux-android-4.9\prebuilt\windows\aarch64-linux-android\bin\ld.exe: cannot find -lFlatBox2D
C:\Users\Public\Documents\Embarcadero\Studio\android-ndk-r17b\toolchains\aarch64-linux-android-4.9\prebuilt\windows\aarch64-linux-android\bin\ld.exe: cannot find -lgnustl_static

Compilation for Android 32-bit of same App is successful. Compilation of another my (simple) App for Android 64-bits works fine.

So, I realized, that problem is only with Box2D for Android 64-bits used in my App.

Then I also tested compilation of Box2D TestBed App that is coming with RAD (here ...\Embarcadero\Studio\20.0\Samples\Object Pascal\Multi-Device Samples\Physics\TestBed\) - the same issue - it is compiled successfully for Android 32-bits, but same error when I'm compiling TestBed for Android 64-bits!

Please help. Thousands of lines of code in my App already, and now it is full stop - can't build it for Android 64-bits [scared]

UPDATE1

Second error "cannot find -lgnustl_static" fixed by adding path C:\Users\Public\Documents\Embarcadero\Studio\android-ndk-r17b\sources\cxx-stl\gnu-libstdc++\4.9\libs\arm64-v8a into menu Tools->Options, then 'SDK Manager'->NDK->'Android SDK 25.2.5 64-bits'-> value for 'Delphi NDK Library path'.

However, the first problem 'cannot find -lFlatBox2D'still exists. I found only 2 files of library libFlatBox2D.a on my computer, it is

C:\Program Files (x86)\Embarcadero\Studio\20.0\lib\android\debug
C:\Program Files (x86)\Embarcadero\Studio\20.0\lib\android\release

Both paths I added to the same 'Delphi NDK Library path' at SDK Manager for Android 64bit. However, now getting error message skipping incompatible libFlatBox2D.a when searching for -lFlatBox2D for each of these paths.

So the question now - where to find a compatible libFlatBox2D.a that required for Android 64bits?

UPDATE2:

Hm... and in following 2 android64 paths do not have any libFlatBox2D.a files.

C:\Program Files (x86)\Embarcadero\Studio\20.0\lib\android64\debug
C:\Program Files (x86)\Embarcadero\Studio\20.0\lib\android64\release

Does it mean, that 10.3.3 Delphi installation is missing 64-bits Box2D android library?

UPDATE3:

As answered by @Stefanos , now I have 64bit version of libFlatBox2D.a. But now while compiling I receiving count of 1700 linker errors about Box2D names , all of them similar to below:

[DCC Error] E2597 C:\Users\Public\Documents\Embarcadero\Studio\20.0\Samples\Object Pascal\Multi-Device Samples\Physics\TestBed\Android64\Debug\Box2D.Common.o: In function `Box2d::Common::Create_b2Draw_delegate(System::DelphiInterface<Box2d::Common::Ib2Draw>)':
  Box2D.Common:(.text._ZN5Box2d6Common22Create_b2Draw_delegateEN6System15DelphiInterfaceINS0_7Ib2DrawEEE[_ZN5Box2d6Common22Create_b2Draw_delegateEN6System15DelphiInterfaceINS0_7Ib2DrawEEE]+0x0): undefined reference to `Create_b2Draw_delegate'
  C:\Users\Public\Documents\Embarcadero\Studio\20.0\Samples\Object Pascal\Multi-Device Samples\Physics\TestBed\Android64\Debug\Box2D.Common.o: In function `Box2d::Common::Destroy_b2Draw_delegate(NativeUInt)':
  Box2D.Common:(.text._ZN5Box2d6Common23Destroy_b2Draw_delegateE10NativeUInt[_ZN5Box2d6Common23Destroy_b2Draw_delegateE10NativeUInt]+0x0): undefined reference to `Destroy_b2Draw_delegate'
  C:\Users\Public\Documents\Embarcadero\Studio\20.0\Samples\Object Pascal\Multi-Device Samples\Physics\TestBed\Android64\Debug\Box2D.Common.o: In function `Box2d::Common::b2Version_Create()':
  Box2D.Common:(.text._ZN5Box2d6Common16b2Version_CreateEv[_ZN5Box2d6Common16b2Version_CreateEv]+0x0): undefined reference to `b2Version_b2Version'
  C:\Users\Public\Documents\Embarcadero\Studio\20.0\Samples\Object Pascal\Multi-Device Samples\Physics\TestBed\Android64\Debug\Box2D.Common.o: In function `Box2d::Common::b2BlockAllocator_Create()':
  Box2D.Common:(.text._ZN5Box2d6Common23b2BlockAllocator_CreateEv[_ZN5Box2d6Common23b2BlockAllocator_CreateEv]+0x0): undefined reference to `b2BlockAllocator_b2BlockAllocator_1'
  C:\Users\Public\Documents\Embarcadero\Studio\20.0\Samples\Object Pascal\Multi-Device Samples\Physics\TestBed\Android64\Debug\Box2D.Common.o: In function `Box2d::Common::b2BlockAllocator_Destroy(NativeUInt)':
  Box2D.Common:(.text._ZN5Box2d6Common24b2BlockAllocator_DestroyE10NativeUInt[_ZN5Box2d6Common24b2BlockAllocator_DestroyE10NativeUInt]+0x0): undefined reference to `b2BlockAllocator_dtor'
etc...etc...

UPDATE4: Current status

I'm looking now for original libFlatBox2D.a library file for Android 64-bits (Delphi 10.3.3). If anyone has it, please share it with me.

The above attempts were not successful. An 'original' 64bits libFlatBox2D.a is required, which is not in my installation of RAD 10.3.3...

UPDATE5:

Embarcadero QA created a ticket: https://quality.embarcadero.com/browse/RSP-27762 Will wait from their solution.

Upvotes: 0

Views: 2701

Answers (1)

Stefanos
Stefanos

Reputation: 11

You have to create a new Package with name FlatBox2D, add all FlatBox units from ..\studio\20.0\source\FlatBox2D and compile it for Android64.

I have created the package and compiled both debug and release versions for Android64 with Delphi 10.3.3. In the link below you will find the new package files and the Android64 folder where you can find the libFlatBox2D.a for Debug and Release. Just copy the .a file to the corresponding folder in ..\studio\20.0\lib\Android64.

You can always compile the package on your own by just copying the FlatBox2D.dpr and FlatBox2D.dproj files in ..\studio\20.0\source\FlatBox2D, load the dpr in Delphi and compile it for Android64...

Stefanos

FlatBox2D.zip

Upvotes: 1

Related Questions