I am trying to build a cross-compiler from a x86-64 Linux host (Ubuntu-22.04 in WSL, with GCC 11) to arm-wrs-vxworks
, and I'm having some serious trouble doing so. I have very limited experience with cross-compilers and think I may be running into some simple configuration issues.
I've tried using the procedures detailed under Jonathan Wakely's answer and in the community wiki answer at How to install GCC piece by piece with GMP, MPFR, MPC, ELF, without shared libraries?, to no avail.
In particular, doing this yields a compiler error related to the C++17 standard:
tar xzf gcc-4.9.4.tar.gz
cd gcc-4.9.4
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.9.4/configure --prefix=$HOME/GCC-4.9.4 --target=arm-wrs-vxworks
make -j
make install
I tried increasing the target GCC version to 8.1.0 and keeping the host GCC at 11. I also independently tried keeping the target version of 4.9.4 and changing to a host with GCC 7. (Note that I first attempted updating the target GCC to 12.1.0, though it appears versions that recent have dropped VxWorks support.) In both cases, I get past the C++17-related compiler error, but I see the same cannot compute suffix of object files
error that several other people have reported (see below).
compiling gcc, configure: error: cannot compute suffix of object files: cannot compile
LibGCC compilation Failed with an error: cannot compute suffix of object files: cannot compile
Gcc compilation "cannot compute suffix of object files: cannot compile"
I have tried messing with the LD_LIBRARY_PATH
variable, toggling various configuration options, and more, with no luck. Manually building and installing binutils
with target=arm-wrs-vxworks
didn't seem to have any effect, either. (Even getting rid of the --target
option in the GCC configuration doesn't fix the build completely - I eventually get an error about missing sys/ustat.h
instead.)
I also found references to a program called crosstool-NG
, which seemed promising. I tried it out, and unfortunately, it appears as though it does not support VxWorks targets at all.
I've also consulted the following documentation:
https://gcc.gnu.org/install/build.html
https://crosstool-ng.github.io/docs/toolchain-construction/
https://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/
None of the procedures just seem to work. It's as if half of the versions of these tools have out-of-the-box failures, and the other half are incompatible with what I need.
Is there something obvious I might be missing that would explain this? (If there's any more information I can provide that may help narrow down the problem, please let me know.)
Edit: Looking in objdir/arm-wrs-vxworks/libgcc/config.log
, I see an error about WIND_BASE
not being defined. Setting it to the prefix path gets past that issue, but then it throws another error of -march=armv4: not found
immediately afterwards and suffers from the same ultimate suffix of object files
error.
Edit 2: Removing and rebuilding the GCC build folder with WIND_BASE
defined as the prefix folder, I see that the suffix of object files
issue has finally gone away. However, now it appears to be missing the header <semLib.h>
. I'm as-of-yet unsure where that is supposed to come from, but I suspect it's closely related to WIND_BASE
.
Edit 3: My hunch was right. Replacing WIND_BASE
with the path to the platform headers (a folder containing host
and target
subfolders) fixed the semLib
issue, and a few tweaks to the header files later, I have what seems to be a working arm-wrs-vxworks-gcc
. I still do not have any of the standard C++ headers (like <cstdio>
) or a working arm-wrs-vxworks-g++
, since it cannot find libstdc++
.
gcc/config.gcc
. Try:arm-wrs-vxworks7
as the comment says: We only support VxWorks 7 now on ARM You could try the source from the gcc repo: git://gcc.gnu.org/git/gcc.gitlibgcc*.a
? To my mind, only some runtime libraries on VxWorks itself (i.e. no gcc native port so that you run gcc on VxWorks itself)