Skip to content

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

Closed
@zedaav

Description

@zedaav

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions