Skip to content

gcc: "Exec format error" - WSL in Windows 10 1803 #10420

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

Closed
Ralms opened this issue Oct 8, 2018 · 9 comments
Closed

gcc: "Exec format error" - WSL in Windows 10 1803 #10420

Ralms opened this issue Oct 8, 2018 · 9 comments
Labels
bug The issue is a bug, or the PR is fixing a bug

Comments

@Ralms
Copy link
Contributor

Ralms commented Oct 8, 2018

Hello everyone.

I'm having an issue doing the first build with CMake and it's starting to discourage me to get into ZephyrOS development :(

My setup is the following:
Subsystem Linux on a Windows 10 1803 machine.
Using Ubuntu 18.04.1 LTS
cmake version 3.8.2
zephyr-sdk-0.9.3
Board Intel D2000 (although I don't think its relevant with this error)

I've followed these guides twice:
https://docs.zephyrproject.org/latest/getting_started/getting_started.html
https://docs.zephyrproject.org/latest/getting_started/installation_linux.html

And was trying to do the HelloWorld test from:
https://docs.zephyrproject.org/latest/boards/x86/quark_d2000_crb/doc/quark_d2000_crb.html

My issue is when I run:
~/zephyr/samples/hello_world/build$ cmake -GNinja -DBOARD=quark_d2000_crb ..

I get the following:

-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.6", minimum required is "3.4")
-- Selected BOARD quark_d2000_crb
Zephyr version: 1.13.99
Parsing Kconfig tree in /home/unixu/zephyr/Kconfig
Loading /home/unixu/zephyr/boards/x86/quark_d2000_crb/quark_d2000_crb_defconfig as base
Merging /home/unixu/zephyr/samples/hello_world/prj.conf
CMake Error at /home/unixu/zephyr/cmake/compiler/gcc.cmake:34 (message):
  Executing the below command failed.  Are permissions set correctly?

  '/home/unixu/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/i586-zephyr-elfiamcu/i586-zephyr-elfiamcu-gcc
  --version'

Call Stack (most recent call first):
  /home/unixu/zephyr/cmake/toolchain.cmake:57 (include)
  /home/unixu/zephyr/cmake/app/boilerplate.cmake:269 (include)
  CMakeLists.txt:3 (include)

-- Configuring incomplete, errors occurred!

I've than ran:
/home/unixu/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/i586-zephyr-elf/i586-zephyr-elf-gcc --version
And I get:
-bash: /home/unixu/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/i586-zephyr-elf/i586-zephyr-elf-gcc: cannot execute binary file: Exec format error

I've tried to search for this error in a lot of locations but it seems very generic and I'm stuck.
Sorry if this isn't the best location for this type of requests but I'm getting desperate.

Thank you for your help and time.

@vanwinkeljan
Copy link
Member

Are you sure it is 64-bit VM?

Could you provide the output of the following commands?

uname -a
file /home/unixu/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/i586-zephyr-elf/i586-zephyr-elf-gcc
ldd /home/unixu/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/i586-zephyr-elf/i586-zephyr-elf-gcc

Further could you try for an other board?

@Ralms
Copy link
Contributor Author

Ralms commented Oct 8, 2018

Are you sure it is 64-bit VM?

Could you provide the output of the following commands?

uname -a
file /home/unixu/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/i586-zephyr-elf/i586-zephyr-elf-gcc
ldd /home/unixu/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/i586-zephyr-elf/i586-zephyr-elf-gcc

Further could you try for an other board?

Hi there,

It's not a VM, it's Subsystem for Linux on Windows:
https://docs.microsoft.com/en-us/windows/wsl/install-win10

I assume it's supported since it's mentioned on the documentation here:
https://docs.zephyrproject.org/latest/getting_started/installation_win.html#option-3-windows-10-wsl-windows-subsystem-for-linux

I've tried running the QEMU_x86 board one suggested on the Getting Started page but it returns the same error.
https://docs.zephyrproject.org/latest/getting_started/getting_started.html#running-a-sample-application-in-qemu

Here is the output of the requested commands:

unixu@DESKTOP-96VJLEK:~/zephyr/samples/hello_world/build$ uname -a
Linux DESKTOP-96VJLEK 4.4.0-17134-Microsoft #285-Microsoft Thu Aug 30 17:31:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux
unixu@DESKTOP-96VJLEK:~/zephyr/samples/hello_world/build$ file /home/unixu/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/i586-zephyr-elf/i586-zephyr-elf-gcc
/home/unixu/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/i586-zephyr-elf/i586-zephyr-elf-gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /home/unixu/zephyr-sdk/sysroots/x86_64-pokysdk-linux/lib/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=f8f2f4e2db1f8096c64b5e3e18ece4ad727ffc6c, stripped
unixu@DESKTOP-96VJLEK:~/zephyr/samples/hello_world/build$ ldd /home/unixu/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/i586-zephyr-elf/i586-zephyr-elf-gcc
        linux-vdso.so.1 (0x00007fffe4b38000)
        libstdc++.so.6 => /home/unixu/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/i586-zephyr-elf/../../lib/libstdc++.so.6 (0x00007f23d8570000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f23d81c0000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f23d7fa0000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f23d7ba0000)
        /home/unixu/zephyr-sdk/sysroots/x86_64-pokysdk-linux/lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007f23d8a00000)
unixu@DESKTOP-96VJLEK:~/zephyr/samples/hello_world/build$

Thank you

@vanwinkeljan
Copy link
Member

No experience with WSL but it seems this is a known issue with WSL 1803:
microsoft/WSL#3259
microsoft/WSL#3154

@Ralms
Copy link
Contributor Author

Ralms commented Oct 8, 2018

Good catch, from reading the bugs its broken on a couple versions.
But seems to be fixed on 1809, I will give it a try and report back tomorrow.

How can we suggest documentation improvements? It would be a good addition to have a warning about the broken windows versions.

@Ralms Ralms changed the title [Help] Unable to do first initial CMake build gcc: "Exec format error" - WSL in Windows 10 1803 Oct 8, 2018
@Ralms
Copy link
Contributor Author

Ralms commented Oct 8, 2018

Due to some people loosing files from documents when updating to Windows 10 1809, the update is currently unavailable.
And it seems that Microsoft removed the possibility to manually update or force the update.

I will wait for the update, do it and report back.

@nashif nashif added the bug The issue is a bug, or the PR is fixing a bug label Oct 9, 2018
@carlescufi
Copy link
Member

@Ralms I tested 1809 and it fixes the issue as I mentioned here: microsoft/WSL#3154 (comment)

I am closing this issue now. If you want to add this to the doc I suggest you sent a PR against this file:
https://github.com/zephyrproject-rtos/zephyr/blob/master/doc/getting_started/installation_win.rst

@Ralms
Copy link
Contributor Author

Ralms commented Oct 10, 2018

@carlescufi Thank you for the information.
I've submitted the pull request as best as I could since I've not worked with reStructuredText in the past.

@carlescufi
Copy link
Member

@Ralms thank you for submitting it! I will review it

@spinkernel
Copy link

Even with the latest windows updates at 1809 I'm still getting Exec format error when compiling using a powerpc version of gcc. Anything I can do for more info?

/bin/sh: 1: powerpc-604-linux-gnu-gcc: Exec format error

OS Build 1809
Build 17763.437
Ubuntu 18.04.2 LTS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

No branches or pull requests

5 participants