0

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?

jin
  • 21
  • 1
  • Looks like the wrong `ld` is invoked. You need to install an ARM `ld` (`apt-get install binutils-aarch64-linux-gnu`) and tell CMake to use it (i.e. call `aarch64-linux-gnu-ld` instead of just `ld`). – Erlkoenig Apr 08 '20 at 07:29
  • Thanks. I did that but the error messages out. CMakeLists.txt SET(CMAKE_LINKER _path to_/aarch64-linux-gnu-ld) – jin Apr 09 '20 at 01:11

1 Answers1

0

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.

harry
  • 970
  • 6
  • 25