PINE64
Cross-compiling Rust for Pinephone - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PinePhone (https://forum.pine64.org/forumdisplay.php?fid=120)
+--- Forum: General Discussion on PinePhone (https://forum.pine64.org/forumdisplay.php?fid=127)
+--- Thread: Cross-compiling Rust for Pinephone (/showthread.php?tid=10668)



Cross-compiling Rust for Pinephone - ElusivePine - 07-14-2020

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`.



RE: Cross-compiling Rust for Pinephone - ElusivePine - 07-14-2020

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?


RE: Cross-compiling Rust for Pinephone - someGermanGuy - 07-15-2020

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


RE: Cross-compiling Rust for Pinephone - ElusivePine - 07-15-2020

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


RE: Cross-compiling Rust for Pinephone - ElusivePine - 07-16-2020

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


RE: Cross-compiling Rust for Pinephone - antoyo - 11-27-2020

(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!