You are not logged in.

#1 2018-02-12 22:43:55

speedyb0y
Member
From: Brazil
Registered: 2018-02-12
Posts: 5

Cross-compile & makepkg

Hello for all!

I'm trying to build an entire system compiled with -march=skylake (for running on cloud machines).

Well... this is basically cross-compilation, because I only have AMD CPUs at home and while building packages, the build system try to execute some code and just segfaults because of some illegal instruction.

Does anyone here knows the specific steps I should make to cross-compile a package (with the difference that I don't need a specific toolchain for that, as I'm in the same arch and using the system's compiler)?

I'm already hacking the PKGBUILDs, changing some options on some packages,  even changing some sources to customize the whole system... But I'm just a newbie and even today I still doesn't understand how cross compilation works. I tried changing environment variables, modifying the PKGBUILD to use --host=, --target=... but the problem is still the same, the build system try to execute some code and just coredumps.

But before you all try to strangulate me because of the title: it's not ARM, not MIPS...  it's x86_64 to x86_64 tongue !

Offline

#2 2018-02-12 23:21:04

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,385
Website

Re: Cross-compile & makepkg

speedyb0y wrote:

Does anyone here knows the specific steps I should make to cross-compile a package (with the difference that I don't need a specific toolchain for that, as I'm in the same arch and using the system's compiler)?

You need a cross-compiler.    Some packages might build if you don't run the check() functions and get lucky...

Offline

#3 2018-02-12 23:36:25

speedyb0y
Member
From: Brazil
Registered: 2018-02-12
Posts: 5

Re: Cross-compile & makepkg

Allan wrote:
speedyb0y wrote:

Does anyone here knows the specific steps I should make to cross-compile a package (with the difference that I don't need a specific toolchain for that, as I'm in the same arch and using the system's compiler)?

You need a cross-compiler.    Some packages might build if you don't run the check() functions and get lucky...

What do you mean by a cross-compiler?
Because it's the same arch, only compiled optimized (-march) for another CPU.

And note also:
I'm doing this after pacman -Syu and all the PKGBUILD's match the version of my computer.
I'm also not doing anything that could generate mismatching headers - like selecting a newer kernel version headers for glibc, or choosing different options on some libraries.

So, in the end, I'm compiling packages as if I was compiling for my *current* (local/home) system.

The only difference is that the final binary of each package is compiled with some instructions for another CPU.

----

What's the "magic" for making a standard "./configure && make" package to compile it for a differente arch and DON'T TRY TO EXECUTE THAT CODE? sad

Offline

#4 2018-02-13 00:02:51

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,385
Website

Re: Cross-compile & makepkg

It depends on the software...

Anything with a test suite will try and run the code.  Anything that has some sort of bootstrap, will try and run the code.

I guess if you built some packages with the optimization flags and added --nocheck to makepkg, that will work.   Others will not.

I really can't tell with the lack of information you have given about the error and how you got it.

Offline

#5 2018-02-16 10:17:18

severach
Member
Registered: 2015-05-23
Posts: 192

Re: Cross-compile & makepkg

A Skylake Pentium looks easy to get. Everything works and no more cross compiler.

Gentoo is designed from the ground up to do this sort of thing. While it can be done in Arch you're rowing uphill.

99 & 44/100% of all packages will not benefit from a recompile to a newer architecture. Recompiling only the few packages that will benefit will make this much easier.

Offline

Board footer

Powered by FluxBB