cross-compile pocl with ARM cross-compiler on Ubuntu x64 PC

380 views Asked by At

I want to cross-compile pocl with ARM cross-compiler on Ubuntu x64 PC.

  • compile the pocl1.4 and generate ARM executable files of it with ARM cross-compiler that operates on Ubuntu x64 PC

  • offline-compile a kernel.cl and generate ARM executable files of it with the poclcc that operates on Ubuntu x64 PC

I tried the followings:

1. download llvm9, make and install to Ubuntu
 $cmake -G "Unix Makefiles" ../llvm-9.0.0.src -DCMAKE_INSTALL_PREFIX=/home/llvm -DCMAKE_BUILD_TYPE=Release
 $make -j12
 $sudo make install

2. download pocl1.4, make and install to Ubuntu
 $cmake  -DLLC_TRIPLE=aarch64-linux-gnu -DLLC_HOST_CPU=cortex-a53 -DWITH_LLVM_CONFIG=/home/llvm_ubuntu/bin/llvm-config ..
 $make
 $sudo make install

But I got error.

/usr/bin/ld: unrecognised emulation mode: aarch64linux
Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu i386linux elf_l1om elf_k1om i386pep i386pe
error: linker command failed with exit code 1 (use -v to see invocation)

Does anyone have some idea to solve it?

1

There are 1 answers

0
harry On

Copying from pocl documentation:

It’s now possible to cross-compile pocl on x86-64 to run on ARM/MIPS/etc, but only the LLVM-less build. There is a ToolchainExample.cmake file; copy it under different name, then follow the instructions in the file.

ToolchainExample.cmake have pretty much everything you need to know.