Skip to content

Best way to use native compiler along-side installed version? #16

@kcgen

Description

@kcgen

I'm attempting to build DOSBox from source using the native 8.3.0 build on a Pi3.

I've extracted the native gcc 8.3.0 build to /opt, and set the following environment variables:

OVERRIDE="/opt/native-pi-gcc-8.3.0-1/bin"
export AR="$OVERRIDE/gcc-ar-8.3.0"
export CC="$OVERRIDE/gcc-8.3.0"
export CXX="$OVERRIDE/g++-8.3.0"
export CPP="$OVERRIDE/cpp-8.3.0"
export FC="$OVERRIDE/gfortran-8.3.0"
export RANLIB="$OVERRIDE/gcc-ranlib-8.3.0"
export LD="$CXX"

For LTO builds, I additionally have:

CCPATH="/opt/native-pi-gcc-8.3.0-1/libexec/gcc/arm-linux-gnueabihf/8.3.0/"
export ARFLAGS="--plugin $GCCPATH/liblto_plugin.so"
export RANLIBFLAGS="--plugin $GCCPATH/liblto_plugin.so"

Attempting to ./configure with the above reports:

configure:3582: /opt/native-pi-gcc-8.3.0-1/bin/gcc-8.3.0    conftest.c  >&5
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory

I think the compiler should come with these files, but I didn't find them.
But I found copies in /usr/lib/arm-linux-gnueabihf, so I forced the linker to see them using:

export LIBRARY_PATH=/usr/lib/arm-linux-gnueabihf

This progresses us to the next issue ./configure hits:

configure:3708: /opt/native-pi-gcc-8.3.0-1/bin/gcc-8.3.0 -o conftest    conftest.c  >&5
In file included from /usr/include/stdio.h:27,
                 from conftest.c:11:
/usr/include/features.h:364:12: fatal error: sys/cdefs.h: No such file or directory
 #  include <sys/cdefs.h>
            ^~~~~~~~~~~~~
compilation terminated.

The native build doesn't contain these headers, but I found them locally in /usr/include/arm-linux-gnueabihf:

CFLAGS="-I/usr/include/arm-linux-gnueabihf"
CXXFLAGS="-I/usr/include/arm-linux-gnueabihf"

This gets us passed that, but now we see these warnings:

configure: WARNING: png.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: png.h: proceeding with the compiler's result
...
configure: WARNING: SDL_net.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: SDL_net.h: proceeding with the compiler's result
...
configure: WARNING: X11/XKBlib.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: X11/XKBlib.h: proceeding with the compiler's result
...
and so on.

At this point, it feels too off the rails.

I'm hoping I've doing wrong - maybe there's a more seamless approach? - symlinks? PATH override? copying some portion overtop /usr/...? Happy to try any suggestions.

Much thanks for the nice organized builds!
I want to report the cross-compiler is working perfectly, and I'm running an 8.3 cross-compiled build of the latest 4.19 kernel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🐛Error, flaw or faultDocs 📚Wiki Documentaion relatedQuestion ❔Query related to this projectSolved 🎏Goal Achieved!

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions