Recent

Author Topic: No longer able to cross-compile to linux-i386 from linux-x86_64  (Read 2330 times)

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1088
  • Professional amateur ;-P
No longer able to cross-compile to linux-i386 from linux-x86_64
« on: November 05, 2021, 08:00:00 am »
Hey Y'all,

Looks like my Ubuntu 21.20 has recently updated something in the libc area an I'm now unable to cross compile to linux-i386 from linux-x86_64.

I just ran lazbuild -B on a small project that has no external dependencies and this is the error that it spits out:

Code: Text  [Select][+][-]
  1. Free Pascal Compiler version 3.2.2-r49371 [2021/05/21] for i386
  2. Copyright (c) 1993-2021 by Florian Klaempfl and others
  3. (1002) Target OS: Linux for i386
  4. (3104) Compiling example.lpr
  5. (3104) Compiling ./forms/examples.forms.main.pas
  6. (3104) Compiling /home/gcarreno/Programming/lazAPIBay/src/tpb.query.pas
  7. (3104) Compiling /home/gcarreno/Programming/lazAPIBay/src/tpb.queryitem.pas
  8. (3104) Compiling /home/gcarreno/Programming/lazAPIBay/src/json/tpb.json.utils.pas
  9. /home/gcarreno/Programming/lazAPIBay/example/./forms/examples.forms.main.pas(81,26) Hint: (5024) Parameter "Sender" not used
  10. /home/gcarreno/Programming/lazAPIBay/example/./forms/examples.forms.main.pas(82,27) Hint: (5024) Parameter "Sender" not used
  11. /home/gcarreno/Programming/lazAPIBay/example/./forms/examples.forms.main.pas(83,37) Hint: (5024) Parameter "Sender" not used
  12. /home/gcarreno/Programming/lazAPIBay/example/./forms/examples.forms.main.pas(83,54) Hint: (5024) Parameter "User" not used
  13. /home/gcarreno/Programming/lazAPIBay/example/./forms/examples.forms.main.pas(79,25) Hint: (5024) Parameter "Sender" not used
  14. /home/gcarreno/Programming/lazAPIBay/example/./forms/examples.forms.main.pas(77,34) Hint: (5024) Parameter "Sender" not used
  15. /home/gcarreno/Programming/lazAPIBay/example/./forms/examples.forms.main.pas(78,32) Hint: (5024) Parameter "Sender" not used
  16. /home/gcarreno/Programming/lazAPIBay/example/./forms/examples.forms.main.pas(80,30) Hint: (5024) Parameter "Sender" not used
  17. (9022) Compiling resource /home/gcarreno/Programming/lazAPIBay/bin/lib/i386-linux/example.or
  18. (9015) Linking /home/gcarreno/Programming/lazAPIBay/bin/linux/i386/example
  19. /usr/bin/ld: /home/gcarreno/FreePascal_stable/fpc/units/i386-linux/rtl/si_c21.o: in function `SI_C21_$$__FPC_LIBC21_START':
  20. si_c21.pp:(.text.n_si_c21_$$__fpc_libc21_start+0x27): undefined reference to `__libc_csu_fini'
  21. /usr/bin/ld: si_c21.pp:(.text.n_si_c21_$$__fpc_libc21_start+0x2c): undefined reference to `__libc_csu_init'
  22. /home/gcarreno/Programming/lazAPIBay/example/example.lpr(47,1) Error: (9013) Error while linking
  23. /home/gcarreno/Programming/lazAPIBay/example/example.lpr(47,1) Fatal: (10026) There were 1 errors compiling module, stopping
  24. Fatal: (1018) Compilation aborted
  25. Error: /home/gcarreno/FreePascal_stable/fpc/bin/x86_64-linux/ppcross386 returned an error exitcode
  26. Error: (lazarus) Compile Project, Mode: Release-linux-i386, CPU: i386, Target: /home/gcarreno/Programming/lazAPIBay/bin/linux/i386/example: stopped with exit code 1
  27. Error: (lazbuild) failed compiling of project /home/gcarreno/Programming/lazAPIBay/example/example.lpi

As you can see, there's an issue with libc_csu_fini, libc_csu_init not being found.

I've tried it with both stable and laz-main(former trunk) and have the same result.

Can anyone make sense of this and maybe point me in a direction to solve it, or to report it?

All the thanks in advance :)

Cheers,
Gus

P.S.: To the moderator of the day, please feel free to move this thread. I'm completely unsure if this is the right place to drop it.
Thanks!!
« Last Edit: November 05, 2021, 08:04:23 am by Gustavo 'Gus' Carreno »
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

Thaddy

  • Hero Member
  • *****
  • Posts: 14159
  • Probably until I exterminate Putin.
Re: No longer able to cross-compile to linux-i386 from linux-x86_64
« Reply #1 on: November 05, 2021, 08:40:52 am »
It may be that the GNU compiler and linker is updated and the linker can not find the correct path. Can you check the path to the latest libc and ld? i.e. the .so.<number>? I have run into a similar issue before on Debian.
Specialize a type, not a var.

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
Re: No longer able to cross-compile to linux-i386 from linux-x86_64
« Reply #2 on: November 05, 2021, 12:05:30 pm »
I wonder if you need to ensure that you have the updated 32bit libc ?  Maybe the update process did not spot you have 32bit kit there ?

And check where it is, you need to ensure your fpc.cfg looks there.  Its just possible that Ubunu has moved their 32bit libraries. If they can put Firefox in a snap, they might do anything ! 

I always have to manually edit fpc.cfg when setting up for 32bit cross compile, details on the wiki.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1088
  • Professional amateur ;-P
Re: No longer able to cross-compile to linux-i386 from linux-x86_64
« Reply #3 on: November 05, 2021, 02:36:49 pm »
Hey Thaddy,

It may be that the GNU compiler and linker is updated and the linker can not find the correct path. Can you check the path to the latest libc and ld? i.e. the .so.<number>? I have run into a similar issue before on Debian.

Thanks for the tip. I'll have a looksie with some i386 binaries I had cross compiled before and find out what ldd tells me about the libs.

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1088
  • Professional amateur ;-P
Re: No longer able to cross-compile to linux-i386 from linux-x86_64
« Reply #4 on: November 05, 2021, 02:43:02 pm »
Hey Davo,

I wonder if you need to ensure that you have the updated 32bit libc ?  Maybe the update process did not spot you have 32bit kit there ?

I'll make extra sure but I'm pretty sure my system is aware of the 32b stuff since I get a warning every time I try to update 2 repos that don't have it any more.
One is the .NET 6 I recently installed.
The other is Google Chrome, if I'm not mistaken.

And check where it is, you need to ensure your fpc.cfg looks there.  Its just possible that Ubunu has moved their 32bit libraries. If they can put Firefox in a snap, they might do anything ! 

I did have to install something and change my fpc.cfg due to the error for the crt not being found when linking.
Somehow that went away for a while and now it's this new missing thing...

I always have to manually edit fpc.cfg when setting up for 32bit cross compile, details on the wiki.

Thanks, Davo, for the tips, I'll go through them one by one, plus the ones from Thaddy and see what I can fix.

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

 

TinyPortal © 2005-2018