Recent

Author Topic: New crossplatform install problem  (Read 5263 times)

tjm

  • Newbie
  • Posts: 4
New crossplatform install problem
« on: October 27, 2016, 07:10:03 pm »
Installing an environment for android programming and development by following some instructions I found that appear to be reasonable, BUT there is a conflict that produces this error in a link.res file:

error: bin/arm-linux/link.res:375:8: syntax error, unexpected STRING
fatal error: unable to parse script file bin/arm-linux/link.res

I'm unable to find any syntax specification guidance to actually locate the problem so I've attached the link.res file (named link.res.txt for upload purposes) for anyone to spot the error.  Line 375 is the last line of the file.

Thanks for the help.
tm

Eugene Loza

  • Hero Member
  • *****
  • Posts: 673
    • My games in Pascal
Re: New crossplatform install problem
« Reply #1 on: October 27, 2016, 08:03:56 pm »
by following some instructions
Which instructions did you follow? I don't think there is an error in FPC on this side, because Android cross-compillation works fine for me at Linux.
Quote
BUT there is a conflict that produces this error in a link.res file:

error: bin/arm-linux/link.res:375:8: syntax error, unexpected STRING
fatal error: unable to parse script file bin/arm-linux/link.res
File location "bin/arm-linux/link.res" looks really strange to me. What did you install there? FPC? Android SDK?
I couldn't find any link.res file at my computer (while Android crosscompillation installed and running fine).

So... what did you do and which stage failed?
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: New crossplatform install problem
« Reply #2 on: October 27, 2016, 11:53:50 pm »
link.res is a linker script that FPC generates. By default it's deleted after successful linking. OP problem is possibly from FPC target, which is arm-linux, which is incorrect for Android. Android target should be arm-android. OP needs to tell much much more information, as everything he says is currently unclear (what FPC version? which "some instructions"? what binutils used? etc.).

tjm

  • Newbie
  • Posts: 4
Re: New crossplatform install problem
« Reply #3 on: October 28, 2016, 12:59:14 am »
I (almost) followed the instructions here: http://wiki.lazarus.freepascal.org/Android_tutorial

with the exception of using the latest versions of Android SDK, NDK and FPC.  I suspect that the NDK version (instructions use v9, I used v13) is the problem, so I'll back it up to v9 and try again, then if successful, I'll look into the v13 problem.

Any suggestions either way would be helpful.  I don't see an option for arm-linux, only arm-linux-android-eabi-4.9 (instructions have ...-eabi-4.8).

Other than that, I'm using an up-to-date Debian stable installation.

thanks,
tm

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: New crossplatform install problem
« Reply #4 on: October 28, 2016, 10:02:01 am »
I suspect that the NDK version (instructions use v9, I used v13) is the problem, so I'll back it up to v9 and try again, then if successful, I'll look into the v13 problem.
I use v13 as well, it works just fine.
Any suggestions either way would be helpful.  I don't see an option for arm-linux, only arm-linux-android-eabi-4.9 (instructions have ...-eabi-4.8).
I mean for FPC, not binutils. You still haven't given enough info, like what FPC version you use both the starting compiler and target compiler, what compiler options you use, both when building the cross compiler and your app, etc.. A slight difference could break everything.

tjm

  • Newbie
  • Posts: 4
Re: New crossplatform install problem
« Reply #5 on: October 31, 2016, 05:14:31 pm »
Sorry, been busy all weekend.

I found two procedures for getting this installed.  The second one I tried was yours, Pascal Warrior's Journey' .  I always try the easy route first, and as it happened, neither procedure would complete without errors,  the error being the link.res file that I posted above.  Same error in both procedure ends the compilation, which is the syntax error in the last line of the link.res file.

Versions.
fpc version is 3.0.0 .

android sdk is v25 (25.2.2)
ndk - tried v9d and v13
fpc target is also 3.0.0
binutils is v 2.25-5

My distribution is Debian stable with all updates as of today.

I've written some programs years ago using Turbo Pascal and to be honest I would rather spend the time with Android Studio, BUT I have access to fp libraries and source for the application I'm considering so this seems like a logical choice.  Maybe it's not, but I'll need to make this installation first to find out.

thanks,
tm

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: New crossplatform install problem
« Reply #6 on: October 31, 2016, 05:53:34 pm »
The second one I tried was yours, Pascal Warrior's Journey.
OK, that was old, but all the points should still apply today, as my current cross build script is based on it. Summarizing the article, there are at least:
  • -XP$FPCTARGET- in fpc.cfg
  • Ensuring ls -l `which arm-android-as` & ls -l `which arm-android-ld` works pointing to the correct NDK path
  • Execute: make crossall OS_TARGET=android CPU_TARGET=arm CROSSOPT='-Cp<ARM Arch> -Cf<ARM VFP>' in FPC source folder with correct -Cp and -Cf
  • Execute: make crossinstall OS_TARGET=android CPU_TARGET=arm INSTALL_PREFIX=<directory of your choice> in FPC source folder after successful previous step
  • Ensuring `fpc -Parm -Tandroid` works correctly displaying arm-android target in the output
On which step you experience the link.res error?

tjm

  • Newbie
  • Posts: 4
Re: New crossplatform install problem
« Reply #7 on: November 01, 2016, 05:08:53 am »
Reinstalled all of the packages then went through the procedure again and it worked without errors.  Don't know where I may have made a mistake or typo or whether a download had some corruption but it appears to be resolved.  The link.res error was generated on the first 'make' and I tried to duplicate that to verify but I'm happy the error has resolved itself.  More questions later.

thanks,
tm

BeniBela

  • Hero Member
  • *****
  • Posts: 906
    • homepage
Re: New crossplatform install problem
« Reply #8 on: April 23, 2019, 11:40:56 pm »
After updating to the new ndk, I spent a few hours over this issue, too.

The problem is that there are multiple linkers:

Code: [Select]
$l ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld*
5060736 22. Apr 14:01 ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld*
1319664 22. Apr 14:01 ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld.bfd*
5060736 22. Apr 14:01 ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld.gold*

If you just copy ld or make a symlink to it, you get the gold linker, which does not work with fpc, because it does not support the INSERT command

You need to use the bfd linker


 

TinyPortal © 2005-2018