Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/usr/include/features.h:424:12: fatal error: sys/cdefs.h #64

Closed
ghost opened this issue Feb 3, 2021 · 9 comments
Closed

/usr/include/features.h:424:12: fatal error: sys/cdefs.h #64

ghost opened this issue Feb 3, 2021 · 9 comments
Labels
Duplicate ♻️ This issue or pull request already exists Question ❔ Query related to this project Solved 🎏 Goal Achieved!

Comments

@ghost
Copy link

ghost commented Feb 3, 2021

Hi,

I have a raspberry pi 4 8Gb running raspbian 64 bits (Buster):

pi@jarvis2:/Dev $ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
pi@jarvis2:
/Dev $ uname -a
Linux jarvis2 5.10.5-v8+ #1392 SMP PREEMPT Sat Jan 9 18:56:30 GMT 2021 aarch64 GNU/Linux

(I have downloaded native-gcc-10.2.0-pi_64.tar.gz)

sudo tar xvf ~/Downloads/native-gcc-10.2.0-pi_64.tar.gz -C /opt/
sudo mv /opt/native-pi-gcc-10.2.0-64 /opt/gcc-10.2.0
echo 'export PATH=/opt/gcc-10.2.0/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/opt/gcc-10.2.0/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
. ~/.bashrc

then I try to compile the following file :

`#include

int main() {
// if block with init-statement:
if(int a = 5; a < 8) {
std::cout << "Local variable a is < 8\n";
} else {
std::cout << "Local variable a is >= 8\n";
}
return 0;
}`
pi@jarvis2:~/Dev $ g++-10.2.0 -std=c++17 -Wall -pedantic if_test.cpp -o if_test
In file included from /opt/gcc-10.2.0/include/c++/10.2.0/aarch64-linux-gnu/bits/os_defines.h:39,
from /opt/gcc-10.2.0/include/c++/10.2.0/aarch64-linux-gnu/bits/c++config.h:518,
from /opt/gcc-10.2.0/include/c++/10.2.0/iostream:38,
from if_test.cpp:1:
/usr/include/features.h:424:12: fatal error: sys/cdefs.h: Aucun fichier ou dossier de ce type
424 | # include <sys/cdefs.h>

@abhiTronix abhiTronix added Duplicate ♻️ This issue or pull request already exists WIP 🏗️ Work in Progress Question ❔ Query related to this project labels Feb 3, 2021
@abhiTronix
Copy link
Owner

abhiTronix commented Feb 3, 2021

I have a raspberry pi 4 8Gb running raspbian 64 bits (Buster)

@vrichomme Support for Raspberry Pi 4 (Buster 64bit) is still in development. Wait for PR #62 to be merged or compile it manually on a Linux system as follows:

# update your system
sudo apt update && sudo apt dist-upgrade

# install prerequisites
sudo apt-get -y install gcc g++ gperf flex texinfo gawk gfortran texinfo bison \
    build-essential openssl unzip wget git pigz \
    libncurses-dev autoconf automake tar figlet

# clone patch
git clone https://github.com/abhiTronix/raspberry-pi-cross-compilers.git && cd raspberry-pi-cross-compilers
git checkout patch@buildscript

# and compile binary:
cd build-scripts
./RTBuilder_64b -g "10.2.0" -o "buster"

@ghost
Copy link
Author

ghost commented Feb 3, 2021

Do I need to run it on the raspbian or on a x86_64 host ?
Because on the raspi I don't understand why it recompiles gcc-8.3 when it's already available on the system ?
And the first time I run the script I had an error and the second times I thought it would display the same error but now it's starting again from zero I think...

@abhiTronix
Copy link
Owner

Yeah obviously you'll need any x86_64 linux machine/system to cross-compile for raspberry pi. You can't cross-compile for raspberry pi itself.

@abhiTronix
Copy link
Owner

Script will generate two files: native-gcc-{GCC_VERSION}-pi_64.tar.gz and cross-gcc-{GCC_VERSION}-pi_64.tar.gz at your $HOME director of x86_64 linux machine. Use native-gcc-{GCC_VERSION}-pi_64.tar.gz on your pi4.

@ghost
Copy link
Author

ghost commented Feb 4, 2021

Ok I compiled the native and copied it but still the same error...
Maybe something wrong with my install or I should go back to raspbian 32 bits,i don't know
Would it be possible to add the possiblity to compile gcc directly on the raspi ? I don't care if it takes 2 days.
When I compare with the official gcc I can see some differences:
pi@jarvis2:~/Dev $ gcc-10.2.0 -v -v
Using built-in specs.
COLLECT_GCC=gcc-10.2.0
COLLECT_LTO_WRAPPER=/opt/gcc-10.2.0/bin/../libexec/gcc/aarch64-linux-gnu/10.2.0/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../configure --prefix= --build=x86_64-pc-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu --enable-languages=c,c++,fortran --with-arch=armv8-a+fp+simd --disable-multilib --program-suffix=-10.2.0
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (GCC)

pi@jarvis2:~/Dev $ gcc -v -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/8/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-6' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --disable-libphobos --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
gcc version 8.3.0 (Debian 8.3.0-6)

@abhiTronix
Copy link
Owner

abhiTronix commented Feb 5, 2021

@vrichomme Did you setup the important symbolic links as mentioned in wiki docs :

 sudo ln -sf /usr/include/aarch64-linux-gnu/asm/* /usr/include/asm
 sudo ln -sf /usr/include/aarch64-linux-gnu/gnu/* /usr/include/gnu
 sudo ln -sf /usr/include/aarch64-linux-gnu/bits/* /usr/include/bits
 sudo ln -sf /usr/include/aarch64-linux-gnu/sys/* /usr/include/sys
 sudo ln -sf /usr/include/aarch64-linux-gnu/openssl/* /usr/include/openssl
 sudo ln -sf /usr/lib/aarch64-linux-gnu/crtn.o /usr/lib/crtn.o
 sudo ln -sf /usr/lib/aarch64-linux-gnu/crt1.o /usr/lib/crt1.o
 sudo ln -sf /usr/lib/aarch64-linux-gnu/crti.o /usr/lib/crti.o

@ghost
Copy link
Author

ghost commented Feb 5, 2021

My bad. now it works. Sorry for the noise.
However I had to remove the /* when creating the symbolic link

@abhiTronix
Copy link
Owner

@vrichomme Idk sometimes we need /* and other times we don't. I'll look into this.

@abhiTronix
Copy link
Owner

@vrichomme Ok these are new commands:

 sudo ln -sf /usr/include/aarch64-linux-gnu/asm/* /usr/include/asm/
 sudo ln -sf /usr/include/aarch64-linux-gnu/gnu/* /usr/include/gnu/
 sudo ln -sf /usr/include/aarch64-linux-gnu/bits/* /usr/include/bits/
 sudo ln -sf /usr/include/aarch64-linux-gnu/sys/* /usr/include/sys/
 sudo ln -sf /usr/include/aarch64-linux-gnu/openssl/* /usr/include/openssl/
 sudo ln -sf /usr/lib/aarch64-linux-gnu/crtn.o /usr/lib/crtn.o
 sudo ln -sf /usr/lib/aarch64-linux-gnu/crt1.o /usr/lib/crt1.o
 sudo ln -sf /usr/lib/aarch64-linux-gnu/crti.o /usr/lib/crti.o

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate ♻️ This issue or pull request already exists Question ❔ Query related to this project Solved 🎏 Goal Achieved!
Projects
None yet
Development

No branches or pull requests

1 participant