Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to crosscompile armhf from aarch64 linux? #572

Closed
afuriza opened this issue Apr 20, 2023 · 10 comments
Closed

How to crosscompile armhf from aarch64 linux? #572

afuriza opened this issue Apr 20, 2023 · 10 comments

Comments

@afuriza
Copy link

afuriza commented Apr 20, 2023

I've tried to install cross compiler from aarch64 but have no success because there's no crossbins provided by default on FPCUpDeluxe Github...
image

So, I install all binutils, cross-build tools, including gtk2.0 and gtk3.0 dev for armhf libraries, I successfully run fpcupdeluxe-arm-linux 32bit arm but still can't compile the FPC with error: unrecognized option -meabi=5
image

Maybe someone can give an advice to build FPC & Laz for arm from aarch64?
Thanks~

@LongDirtyAnimAlf
Copy link
Owner

I have added binutils for armhf.
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/linuxaarch64crossbins_v1.0/CrossBinsLinuxARM.zip
Please test.

@afuriza
Copy link
Author

afuriza commented Apr 20, 2023

Thank you for the good work! Now I can compile the cross compiler for the armhf.
image
GTK2 seems normal and I can run the app after installing sudo apt install libgtk2.0-dev:armhf
image

But I have a problem with lgtk-3, I've installed that by sudo apt install libgtk-3-dev:armhf like I installed gtk2 but still not working.
image

@LongDirtyAnimAlf
Copy link
Owner

LongDirtyAnimAlf commented Apr 22, 2023

You are on a aarch64 system. To compile to an arm system, you needs appropriate libs. Fpcupdeluxe has auto -downloaded and -installed a set of libs for an arm system. These libs, however, do not include libs for gtk3. So, you need to copy the appropriate libs from your arm system to the cross-libs directory on your aarch64 system, so the linker on your aarch64 system can find them and use them while linking.

@afuriza
Copy link
Author

afuriza commented Apr 23, 2023

I archive my copied file I put to <fpcup target dir>\cross\lib\aarch64-linux here: Google Drive Link

I also tried to cross-compile that from Windows, seems only GTK3 that doesn't work for cross-compile to ARM or AArch64, I'm using Ubuntu 22.04 ARM. But when compiling directly with GTK3 from AArch64 to AArch64 is no problem.

I also do the same with X86_64 cross-compiling from Windows X86_64 to Linux X86_64, GTK3 works fine.

I think something doesn't looks right in ARM and GTK3 when cross compiling.

GTK3 crosscompile
Windows X86_64 to Linux X86_64: OK
Windows X86_64 to Linux AArch64: Fails
Windows X86_64 to Linux ARM: Fails
Linux AArch64 to AArch64: OK
Linux AArch64 to ARM: Fails

Last Edit:
Seems this is Ubuntu ARM problem (I'm not sure actually, is this FPC bug or Ubuntu bug), the CEF4Delphi seems also have this issue on Ubuntu ARM when trying to load libcef.so.
salvadordf/CEF4Delphi#457

@LongDirtyAnimAlf
Copy link
Owner

Please note.
This is no longer a fpcupdeluxe issue.
The error when linking will show you exactly which libraries you need. Please use the correct filename for these libraries.

@afuriza
Copy link
Author

afuriza commented Apr 23, 2023

Please use the correct filename for these

No, they're all correct names. I can replicate the same method for Linux X86_64 easily by copying these libs based from the error message and they'll work fine. Except, it doesn't work in ARM.

But, I agree this is seems not an FPCUpDeluxe issue. Should I close this issue?

@rcla
Copy link
Contributor

rcla commented Apr 23, 2023

@afuriza
Reading the lazarus README, one finds:
Welcome Lazarus

The LCL currently supports:

  • Linux/FreeBSD (GTK2, Qt4, Qt5 and Qt6)
  • all flavors of Windows (even WinCE)
  • macOS (Cocoa, Carbon, GTK2, Qt4, Qt5, Qt6)

There is an experimental support for:

  • GTK3
  • Solaris

And in GTK3 Interface: Currently it's in alpha status

That may be the reason why gtk3 libraries are not included in the cross-compile. However, as @LongDirtyAnimAlf said, you can manually include the ones you need from your OS. But it's a tedious job, going through each library and their respective dependencies.

Last Edit: Seems this is Ubuntu ARM problem (I'm not sure actually, is this FPC bug or Ubuntu bug), the CEF4Delphi seems also have this issue on Ubuntu ARM when trying to load libcef.so.

This has nothing to do with that other issue.

@afuriza
Copy link
Author

afuriza commented Apr 23, 2023

However, as @LongDirtyAnimAlf said, you can manually include the ones you need from your OS.

As I said, do you read that properly? I already done that copying each file. Do you even open the link I provided? That's all file required, same count, same library name. It work on X86_64 but not on ARM and AArch64. Alpha status doesn't matter because it works on direct compile but not cross compile on ARM EVEN THOUGH I COPIED THE FILES LIKE I DO IN X86_64.

Read this:

GTK3 crosscompile
Windows X86_64 to Linux X86_64: OK
Windows X86_64 to Linux AArch64: Fails
Windows X86_64 to Linux ARM: Fails
Linux AArch64 to AArch64: OK
Linux AArch64 to ARM: Fails

See this Windows X86_64 to Linux X86_64: OK, that's I am talking about. They're not included in FPCUpDeluxe but I copied all library, that works! But! Windows X86_64 to Linux AArch64: Fails. See the different? What bothering me is both AArch64/ARM Linux and X86_64 Linux same there's no provided GTK3 library and dependency. Copy that? The problem is I copied GTK3 dependency libraries from X86_64 Linux to my X86_64 Windows work but when I copied GTK3 dependency libraries from AAarch64 Linux to X86_64 Windows not work. That's why I provided the files in that link to you to inspect, because there's nothing missing. libgtk, libgdk, pango, etc. All there!

@rcla
Copy link
Contributor

rcla commented Apr 24, 2023

Respectfully, it does matter that the LCL gtk3 widget type is experimental and in alpha stage, since that it means that there are still a lot of things that don't work, regardless of the type of x86 architecture. arm or arm64.

And it has nothing to do with fpcupdeluxe.

@afuriza
Copy link
Author

afuriza commented Apr 24, 2023

@rcla You seem don't read and won't read, no matter how long I typed, I'll close this.

@afuriza afuriza closed this as completed Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants