oneAPI Construction Kit creating new hal issue

An oneAPI Construction Kit issue.

Got below error when following the guide to create new hal.

ubuntu@VM-0-15-ubuntu:~/projects/refsi_tutorial_part1/build$ REFSI_DEBUG=cmp bin/hello
[CMP] Starting.
terminate called after throwing an instance of 'std::system_error'
  what():  Enable multithreading to use std::thread: Operation not permitted
Aborted (core dumped)

how to reproduce:

  1. compile LLVM (the version I use is llvm-project_18.1.6)
  2. compile latest main branch of OCK with below command:
$ cmake -GNinja \
   -Bbuild-riscv \
   -DCA_RISCV_ENABLED=ON \
   -DCA_MUX_TARGETS_TO_ENABLE="riscv" \
   -DCA_LLVM_INSTALL_DIR=$LLVMInstall \
   -DCA_ENABLE_HOST_IMAGE_SUPPORT=OFF \
   -DCA_CL_ENABLE_ICD_LOADER=ON \
   -DCA_ENABLE_LLVM_OPTIONS_IN_RELEASE=ON \
   -DLLVM_CCACHE_BUILD=ON \
   -DCMAKE_INSTALL_PREFIX=$PWD/build-riscv/install
 
 $ ninja -C build-riscv install
  1. copy related files to refsi_tutorial_part1 dir and apply all the patches here, then compile with below command:
$ cd path/to/refsi_tutorial_part1
$ mkdir build
$ cd build
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCLIK_HAL_NAME=refsi_tutorial -DCLIK_EXTERNAL_HAL_DIR=$PWD/../hal_refsi_tutorial $OCK/clik
$ ninja hal_refsi_tutorial clik_runtime_sync clik_runtime_async
$ ninja ClikExamples

Has anyone seen this error before?

We have seen this on occasion and relates to pthreads. Could you try LD_PRELOAD=/lib/x86_64-linux-gnu/libpthread.so.0 on the run-line?

Hi @colin.davidson
It works, thanks!

ubuntu@VM-0-15-ubuntu:~/projects/refsi_tutorial_part1/build$ LD_PRELOAD=/lib/x86_64-linux-gnu/libpthread.so.0 bin/hello
Using device 'RefSi M1 Tutorial'
Running hello example (Global size: 8, local size: 1)
Hello from clik_sync! tid=0, lid=0, gid=0
Hello from clik_sync! tid=1, lid=0, gid=1
Hello from clik_sync! tid=2, lid=0, gid=2
Hello from clik_sync! tid=3, lid=0, gid=3
Hello from clik_sync! tid=4, lid=0, gid=4
Hello from clik_sync! tid=5, lid=0, gid=5
Hello from clik_sync! tid=6, lid=0, gid=6
Hello from clik_sync! tid=7, lid=0, gid=7