Bug 1642037 - kernel-cross-headers are in a wrong location
Summary: kernel-cross-headers are in a wrong location
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel-headers
Version: 31
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Justin M. Forbes
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: ARMTracker 1642079
TreeView+ depends on / blocked
Reported: 2018-10-23 12:48 UTC by Nicolas Chauvet (kwizart)
Modified: 2019-08-13 16:49 UTC (History)
20 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed:

Attachments (Terms of Use)

Description Nicolas Chauvet (kwizart) 2018-10-23 12:48:31 UTC
Description of problem:
When trying to use kernel-cross-headers to cross compile using the fedora cross compilation toolchain, the following error occurs:

/usr/arm-linux-gnu/sys-root/usr/include/bits/errno.h:26:11: fatal error: linux/errno.h: No such file or directory

Version-Release number of selected component (if applicable):
current kernel as of 4.19

How reproducible:
always when cross compiling.

Steps to Reproduce:
1. dnf install kernel-cross-headers binutils-arm-linux-gnu gcc-arm-linux-gnu
2. rpmbuild -bb chromium.spec -D 'cross_compile 1' --target armv7hl

Actual results:
/usr/arm-linux-gnu/sys-root/usr/include/bits/errno.h:26:11: fatal error: linux/errno.h: No such file or directory

Expected results:
cross compiler should better find the kernel headers in 
whereas they are located in 

Additional info:
chromium compilation will later fails with missing <string> because there is no cross compiled libc++ but this validate some libc compilation.

The workaround I plan is to specify an alternate sysroot with a fedora native armfhp rootfs.

Fix patch to be (tested..., then) sent soon.

Comment 1 Nicolas Chauvet (kwizart) 2018-10-23 14:14:58 UTC
Currently testing build...:

Comment 2 Laura Abbott 2018-10-25 10:49:07 UTC
Josh asked the question on the mailing list and I have the same question: These headers worked when they were added, can you identify exactly what changed to necessitate this change?

Comment 3 Nicolas Chauvet (kwizart) 2018-10-25 11:38:50 UTC
@Laura, @josh

Thx for rising this point.

This is the first time I'm using the cross compiler toolchain in Fedora to target  userland applications. I confirm I was able to build the kernel and U-Boot binaries just fine previously. (theses was not using the cross-kernel headers).

I can also build a minimal hello.c application, but as soon as I'm adding the #include <errno.h> the compilation fails with the above error.
Reproduced on f28 and f29. Not yet in f27.
Using arm-linux-gnu-gcc -o /tmp/arm-hello /tmp/hello.c

That can be workaround by using using -I/usr/arm-linux-gnu/include (where the current cross-kernel-headers are located). But I expect we shouldn't have to add this include path for the cross kernel headers.
An alternate fix would be to have gcc to know where to find this include by default, but so far I don't know if such an option exists and I don't see where gcc would learn the cross kernel headers path ?

I also note that moving this directory will impact glibc-arm-linux-gnu compilation because it has to specify where to find the cross-kernel-headers (see https://bugzilla.redhat.com/show_bug.cgi?id=1642079#c3 )

I still have more questions on my side:
- Where the Fedora cross toolchain is documented ?
I would like to know which is the expected %{_build} macro to use on armhfp
(arm-linux-gnu- arm-linux-gnuebi- armv7hl-redhat-linux-gnu, etc).
- how to fix my build error? (either moving the cross kernel headers or another solution ?)
- What is the expected behaviour for path of cross kernel headers?
- What is the impact of moving the directory into the sys-root?

Unfortunately this seems a more important issue that I would have expected in the first step.

(On a side note, I will be in vacation later today until 5th of November, so I guess this issue can wait unless someone comes with a full solution).

I've created branch with my current understanding of how to fix:

Please share you thought.

Comment 4 Yann Droneaud 2018-10-26 09:40:15 UTC
I'm experiencing the same mismatch:

- glibc-arm-linux-gnu installs headers in /usr/arm-linux-gnu/sysroot/usr/include
- glibc-arm-linux-gnu depends on kernel-cross-headers
- kernel-cross-headers installs headers in /usr/arm-linux-gnu/include
- gcc-arm-linux-gnu searches headers in /usr/arm-linux-gnu/sysroot/usr/include

I have to add -isystem /usr/arm-linux-gnu/include to arm-linux-gnu-gcc command line cross-compile successfully.

Comment 5 Ben Cotton 2019-08-13 16:49:44 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to '31'.

Note You need to log in before you can comment on or make changes to this bug.