llvmlite icon indicating copy to clipboard operation
llvmlite copied to clipboard

exec format error (llvm-config) when installing numba on raspberry pi 3...

Open SreehariRamMohan opened this issue 8 years ago • 4 comments

Hi

I installed the aarch64 prebuilts for LLVM 5.0 on my raspeberry pi 3 and then did a 'pip3 install numba', pointing LLVM_CONFIG at the llvm-config executable. I get a exec format error when the install tries to execute llvm-config.

root@raspberrypi:/tmp# file /root/clang+llvm-5.0.0-aarch64-linux-gnu/bin/llvm-config
/root/clang+llvm-5.0.0-aarch64-linux-gnu/bin/llvm-config: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, not stripped

root@raspberrypi:/tmp# echo $LLVM_CONFIG
/root/clang+llvm-5.0.0-aarch64-linux-gnu/bin/llvm-config
root@raspberrypi:/tmp# /root/clang+llvm-5.0.0-aarch64-linux-gnu/bin/llvm-config
bash: /root/clang+llvm-5.0.0-aarch64-linux-gnu/bin/llvm-config: cannot execute binary file: Exec format error

What am I doing wrong ? Is aarch64 the wrong prebuilts to download for the pi3 ?

thanks

SreehariRamMohan avatar Nov 12 '17 19:11 SreehariRamMohan

Although the ARM processor on the RPi3 is AArch64, the Raspbian distribution (for compatibility reasons) runs the processor in 32-bit mode with a 32-bit kernel. You will need the ARMv7 binaries.

Also, I should note that we haven't tested llvmlite on ARM in a while (we've never officially supported ARM), so I'm curious if it works for you.

seibert avatar Nov 13 '17 13:11 seibert

@seibert is it possible to build llvmlite from source on Raspberry Pi? Are there any build requirements, e.g. debian packages?

I run a repo at piwheels.org where we build armv7 wheels for Raspberry Pi, and someone just pointed out that this package was missing: https://github.com/bennuttall/piwheels/issues/187. I checked the output from the build failure (see here)

If you have any suggestions for getting the build working, that would be helpful. Otherwise if you are able to build an armv7 wheel I can import it into piwheels. Thanks

bennuttall avatar Jul 12 '19 14:07 bennuttall

Hi Ben! We've been meaning to figure out how to help get piwheels have Numba packages.

The problem you are running into is that llvmlite requires a specific version of LLVM. Because LLVM tends to change their API semi-frequently, we lock llvmlite to a specific version we test.

Our CI system for ARMv7 is based on conda (Berryconda), so we create an llvm conda package (since conda can package anything, not just Python) and then use that when we build llvmlite. For building an llvmlite wheel, we would need to first build LLVM, which takes 5.5 hours on a Raspberry Pi 3B+.

It might be easiest if we added wheel building to our CI system, since it is a minor modification to what we are already doing. If we were to build a Raspberry Pi wheel every release, where should we push it so that piwheels could pick it up? (We don't really understand how ARM wheels are being handled on PyPI.)

seibert avatar Jul 13 '19 15:07 seibert

Thanks - sounds great!

The problem you are running into is that llvmlite requires a specific version of LLVM

Does that requirement affect users or just when you build it?

Our CI system for ARMv7 is based on conda (Berryconda)

Is this known to be compatible with Raspbian? And does it work on all Pi models?

If we were to build a Raspberry Pi wheel every release, where should we push it so that piwheels could pick it up? (We don't really understand how ARM wheels are being handled on PyPI.)

Option 1 - submit to piwheels Option 2 - submit to PyPI (you can submit Arm wheels now)

Raspbian runs in armv6 user space, so even though wheels built are tagged armv7, they're compatible with armv6, assuming you don't turn on the armv7 optimisations when building. So you can copy an rename the file to be tagged armv6l and it will work on Pi 1/Zero. However you can't upload two identical wheels with different filenames to PyPI.

So I guess option 3 is upload armv7 to PyPI, we import the armv6 version.

If you want to submit to us, we don't have an automated way of doing it yet, but your releases aren't too frequent so that's fine. We can give you scp/sftp access to the server and we'll run the import commands from there, or you can upload to some web/cloud hosting and send us the links, or whatever works.

bennuttall avatar Jul 14 '19 08:07 bennuttall