Skip to content
This repository has been archived by the owner on Aug 7, 2020. It is now read-only.

fatal error: gnu/stubs-hard.h: No such file or directory #11

Closed
thijstriemstra opened this issue Jun 21, 2016 · 5 comments
Closed

fatal error: gnu/stubs-hard.h: No such file or directory #11

thijstriemstra opened this issue Jun 21, 2016 · 5 comments

Comments

@thijstriemstra
Copy link
Contributor

thijstriemstra commented Jun 21, 2016

This is probably more a user error than an issue with this cross-compiler but perhaps someone knows what's going on here. I've build gcc 5.4.0 with kernel 4.4.11 on Ubuntu 16.04 with gcc 4.9.3 using this command:

FULL_REBUILD=1 XC_TARGET_NAME=rpi2 bash ./build.sh

And it all worked properly, e.g.:

$ gcc-cross-compiler/xc-arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gcc --version
arm-unknown-linux-gnueabihf-gcc (GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

When I use this compiler to cross-compile Qt 5.6 for RaspberryPi it throws a lot of errors related to missing headers. Note that it worked with the official toolchain at https://github.com/raspberrypi/tools, only that one uses gcc 4.8.3 and is missing stdatomic.h that I need to build Python 3.5...

pulseaudio.cpp:34:30: fatal error: pulse/pulseaudio.h: No such file or directory
compilation terminated.
Makefile:187: recipe for target 'pulseaudio.o' failed
make: *** [pulseaudio.o] Error 1
PulseAudio disabled.

That's the first issue, but it's also complaining about gnu/stubs-hard.h: No such file or directory and hopefully you can tell me what that is about?

/home/raspi-build/gcc-cross-compiler/xc-arm-unknown-linux-gnueabihf/arm-unknown-linux-gnueabihf/include/gnu/stubs.h:10:29: fatal error: gnu/stubs-hard.h: No such file or directory
compilation terminated.
Makefile:192: recipe for target 'opengles2.o' failed
make: *** [opengles2.o] Error 1
OpenGL ES 2.0 disabled.
The OpenGL ES 2.0 functionality test failed!
 You might need to modify the include and library search paths by editing
 QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in
 /home/raspi-build/qt-everywhere-opensource-src-5.6.0/qtbase/mkspecs/devices/linux-rasp-pi2-g++.

My sysroot was created with an rsync of the raspberrypi:

mkdir sysroot sysroot/usr sysroot/opt
rsync -avz pi@IP:/lib sysroot
rsync -avz pi@IP:/usr/include sysroot/usr
rsync -avz pi@IP:/usr/lib sysroot/usr
rsync -avz pi@IP:/opt/vc sysroot/opt

And a search does find a couple of stubs-hard.h on my machine:

$ locate stubs-hard.h
/home/raspi-build/sysroot/usr/include/arm-linux-gnueabihf/gnu/stubs-hard.h
/home/raspi-build/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/arm-linux-gnueabihf/sysroot/usr/include/gnu/stubs-hard.h
/usr/arm-linux-gnueabi/include/gnu/stubs-hard.h
@thijstriemstra
Copy link
Contributor Author

raspberrypi/tools#50 seems like a similar issue..

@pwaring
Copy link
Owner

pwaring commented Jun 25, 2016

What do you get from running cpp -v? That should show you all the library search paths towards the end of the output. If those directories don't include gnu/stubs-hard.h then that will be the source of the problem.

@thijstriemstra
Copy link
Contributor Author

Here's the build script I use for Qt 5.6.1.

#!/bin/bash

# configures the Qt build

export RASPBERRYPI_DEVICE=linux-rasp-pi2-g++

# raspberrypi toolchain [GCC 4.8.3] (can't use: missing stdatomic.h, only available in GCC 4.9 and newer)
#export COMPILER=/home/raspi-build/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-

# raspberrypi toolchain [GCC 4.9.3] (broken: see https://github.com/raspberrypi/tools/issues/50)
#export COMPILER=/home/raspi-build/src/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-

# gcc-cross-compiler [GCC 5.4.0] (broken: see https://github.com/pwaring/gcc-cross-compiler/issues/11)
#export COMPILER=/home/raspi-build/src/gcc-cross-compiler/xc-arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-

# linaro [GCC 4.9.4] (works!)
export COMPILER=/home/raspi-build/src/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-

export SYSROOT=/home/raspi-build/sysroot
export TARGET_DIR_DEVICE=/usr/local/qt5pi
export TARGET_DIR_HOST=~/raspi-build/qt5pi
export TOOLS_DIR_HOST=~/raspi-build/qt5

./configure -release -opengl es2 -device $RASPBERRYPI_DEVICE \
  -device-option CROSS_COMPILE=$COMPILER -sysroot $SYSROOT \
  -opensource -confirm-license -make libs -make tools -no-compile-examples -no-pch \
  -prefix $TARGET_DIR_DEVICE \
  -extprefix $TARGET_DIR_HOST \
  -hostprefix $TOOLS_DIR_HOST -v 2>&1 | tee config.out

use it like this:

wget http://download.qt.io/official_releases/qt/5.6/5.6.1-1/single/qt-everywhere-opensource-src-5.6.1-1.tar.xz
tar xf qt-everywhere-opensource-src-5.6.1-1.tar.xz
cd qt-everywhere-opensource-src-5.6.1
../configure.sh
make
make install

Fortunately the gcc-linaro compiler worked so I think I'll stick to that unless you can find a solution because I prefer to build my own compiler like you're doing here. But feel free to close it otherwise.

@pwaring
Copy link
Owner

pwaring commented Jul 3, 2016

It's a bit beyond me at present - what I'll do is leave this open in case anyone with more knowledge/time has a solution.

@pwaring
Copy link
Owner

pwaring commented Jun 12, 2018

Closing this as I'm afraid I haven't had time to work on this project for a long time and I don't want to give the impression that it's still actively maintained.

@pwaring pwaring closed this as completed Jun 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants