iit-danieli-joint-lab / idjl-gcc-vxworks

Helpers script to compile a version of GCC that crosscompiles to VxWorks.
4 stars 3 forks source link

all-target-libgcc: fatal error: pthread.h: no such file or directory #23

Open gavanderhoorn opened 3 years ago

gavanderhoorn commented 3 years ago

So this is me blindly following the readme (after fixing #22) in an ubuntu:bionic Docker image.

Run of build_idjl_gcc_vxworks.sh starts of OK, but I get tons of "MULTIDIR: command not found" errors (which apparently are not fatal 'enough'), after which it finally errors-out with:

In file included from ../../../gcc-7.3.0/libgcc/gthr.h:148:0,
                 from ../../../gcc-7.3.0/libgcc/unwind-sjlj.c:31:
./gthr-default.h:35:10: fatal error: pthread.h: No such file or directory
 #include <pthread.h>
          ^~~~~~~~~~~
compilation terminated.
../../../gcc-7.3.0/libgcc/static-object.mk:17: recipe for target 'unwind-sjlj.o' failed
make[1]: *** [unwind-sjlj.o] Error 1
make[1]: *** Waiting for unfinished jobs....

I realise you are not a cross-compiler help desk, but perhaps you've encountered this yourself and have also fixed it, in which case I'd be grateful for some insight ..


Edit: to reproduce:

mkdir /tmp/something_something
cd /tmp/something_something
git clone https://github.com/iit-danieli-joint-lab/idjl-gcc-vxworks.git
docker run -it --rm -v $(pwd):/work ubuntu:bionic
apt update && apt install -y \
  bison \
  build-essential \
  dejagnu \
  expect \
  flex \
  git \
  gnat-7 \
  libisl-dev \
  libisl15 \
  libisl19 \
  texinfo \
  unzip \
  wget
./build_idjl_gcc_vxworks.sh
traversaro commented 3 years ago

As usual, the usual disclaimer that we are no responsible at all of what could happen if you use the script in this repo, as it could be indeed full of errors. : )

Having said that, ./gthr-default.h is the libgcc header related to the implementation of the thread model, that was patched in https://github.com/iit-danieli-joint-lab/idjl-gcc-vxworks/pull/13/files to support the use of pthread-threads instead of native VxWorks threads (btw you are not interesting in threading, you should be able to disable thread support). In particular, the pthread.h header should be provided by VxWorks system headers and should be copied by https://github.com/iit-danieli-joint-lab/idjl-gcc-vxworks/pull/13/files in wrs-vxworks-headers/sys-include. I am definitely not an expert of GCC build system, but I guess that directory should be passed at some point to the compiler as an include directory, probably related to this part of the patch: https://github.com/iit-danieli-joint-lab/idjl-gcc-vxworks/blob/6420f4629c2c68e4b0282555de37c34b4db735c3/patches/vxworks-pthread.patch#L67 . From where did you launched the script? The WIND_BASE is set in https://github.com/iit-danieli-joint-lab/idjl-gcc-vxworks/blob/6420f4629c2c68e4b0282555de37c34b4db735c3/build_idjl_gcc_vxworks.sh#L52 based on the SCRIPTPATH variable set in https://github.com/iit-danieli-joint-lab/idjl-gcc-vxworks/blob/6420f4629c2c68e4b0282555de37c34b4db735c3/build_idjl_gcc_vxworks.sh#L15, but if any of those variable have the wrong value I guess that this could be create problems.