Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
aarch64 crosscompile raspberrypi-sources missing keyword
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
erg_samowzbudnik
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2011
Posts: 124
Location: uk/sticks

PostPosted: Tue Jan 21, 2020 7:05 pm    Post subject: aarch64 crosscompile raspberrypi-sources missing keyword Reply with quote

I'm crosscompiling for RPi 3B+ aarch64, have ACCEPT_KEYWORDS="arm64 ~arm64" in make.conf and yet
Quote:
aarch64-unknown-linux-gnu-emerge -a raspberrypi-sources
gives me this error:

Quote:
!!! All ebuilds that could satisfy "raspberrypi-sources" for /usr/aarch64-unknown-linux-gnu/ have been masked.
!!! One of the following masked packages is required to complete your request:
- sys-kernel/raspberrypi-sources-5.4.9999::gentoo (masked by: missing keyword)
- sys-kernel/raspberrypi-sources-4.19.9999::gentoo (masked by: missing keyword)


What am I doing wrong?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47055
Location: 56N 3W

PostPosted: Tue Jan 21, 2020 9:35 pm    Post subject: Reply with quote

erg_samowzbudnik,

You are not doing anything wrong. Ebuilds with 9999 in the version numbers pull from the live commit by commit upstream repository.
As they are live, at any moment, the codebase may not compile. If it compiles, it may not work. It might even try to drink all the beer in your fridge :)

The live ebuilds are therefore not keyworded so that they are not used by portage accidentally.

You need to use your /etc/portage/package.accept_keywords file/directory to tell portage you really want to use a live ebuild.
See all of AMD64/Portage/Files and in particular, AMD64/Portage/Branches. Portage is arch agnostic, so the amd64 handbook is common to all.

One thing those references don't tell you that you will need the special keyword **
That matches any keyword, including none at all.

Poke about in etc_portage_arm64 for some worked examples that I use on arm64 on Pi3 and Pi 4
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
erg_samowzbudnik
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2011
Posts: 124
Location: uk/sticks

PostPosted: Wed Jan 22, 2020 1:16 pm    Post subject: Reply with quote

NeddySeagoon,

Quote:
As they are live, at any moment, the codebase may not compile. If it compiles, it may not work. It might even try to drink all the beer in your fridge :)


That would be ok, I'm more of a wine person :-)

Thanks for that tip, got the new raspberrypi-sources.

I am somewhat hesitant to just copy/paste your configs - there's a ton of them! Surely I do not need all of them

Also I'm rather confused as to how to work with that crosscompiler. How do I read the news? How do I run etc-update? Should I manually copy/paste content of ._cfg0000_package.use to package use?

Do I need the same (barring extra option) make.conf on the Pi and in the crosscompiler environment? I did copy what I could, also followed (apart for a few USE flags - want to run this Pi as a headless server) your make.conf

Thank you for your patience
Back to top
View user's profile Send private message
erg_samowzbudnik
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2011
Posts: 124
Location: uk/sticks

PostPosted: Wed Jan 22, 2020 1:33 pm    Post subject: Reply with quote

copied ._cfg0000_package.use by hand,

running:
Quote:
aarch64-unknown-linux-gnu-emerge -DuNa system


getting this error with the first package (sys-libs/zlib-1.2.11-r2):

Quote:
Checking for aarch64-unknown-linux-gnu-gcc...
Compiler error reporting is too harsh for /usr/aarch64-unknown-linux-gnu/tmp/portage/sys-libs/zlib-1.2.11-r2/work/zlib-1.2.11/configure (perhaps remove -Werror).
** /usr/aarch64-unknown-linux-gnu/tmp/portage/sys-libs/zlib-1.2.11-r2/work/zlib-1.2.11/configure aborting.


How would I do that?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47055
Location: 56N 3W

PostPosted: Wed Jan 22, 2020 11:58 pm    Post subject: Reply with quote

erg_samowzbudnik,

-Werror makes gcc treat all warnings as errors. Thats OK for developers trying to polish their code but it should never be used be used in released code.

You need to append -Wno-error. How you do that (if you can do that), is build system specific.
Try adding it to the command line as a test.

Code:
CFLAGS="${CFLAGS} -Wno-error" CXXFLAGS="${CXXFLAGS} -Wno-error" aarch64-unknown-linux-gnu-emerge -1 sys-libs/zlib

If that works, make a file in /etc/portage/env and call at as required on a per package basis.

You should keep everything in /etc/portage common acroos the Pi and its build host except make.conf.
make.conf differs as one is for native compiling and one if for cross compiling.
You should use than same repos on both too.
I've messed up. As a result, my Pi is building Thunderbird :(

You do not need to copy my setup. There is a lot of junk in there.
I build test packages for arm64. They are often subsequently keyworded and the junk gets left behind.
My /etc/portage/* is useful as a source of examples is all.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
erg_samowzbudnik
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2011
Posts: 124
Location: uk/sticks

PostPosted: Thu Jan 23, 2020 10:52 am    Post subject: Reply with quote

:oops:

I gotta slow down. That was a typo in CFFLAGS, missing '-' as I added -flto flag. I see your flags vary from safe flags from here https://wiki.gentoo.org/wiki/Safe_CFLAGS#ARMv8-A.2FBCM2837

Now I'm stuck with the error for dev-lang/python-2.7.17-r1:

Quote:
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _sqlite3 _tkinter
bsddb185 dl imageop
linuxaudiodev nis ossaudiodev
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

running build_scripts
creating build/scripts-2.7
copying and adjusting /usr/aarch64-unknown-linux-gnu/tmp/portage/dev-lang/python-2.7.17-r1/work/Python-2.7.17/Tools/scripts/pydoc -> build/scripts-2.7
copying and adjusting /usr/aarch64-unknown-linux-gnu/tmp/portage/dev-lang/python-2.7.17-r1/work/Python-2.7.17/Tools/scripts/idle -> build/scripts-2.7
copying and adjusting /usr/aarch64-unknown-linux-gnu/tmp/portage/dev-lang/python-2.7.17-r1/work/Python-2.7.17/Tools/scripts/2to3 -> build/scripts-2.7
copying and adjusting /usr/aarch64-unknown-linux-gnu/tmp/portage/dev-lang/python-2.7.17-r1/work/Python-2.7.17/Lib/smtpd.py -> build/scripts-2.7
changing mode of build/scripts-2.7/pydoc from 644 to 755
changing mode of build/scripts-2.7/idle from 644 to 755
changing mode of build/scripts-2.7/2to3 from 644 to 755
changing mode of build/scripts-2.7/smtpd.py from 644 to 755
python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/sys/types.h /usr/include/netinet/in.h /usr/include/dlfcn.h /usr/include/linux/cdrom.h
./regen: line 8: /usr/aarch64-unknown-linux-gnu/tmp/portage/dev-lang/python-2.7.17-r1/work/Python-2.7.17/python: cannot execute binary file: Exec format error
make: *** [Makefile:550: platformspecificmods] Error 1


I suppose I may have buggered my make.conf
Quote:
1 CHOST=aarch64-unknown-linux-gnu
CBUILD=x86_64-pc-linux-gnu
ARCH=arm64

HOSTCC=x86_64-pc-linux-gnu-gcc

COMMON_FLAGS="-O2 -pipe"
#CFLAGS="-march=armv8-a+crc -mtune=cortex-a53 -ftree-vectorize -O2 -pipe -fomit-frame-pointer -flto"
#CFLAGS="-O2 -pipe -fomit-frame-pointer"
CFLAGS="-O2 -pipe"
#CPU_FLAGS_ARM="edsp neon thumb vfp vfpv3 vfpv4 vfp-d32 crc32 v4 v5 v6 v7 v8 thumb2"

CXXFLAGS="${CFLAGS}"
USE="-bindist egl gles1 gles2"
VIDEO_CARDS="fbdev vc4"
INPUT_DEVICES="evdev synaptics"
PYTHON_TARGETS="python2_7 python3_6"

ACCEPT_KEYWORDS="arm64 ~arm64"
LICENCE="-* @EULA"

MAKEOPTS="-j9 -l8"

ROOT=/usr/${CHOST}/

ACCEPT_KEYWORDS="arm64 ~arm64"


FEATURES="-collision-protect sandbox buildpkg noman noinfo nodoc"
#LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--fix-cortex-a53-843419 -Wl,--fix-cortex-a53-835769 -Wl,--no-map-whole-files"

# Be sure we dont overwrite pkgs from another repo..
PKGDIR=${ROOT}packages/
PORTAGE_TMPDIR=${ROOT}tmp/

ELIBC="glibc"

PKG_CONFIG_PATH="${ROOT}usr/lib/pkgconfig/"
#PORTDIR_OVERLAY="/usr/portage/local/"
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47055
Location: 56N 3W

PostPosted: Thu Jan 23, 2020 8:55 pm    Post subject: Reply with quote

erg_samowzbudnik,

Code:
cannot execute binary file: Exec format
means that your build system tried to execute some arm64 code.
What does
Code:
file /usr/aarch64-unknown-linux-gnu/tmp/portage/dev-lang/python-2.7.17-r1/work/Python-2.7.17/python
tell?

Don't use -flto. Its not safe. Several things will not build with it.
A few things build then cause other packages to fail.
I have -flto in make.conf and selectively turned off in package.env

Your CFLAGS do not have a CPU set, so your code will run on any armv8a CPU.
That's suboptimal for them all too.

Do not set
Code:
PYTHON_TARGETS=
yourself unless your really need to. Its set in the profile.
Its mostly harmless but you will get into a 'fankle' (that's a good Scottish word) with time when one of your PYTHON_TARGETS is removed from the repo.

The LDFLAG -Wl,--no-map-whole-files is a space saver during linking.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
erg_samowzbudnik
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2011
Posts: 124
Location: uk/sticks

PostPosted: Fri Jan 24, 2020 10:07 am    Post subject: Reply with quote

Thanks, fankle sounds like a good description of what I got myself into.

Corrected my make.conf, took out -flto, fixed CFLAGS, added LDFLAGS from your make.conf

Quote:
file /usr/aarch64-unknown-linux-gnu/tmp/portage/dev-lang/python-2.7.17-r1/work/Python-2.7.17/python
/usr/aarch64-unknown-linux-gnu/tmp/portage/dev-lang/python-2.7.17-r1/work/Python-2.7.17/python: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, not stripped


Just to make things more interesting I'm migrating to a new 17.1 profile on my amd64 host at the moment, racing with time to get that done as I'm going away this weekend and would like to be able to power off my laptop without risking heart attack. Will be back hacking at in on Monday. Thanks for holding my hand :?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47055
Location: 56N 3W

PostPosted: Fri Jan 24, 2020 7:09 pm    Post subject: Reply with quote

erg_samowzbudnik,

Code:
ELF 64-bit LSB pie executable, ARM aarch64 ...
That's the build system cross compiling some code for the target, then trying to run it on the build host.
File a bug if you want but supporting cross compiling is an upstream issue. Some version of python work, some don't.

The easiest fix is to build that package on the target.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 16472

PostPosted: Sat Jan 25, 2020 1:57 am    Post subject: Reply with quote

erg_samowzbudnik wrote:
racing with time to get that done as I'm going away this weekend and would like to be able to power off my laptop without risking heart attack.
If you have working hibernate support on the laptop, you could put it into hibernation before you leave, and wake it when you return. That would avoid going through any of the normal boot process, so there is a decent chance it would work even if you are in the middle of an upgrade that has temporarily made your system unable to boot.
Back to top
View user's profile Send private message
erg_samowzbudnik
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2011
Posts: 124
Location: uk/sticks

PostPosted: Mon Jan 27, 2020 4:00 pm    Post subject: Reply with quote

Hu,

thanks for a tip, battery dead on this one though. Migration went without issue - and no power cut over the weekend. Lucky I guess.

NeddySeagoon,

I've tried emerge with --skip-first and --keepgoing but those fails too with this error:
Quote:
One or more packages are either masked or have missing dependencies:
*
* >=app-admin/perl-cleaner-2.5 pulled in by:
* (dev-lang/perl-5.30.1:0/5.30::gentoo, installed in '/usr/aarch64-unknown-linux-gnu/')


I've added '>=app-admin/perl-cleaner-2.5' to package.accepted_keywords and package.unmask but to no avail.

Could I build python-2.7 on the Pi and add it to packages/ on the host to sort out that mess?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47055
Location: 56N 3W

PostPosted: Mon Jan 27, 2020 6:16 pm    Post subject: Reply with quote

erg_samowzbudnik,

Yes, you can build python on the Pi. You could cheat too and use my BINHOST.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
erg_samowzbudnik
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2011
Posts: 124
Location: uk/sticks

PostPosted: Mon Jan 27, 2020 7:11 pm    Post subject: Reply with quote

NeddySeagoon,

well it builds ok on the Pi, system there it's actually all up to date, I was just wondering how to proceed with building the rest of stuff in cross compiler (for future reference) so that it does not complain about that python-2.7 package. Would it stop whinging about it if I built binary package on the Pi with 'emerge --buildpkg package' and copied it over to packages/ in cross compiler? It's a bit arse-backwards solution but if it satisfies the cross compiler it'd make me happy.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47055
Location: 56N 3W

PostPosted: Mon Jan 27, 2020 7:38 pm    Post subject: Reply with quote

erg_samowzbudnik,

Thats correct so far, then install it with the -K option.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
erg_samowzbudnik
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2011
Posts: 124
Location: uk/sticks

PostPosted: Mon Jan 27, 2020 8:13 pm    Post subject: Reply with quote

NeddySeagoon,

awesome, I'm trying it. Thanks.
Back to top
View user's profile Send private message
erg_samowzbudnik
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2011
Posts: 124
Location: uk/sticks

PostPosted: Mon Jan 27, 2020 10:25 pm    Post subject: Reply with quote

compiled a binary of python-2.7, installed in crosscompiler nicely, now trying to compile the rest of the world set and get this errors with the first package, dev-python/pyblake2-1.1.2:

Quote:
/usr/aarch64-unknown-linux-gnu/tmp/portage/dev-python/pyblake2-1.1.2/work/pyblake2-1.1.2-python2_7/lib/pyblake2.so
/usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: skipping incompatible /usr/lib64/libpython2.7.so when searching for -lpython2.7
/usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: skipping incompatible /usr/lib64/libpython2.7.a when searching for -lpython2.7
/usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: skipping incompatible /usr/lib64/libc.so when searching for -lc
/usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /usr/lib64/libc.a(init-first.o): unable to initialize decompress status for section .debug_info
/usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /usr/lib64/libc.a(memmove.o): unable to initialize decompress status for section .debug_info
/usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /usr/lib64/libc.a: error adding symbols: file format not recognized
collect2: error: ld returned 1 exit status
error: command 'aarch64-unknown-linux-gnu-gcc' failed with exit status 1
* ERROR: dev-python/pyblake2-1.1.2::gentoo failed (compile phase):
* (no error message)


What a kerfuffle ...
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 16472

PostPosted: Tue Jan 28, 2020 2:50 am    Post subject: Reply with quote

erg_samowzbudnik wrote:
Hu,

thanks for a tip, battery dead on this one though.
That shouldn't matter. By definition, hibernation is saving the system state to disk, then halting the system. On next boot, the system state is reloaded from disk. A system that hibernates properly can be unplugged, cut off from battery backup, and still restored once you regain access to a stable power source. Perhaps you were thinking of S3 sleep, which keeps RAM powered for a faster restore, and does require that the system remain powered for the duration (whether through main power or a battery).
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47055
Location: 56N 3W

PostPosted: Tue Jan 28, 2020 12:00 pm    Post subject: Reply with quote

erg_samowzbudnik,

Code:
/usr/lib64/libpython2.7.so
That will be build hosts libpython2.7.so. It needs to be the targets libpython2.7.so.

Thats a
Parker Bros. wrote:

Go to Jail
Go Directly to Jail
Do Not Pass Go
Do Not Collect 200 <local currency units>

sort of error.

Do you have any .la files?
They are mostly but not always linker archives. The last line of which is a full path name to the hosts libraries.
Gentoo has not installed them for years. Its worth a check as they break cross compiling just like this.

Don't delete them, move them to a sub dir out of the way, so that they are not found.
Like I say, they are not all linker archives. A few programs need them to load plugins too, so you may find that you need to restore a few of them.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
erg_samowzbudnik
Tux's lil' helper
Tux's lil' helper


Joined: 09 Sep 2011
Posts: 124
Location: uk/sticks

PostPosted: Tue Jan 28, 2020 1:09 pm    Post subject: Reply with quote

Hu,

that's right, I was confused. Haven't tried hibernation, I may want to test it.

NeddySeagoon,

I do have a bunch of .la files in /usr/lib64, nothing I would have thought to be related though:

Quote:
libaircrack-crypto.la libattr.la libhavege.la libminizip.la liborcon2.la liburcu.la
libaircrack-crypto-x86-avx2.la libdb-5.3.la libltdl.la libmng.la librdf.la liburcu-mb.la
libaircrack-crypto-x86-avx.la libdb_cxx-5.3.la libMagick++-7.Q16.la libmovit.la liburcu-bp.la liburcu-qsbr.la
libaircrack-crypto-x86-sse2.la libdb_sql-5.3.la libMagickCore-7.Q16.la libnatspec.la liburcu-cds.la liburcu-signal.la
libaircrack-osdep.la libdb_stl-5.3.la libMagickWand-7.Q16.la libnpth.la liburcu-common.la


moved them to a sub directory but error persists

Should I ask about that on Portage and Programming? Would it be more appropriate place to ask about it?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum