Cross-compiling Rust for Pinephone
#1
Hello,
has anybody successfully cross-compiled a gtk application for the Pinephone? I was able to cross-compile a basic hello-world example but compiling the examples from the Relm crate gave me a bunch of errors. This my first time cross-compiling so I feel like I might be missing something obvious. I am running Arch Linux on my host and the errors I am getting are:

Code:
= note: /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgtk-3
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgdk-3
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lz
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lpangocairo-1.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lpango-1.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lharfbuzz
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -latk-1.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lcairo-gobject
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lcairo
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgdk_pixbuf-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgio-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgobject-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lglib-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -latk-1.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgobject-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lglib-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgdk-3
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lz
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lpangocairo-1.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lpango-1.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lharfbuzz
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgdk_pixbuf-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lcairo-gobject
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lcairo
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgobject-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lglib-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lpango-1.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgobject-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lglib-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lharfbuzz
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgdk_pixbuf-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgobject-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lglib-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgio-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgobject-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lglib-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgobject-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lglib-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lcairo-gobject
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lcairo
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lgobject-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lglib-2.0
          /usr/lib/gcc/aarch64-linux-gnu/10.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lglib-2.0
         
          collect2: error: ld returned 1 exit status
          error: aborting due to previous error
          error: could not compile `relm-examples`.
#2
How do I get the necessary libraries to successfully compile the application? I could not find them in the Arch repository or in the AUR. Does that mean I have to cross-compile them from source and move them to the expected folder? If so, what would be the starting point to do so?
#3
on debian/ubuntu, those are usually marked with the suffix -dev, like gtk-dev
on fedora/centos/rhel etc. they are usually marked as -devel
unfortunately, no idea how this works on arch linux
but you could use pkgfile to see what packaga provides those

edit: https://www.archlinux.org/packages/extra/x86_64/gtk3/
they contain the devel files, so those files should be installed when installing e.g. cairo, atk, pango etc.

you could check how those packages are built by archlinux (i am sure they have some CI/CD system) or maybe ask in #archlinux
#4
Thank you for your suggestions, they gave me a few ideas.
In the Arch repository you can see the architecture a package is meant for. On most of them it says its for x86_64[/url] but some say amy. For the gtk3 package it also says its for x86_64[url=https://www.archlinux.org/packages/?arch=x86_64]. I thought this might be my mistake and the solution could be to find the same libraries but for aarch64 so I had a look at Arch Linux on ARMs packages. The missing packages are listed there. I am going to download those files and try it again. No clue if this is how it works but I guess we'll see..
Smile
#5
I successfully cross-compiled the examples  Smile

The way I did it was less than optimal though I think. I read through the errors listed when trying to compile them and searched for those libraries on https://archlinuxarm.org/packages. All the packages I needed were available there so I downloaded each package and extracted them. Some had the extension .tar-1 or something similar after unpacking. I renamed them to .tar and unpacked them again. They all had a folder called usr. I copied the folder /usr/aarch64-linux-gnu to make sure I can revert the changes in case I break something and then copied the content of the usr folder of all the downloaded packages into the folder /usr/aarch64-linux-gnu. Then I tried compiling again. Now different libraries were missing (the dependencies of the newly added libraries) and I repeated the whole process for those missing libraries until none were missing and I successfully compiled the examples.

Its not a very elegant solution and involved a lot of copy and pasting so now I will look into how to add the necessary packages to the AUR so others can get those libraries easier
#6
(Relm's author here.)

I just got my PinePhone and wanted to play with that as well Wink .

I wrote a draft tutorial explaining the steps I found to fix this issue.
Use at your own risk, though, because that might mess up with your installed pacman files if I forgot something.

Good luck and have fun!


Possibly Related Threads…
Thread Author Replies Views Last Post
  PinePhone - boot from microSD laserpyramid 5 298 03-06-2024, 06:37 PM
Last Post: aular
  Are you using the Pinephone as your daily driver? jro 157 105,065 02-18-2024, 11:33 PM
Last Post: aular
  2020 PinePhone Manjaro CE EU for sale, name your price astrojuanlu 7 1,520 02-14-2024, 04:51 PM
Last Post: astrojuanlu
  pinephone is not bootble for the box. ijij 1 458 01-19-2024, 01:29 PM
Last Post: fxc
  Multiple issues with the Pinephone MTXP 12 1,936 12-28-2023, 07:55 AM
Last Post: MTXP
  pinephone repair shop shengchieh 0 380 12-26-2023, 02:42 PM
Last Post: shengchieh
  sudo nano file saving pinephone beta edition CharlesGnarley 4 1,476 12-22-2023, 03:44 PM
Last Post: Kevin Kofler
  Can't get Mobian on PinePhone to recognise USB-C docking bar duncan_bayne 9 6,597 12-04-2023, 02:14 AM
Last Post: Peter Gamma
  Pinephone not booting, always vibrating alexander12 7 4,663 11-22-2023, 06:46 PM
Last Post: Scary Guy
  Pinephone on Verizon chachi 3 991 10-09-2023, 11:26 AM
Last Post: alaraajavamma

Forum Jump:


Users browsing this thread: 2 Guest(s)