PINE64
crosscompiling chain? - 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: crosscompiling chain? (/showthread.php?tid=12763)



crosscompiling chain? - treebuilder - 01-11-2021

All -
  Ordered a new pinephone the other day, and while I wait for it to be delivered, I have been looking around to determine what toolchain I need to get cross-compilation of apps going.

Could someone point me towards some documentation or helpful info on the topic?  Not looking for a handout, just a hand.  It's been a good long while since I've done any serious dev work via crosscompiling (I think the last time I touched a crosscompiler was when I was building stuff for a Compaq iPaq running Linux), and I just want to make sure I've got the right tools in place.


RE: crosscompiling chain? - ryo - 01-15-2021

To answer it as simple as possible: there's no such a thing as a cross compiler for a Pinephone, you compile directly on the phone itself.

Install and enable SSH, download TAR packages, ./configure, make, sudo make install.
Or if you develop Linux apps, simply use whatever you've been using on PC Linux in the exact same way (gcc for ANSI C, g++ for C++ etc).

In case it sounds confusing, maybe this statement clears it up:
Android and iOS are consumer toys that require a PC in order develop and run your own apps on, and there's a huge walled garden for all other apps.
Pinephone and Librem 5 are technically full laptops in a phone form factor, so app development for those should be treated like app development for desktop and/or server.


RE: crosscompiling chain? - treebuilder - 01-15-2021

(01-15-2021, 08:30 AM)ryo Wrote: To answer it as simple as possible: there's no such a thing as a cross compiler for a Pinephone, you compile directly on the phone itself.

Install and enable SSH, download TAR packages, ./configure, make, sudo make install.
Or if you develop Linux apps, simply use whatever you've been using on PC Linux in the exact same way (gcc for ANSI C, g++ for C++ etc).

In case it sounds confusing, maybe this statement clears it up:
Android and iOS are consumer toys that require a PC in order develop and run your own apps on, and there's a huge walled garden for all other apps.
Pinephone and Librem 5 are technically full laptops in a phone form factor, so app development for those should be treated like app development for desktop and/or server.


While I understand and agree that's it's technically possible to compile directly on the phone, from a horsepower, time, storage space, and heat perspective, I would imagine that's neither the preferred nor recommended way of approaching things.

Are you suggesting that developers are not building to one of the the aarch64-* targets in GCC on a normal desktop, with the requisite libraries installed?

While, again, I admit that building directly on the phone is technically within the realm of possibility, I find that rather unlikely.


RE: crosscompiling chain? - ryo - 01-15-2021

(01-15-2021, 09:47 AM)treebuilder Wrote: While I understand and agree that's it's technically possible to compile directly on the phone, from a horsepower, time, storage space, and heat perspective, I would imagine that's neither the preferred nor recommended way of approaching things.
Like I said, this only makes sense for consumer toys, not for PCs.

(01-15-2021, 09:47 AM)treebuilder Wrote: Are you suggesting that developers are not building to one of the the aarch64-* targets in GCC on a normal desktop, with the requisite libraries installed?
yup.
You can however compile on your own PC and test on it.
Then compile on your phone as is.
You can't just compile x86 or x64 apps, and expect them to work on an ARM64 processor.
Same for the other way around.

(01-15-2021, 09:47 AM)treebuilder Wrote: While, again, I admit that building directly on the phone is technically within the realm of possibility, I find that rather unlikely.
Spoiler arert: I have a Pinephone, and I develop software.


RE: crosscompiling chain? - kqlnut - 01-15-2021

(01-15-2021, 08:30 AM)ryo Wrote: To answer it as simple as possible: there's no such a thing as a cross compiler for a Pinephone, you compile directly on the phone itself.
While I'm not a developer myself, I believe it's quite a common use case to cross-compile for an aarch64 host on x86_64 machines. There is even a page on the Pine64 wiki about it.


RE: crosscompiling chain? - treebuilder - 01-15-2021

(01-15-2021, 10:17 AM)ryo Wrote:
(01-15-2021, 09:47 AM)treebuilder Wrote: Are you suggesting that developers are not building to one of the the aarch64-* targets in GCC on a normal desktop, with the requisite libraries installed?
yup.
You can however compile on your own PC and test on it.
Then compile on your phone as is.
You can't just compile x86 or x64 apps, and expect them to work on an ARM64 processor.
Same for the other way around.


(01-15-2021, 09:47 AM)treebuilder Wrote: While, again, I admit that building directly on the phone is technically within the realm of possibility, I find that rather unlikely.
Spoiler arert: I have a Pinephone, and I develop software.

Perhaps you misunderstood me or I wasn't being clear:  While I do not yet have a pinephone, I also develop software, or have in the past.  I have even developed for previous mobile platforms (see my original post).

I was not asking about compiling x86 or x64 apps directly.  I was asking about the appropriate crosscompiler toolchain and library sets for compiling apps that would run on the pinephone natively.  I thought I had made that clear, as that's the typical case with developers asking about crosscompiling.

Spoiler alert: I've been doing this for 30+ years.  I was just asking the community for some info, since the info on the ground is otherwise sparse.

Glad to see the OSS community hasn't deviated one iota from its stubborn, ascerbic self.  Stay classy.  Oh, and thanks for reminding me why I stopped contributing to projects.

(01-15-2021, 12:29 PM)kqlnut Wrote:
(01-15-2021, 08:30 AM)ryo Wrote: To answer it as simple as possible: there's no such a thing as a cross compiler for a Pinephone, you compile directly on the phone itself.
While I'm not a developer myself, I believe it's quite a common use case to cross-compile for an aarch64 host on x86_64 machines. There is even a page on the Pine64 wiki about it.


Thank you, kqlnut.  That information was exactly what I was looking for.  I have no idea why I couldn't find it on the wiki.

I'm grateful that there are a few people willing to answer a simple question with a simple answer, rather than bloviating.


RE: crosscompiling chain? - wibble - 01-19-2021

The readme for the gentoo pinephone overlay includes links on setting up the crossdev environment for that too.
https://gitlab.com/bingch/gentoo-overlay/-/blob/master/README.md

For PostmarketOS the pmbootstrap tool sets up the necessary environment. I've not looked at the internals.
https://wiki.postmarketos.org/wiki/Main_Page


RE: crosscompiling chain? - bitnick - 01-20-2021

Purism has info on setting up a development environment running Phosh under QEMU. That might be helpful.