-
Notifications
You must be signed in to change notification settings - Fork 821
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
Issue running ARM cross compiler on WSL #1048
Comments
Hopefully that is easily reproducible... My understanding is that this scenario should be "supported" as they're standard ELF64 x86_64 binaries but I'm not really familiar enough with Linux to be able to dig any further without some guidance. These binaries definitely work correctly on an Ubuntu virtual machine. |
Are there no other download possibilities? I do not like to run binaries from an unknown source. |
I can completely appreciate that, I have looked around previously for a precompiled version without success however. |
Unfortunately I can't find a precompiled alternative for you to download. |
Yep
|
That is a very good question. The compiler was specified to us by our customer, from what I understand about the Yocto project it will be tailored to any nuances of that target MCU. That said, I will certainly give the generic cross compiler a try and see if it works. I can then use Windows for development and just use the Linux VM for release builds (in case there are any differences). I thought I would raise the bug here in case it was something fundamental that might affect other applications. |
We came across the same issue here with other SDK's built using OpenEmbedded. @RobertFromBerlin you can download nightly builds from the Yocto autobuild server: OpenEmbedded tries to build the SDK as self contained as possible, e.g. it even comes with its own libc etc... However, I tried to remove the provided libc, with which the binaries seem to fall back to Ubuntu's libc (according to ldd), but it still leads to Exec format error... |
Ditto for me. We use the Yocto cross-compiler for a custom embedded design and I'm seeing the same issue trying to run the cross-compiler. |
Guessing a little, it looks like the |
@therealkenc the person who builds the SDK for us tells me that we do not build with Multilib enabled. It may be worth trying to build the SDK itself on WSL to see that results in a cross-compiler that works. |
@therealkenc hm, looking at the output of So, nothing easier than give it a try: I modified the recipe ( |
Pinging @benhillis because I don't think the guys are following this thread. It's a pretty legitimate "linux first development CLI use case" so people are going to keep hitting it. Without cracking open a hexdump it's hard to tell what exactly is making Baby steps:
strace:
|
I should mention there's a user voice for 32-bit support, assuming the guess is right. Matches the symptom, anyway. You embedded guys might want to rush that one preemptively. |
Hm, I looked a bit closer into this, and diffed the output of Linaro cross compiler
OpenEmbedded/Yocto cross compiler
Looking at
This is the same on a native Ubuntu installation, but there that seems to work. Now you can use the loader directly and specify the executable to load, and when using the loader provided by the toolchain the compiler seems to work:
|
Another interesting fact: The loader on the native Ubuntu has the very same md5sum as the one running in the Linux subsystem for Windows:
|
As always @therealkenc, thank you so much for the detailed repro steps. It really REALLY helps me get through these issues quickly. At first I thought this could be #743 where we had a bug in our ELF parser that was failing for interpreter paths of > 64 characters. However when I ran your repro I found that we're still failing to parse the above elf image even with that fix. I did notice that it looks like we are incorrectly handling the case where a program header is equal to PATH_MAX (4096). We were checking for greater than or equal when we should have only been checking greater than. Gotta love those off-by-one errors... I'll review the rest of the ELF parsing code but with my quick fix I'm able to run the arm-poky-Linux-gnueabi-gcc without error.
|
@benhillis, awesome! I was just going to write it must have to be related to how the PT_INTERP section of the elf header is read. It seems that the Ubuntu loader really does not work for that binary, it also crashes on a native Ubuntu:
|
@benhillis Way cool! Could you give us a heads up here whenever this fix makes it into a Windows 10 Insider build? Thanks. |
Absolutely, I'll make sure it gets called out in a the release notes and I'll try to remember to ping this thread. ETA ~2 weeks. If you guys have some sample projects for me to compile I'd be happy to try, shoot me some instructions. |
@benhillis: Is there anything we can do from within bash (maybe based on @falstaff84's trick) to get this running without using an insider build of Windows? I'd really like to use poky on my windows machine without a vm. |
@benhillis This fix didn't make it into the Windows 10 14986 build did it? |
Sunil just posted a moment ago in another thread that the dev branch has a 2-3 week delay (with YRMV caveats). Russ does a pretty good job on the release notes and it's not mentioned. |
@therealkenc Thanks. I'll check Russ's release notes (just found them) in the future. The overall build 14986 release notes don't have that level of detail. |
It's fixed in 15002 :) |
I beat @benhillis 🥇 |
@ionescu007 - lol... |
Hello all, I have kind of the same issue with a compiler for MIPS arch. The subsystem is a Ubuntu 18.04LTS, I don't know if using 14.04 like mentioned in the tuto would make a difference. This is the error part of the make command:
Any clue ? |
@PureBasic It seems that toolchain has 32bit ELF executables and they are not supported in WSL. Some people had luck using a workaround with QEMU. You can read more in #2468 (comment) WSL2 fixed that but it's only available on Insider Fast builds for now. |
Hi @onomatopellan , thanks. |
I am trying to run an ARM cross compiler in the Bash on Windows shell. The compiler is built to target ELF64 (x86-64) but when I try to execute it I get the error message
I would expect the executable to run correctly, even without arguments I would expect the standard help text and version information for example.
Here is a terminal output showing me trying to execute the application and then executing the file command to verify that the executable is the correct format (and I haven't accidentally tried to use the ARM build!)
anthony@LAPTOPXPS13:/opt/poky/1.5.2/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi$ ./arm-poky-linux-gnueabi-gcc
bash: ./arm-poky-linux-gnueabi-gcc: cannot execute binary file: Exec format error
anthony@LAPTOPXPS13:/opt/poky/1.5.2/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi$ file arm-poky-linux-gnueabi-gcc
arm-poky-linux-gnueabi-gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, BuildID[sha1]=88081dc75846ee4bf817a4fb32e6ed7184337eab, not stripped
14393.105
Download pre-compiled poky cross compiler from https://www.dropbox.com/s/w7zbsj7bg87bix5/arm-poky-linux-gnueabi.zip?dl=0
This contains all of the different compiler executables, the issue is present with all of them.
execve("./arm-poky-linux-gnueabi-gcc", ["./arm-poky-linux-gnueabi-gcc"], [/* 16 vars */]) = -1 ENOEXEC (Exec format error)
write(2, "strace: exec: Exec format error\n", 32strace: exec: Exec format error
) = 32
exit_group(1) = ?
+++ exited with 1 +++
See our contributing instructions for assistance.
The text was updated successfully, but these errors were encountered: