arrayfire / arrayfire/arrayfire

Cross-compilation fixes patch

Open
#2,262 2 comments 0 reactions 0 assignees View on GitHub
build discuss
Dominant language
C++
Stars
4.9k
Forks
555
Avg merge
1h 24m
Merged PRs (30d)
1

Description

Here is a patch with modifications to allow building AF with cross-compilation for release 3.6.1.

[0001-fix-cmakelists-txt-for-yocto-build.patch.zip](https://github.com/arrayfire/arrayfire/files/2262781/0001-fix-cmakelists-txt-for-yocto-build.patch.zip)

I introduced 2 new flags:
- AF_BIN2CPP_ONLY
- AF_SKIP_PACKAGE

If AF_BIN2CPP_ONLY is ON, only bin2cpp is configured. Reason for this is that bin2cpp is a host binary compiled for the build machine architecture. In my case the build machine does not have all the necessary dependencies allowing a successful configure (cuda, opencl, freeimage, etc), and it sounds a bit silly to satisfy them when they are not used. I do have all the dependencies but for aarch64 only.

bitbake environment declares some flags upsetting CMake. Since I'm installing the binaries via a bitbake recipe, I don't need the CMake packaging and disabled it completely with AF_SKIP_PACKAGE set to ON.

Finally include(CTest) throws an error:
```
| CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
| THREADS_PTHREAD_ARG (advanced)
```
Since I build without test and run the arrayfire-python unit test instead, I moved include(CTest) inside the if(BUILD_TEST) ... statement.

This now allows me to build AF in my yocto stack.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.