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

"Exec format error" when calling Yocto toolchain GCC compiler #3259

Closed
zedaav opened this issue May 30, 2018 · 6 comments
Closed

"Exec format error" when calling Yocto toolchain GCC compiler #3259

zedaav opened this issue May 30, 2018 · 6 comments

Comments

@zedaav
Copy link

zedaav commented May 30, 2018

We are a company which is proposing SDKs to develop Linux-based apps for our hardware modules.

The development environment is basically supported on Linux hosts.
In order to support Windows hosts as well, we have used solutions based on Docker for years now.
We studied support for WSL for several months now, and start to have a working solution.

Well, we started to have it.
Since April major update, the WSL kernel refuses to execute the GCC compiler that comes with our toolchain (built with Yocto Linux build system), while it was working with earlier versions.

Some details below:

Windows build number: Version 10.0.17134.48
NB: the problem didn't happen on Fall Creators Update (10.0.16299)

What's happening:

I've uploaded a sample toolchain to let you reproduce/investigate the issue:
foo@FRILM-ED-ITE00155:/tmp/foo$ wget http://download.sierrawireless.com/tmp/poky-swi-glibc-x86_64-meta-toolchain-swi-i586-toolchain-swi-LXSWI2.2-6.0.rc3+virt.sh

Make it runnable:
foo@FRILM-ED-ITE00155:/tmp/foo$ chmod +x poky-swi-glibc-x86_64-meta-toolchain-swi-i586-toolchain-swi-LXSWI2.2-6.0.rc3+virt.sh

Install it:
foo@FRILM-ED-ITE00155:/tmp/foo$ ./poky-swi-glibc-x86_64-meta-toolchain-swi-i586-toolchain-swi-LXSWI2.2-6.0.rc3+virt.sh
Poky (Yocto Project Reference Distro) SDK installer version 2.2.3
=================================================================
Enter target directory for SDK (default: /opt/swi/LXSWI2.2-6.0.rc3+virt): /tmp/foo/toolchain
You are about to install the SDK to "/tmp/foo/toolchain". Proceed[Y/n]?
Extracting SDK......
<snip....>
<some errors due to bad gcc compiler>
"Failed to install driver build environment."

Verify GCC compiler file type:
foo@FRILM-ED-ITE00155:/tmp/foo$ file toolchain/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/i586-poky-linux-gcc
toolchain/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/i586-poky-linux-gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /tmp/foo/toolchain/sysroots/x86_64-pokysdk-linux/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=3515e7bd70622a92d798fa9a9251f767df26a04a, stripped

What's wrong:
When we try to execute the gcc compiler, we get this error:
foo@FRILM-ED-ITE00155:/tmp/foo$ toolchain/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/i586-poky-linux-gcc --version
-bash: toolchain/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/i586-poky-linux-gcc: cannot execute binary file: Exec format error

What should be happening instead:
GCC version should be displayed instead
ì586-poky-linux-gcc (GCC) 6.2.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Strace of the failing command:
https://gist.github.com/zedaav/8d46713b3a8ea6ab6a57a49189ac8960

I wonder if this is not related to the fix for #1884
Binary mentioned in this ticket looks to run fine now (in April 2018 Update), but maybe something in the fix broke the exec format parsing for this kind of Yocto built toolchain.

@fpqc
Copy link

fpqc commented May 30, 2018

It's (probably?) that the toolchain has compiled x86 rather than x64. You need to use a 64bit toolchain. WSL only supports x64 ELF and will return that error if it is x86.

@zedaav
Copy link
Author

zedaav commented May 30, 2018

Hi @fpqc
in the toolchain name, please note that:

  • x86_64 is used for the host (the place where you execute the toolchain)
  • i586 is used for the target (where the compiled code with this GCC is expected to be executed)

This is actually a 64bits toolchain, that works perfectly well on a native Ubuntu 64 bits host.
(Check by the way the result from the file command, which recognizes it well as a 64bits executable)

@0xbadfca11
Copy link

Related issue is #3154.
(Not resoleved in version 1803 yet.)

@zedaav
Copy link
Author

zedaav commented May 30, 2018

Hi @0xbadfca11
Ok, exactly the same issue, will follow that one, thanks
(sorry for the duplicate)

@erikboto
Copy link

So I'm still getting this, and I can't update Windows 10 to 1809 because I guess that was pulled back because of some issues. Is there anyway to get passed this now, or any info on when the fix might make it into an update again?

@benhillis
Copy link
Member

@erikboto - The fix is still in the pipeline to be serviced in 1803. Sorry for the delay, I am also frustrated that it has taken so long to service this.

1809 is available again, and you should be able to update using these instructions:
https://support.microsoft.com/en-us/help/4028685/windows-10-get-the-update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants