Bug 1456209 - gcc-arm-linux-gnu and glibc-arm-linux-gnu disagree on where headers and libraries should be installed
Summary: gcc-arm-linux-gnu and glibc-arm-linux-gnu disagree on where headers and libra...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: cross-gcc
Version: 25
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: David Howells
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-27 20:42 UTC by Simon Redman
Modified: 2019-02-22 09:36 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-30 10:07:11 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Simon Redman 2017-05-27 20:42:52 UTC
Description of problem:
Installing the two packages arm-linux-gcc-gnu and glibc-arm-linux-gnu does not allow cross-compiling (even very simple things) out-of-the box arm-linux-gcc-gnu expects headers, libraries, etc. to be installed to /usr/arm-linux-gnueabi/<include, lib, etc.>, while the package glibc-arm-linux-gnu installs these to /usr/arm-linux/gnu/<include, lib, etc.>

Version-Release number of selected component (if applicable):
gcc-arm-linux-gnu -- 6.1.1-2.fc35
glibc-arm-linux-gnu -- 2.24-2.fc25

How reproducible:
Easily

Steps to Reproduce:
1. Download and install packages arm-linux-gcc-gnu and glibc-arm-linux-gnu from the standard Fedora repositories
2. Create a hello_world.c program (Be sure to include <stdio.h>)
3. Attempt to compile the hello_world.c program using "arm-linux-gnu-gcc hello_world.c"

Actual results:
GCC error saying that stdio.h cannot be found

Expected results:
An executable in the current directory compiled for 32-bit arm which would print something to the terminal if run

Additional info:
Linking the files provided by glibc-arm-linux-gnu to the location expected by arm-linux-gnu-cpp appears to work around this problem: "ln -s /usr/arm-linux-gnu/* /usr/arm-linux-gnueabi/"

Comment 1 David Howells 2017-05-30 10:07:11 UTC
By arm-linux-gcc-gnu, I presume you mean gcc-arm-linux-gnu?

"GCC error saying that stdio.h cannot be found"

Yes, that's exactly as intended.  cross-gcc does not include any userspace library component because (a) not all arches will build with the same C library - some won't work with glibc and some won't work with uclibc - and (b) there's a massive multiplication problem: some arches would need multiple userspaces building (at least 6 for MIPS, for example).

cross-gcc is intended primarily as an aid for kernel development.

Comment 2 Josh Cogliati 2018-02-21 20:51:29 UTC
This bug is still present in:
glibc-arm-linux-gnu-devel-2.26-1.fc27.noarch

If this is not a bug, I am trying to understand how you use /usr/arm-linux-gnu/ without doing:
ln -v -s /usr/arm-linux-gnu/* /usr/arm-linux-gnueabi/

For example:
arm-linux-gnu-gcc --sysroot=/usr/arm-linux-gnu
does not work.

Comment 3 Josh Cogliati 2018-02-21 23:23:11 UTC
Even tho' cross-gcc was only intended for kernel development, with:

dnf install gcc-arm-linux-gnu binutils-arm-linux-gnu glibc-arm-linux-gnu-devel
ln -v -s /usr/arm-linux-gnu/* /usr/arm-linux-gnueabi/

And then getting busybox 1.28.1:
make menuconfig
#Go into Settings and set Build static binary
#Set the cross compiler prefix to arm-linux-gnu-
#These result in the .config file including:
#CONFIG_STATIC=y
#CONFIG_CROSS_COMPILER_PREFIX="arm-linux-gnu-"
make

generates a busybox that works fine on an ARM LineageOS (an Android Fork) smartphone.

So glibc-arm-linux-gnu-devel is really close to being useful for things besides kernel development.

If there is a way to use Fedora packages to let me compile busybox for Android besides having to run the:
ln -v -s /usr/arm-linux-gnu/* /usr/arm-linux-gnueabi/
I would like to know.

--sysroot=/usr/arm-linux-gnu doesn't work because gcc looks for a /usr/arm-linux-gnu/usr/include instead of the /usr/arm-linux-gnu/include that is there

If this is still considered not a bug, I would like to be pointed to the fine manual I should be reading to figure out how to use glibc-arm-linux-gnu-devel

Thank you.

Comment 4 Benjamin Herrenschmidt 2018-06-20 03:41:00 UTC
Hitting the same issue in fc28..

Dave, what's the point of packaging an ARM glibc if your ARM gcc isn't working with it ? Other distros (ahem ... ubuntu... ahem) have that working fine...


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