* Add a first attempt at explicitly using Jenkinsfiles. * A first attempt... * Put code in a script block. * Add first attempt at link check job pipeline. * Hopefully correct shell block. * Install git. * Install packages as root. * Use custom image that already has dependencies installed. * Try processing the JUnit results. * Fix syntax (hopefully). * Try to get the build to set its status on Github. * Try and see if I can get the snippet build to run too. * A first attempt at reviving the static code analysis build. * Refactor style check job a bit. * Try to clean up other files and have them set statuses. * Set status in script blocks. * Fix directory (this may not fix my problem). * Should I load in the script step? * Maybe I can just load it without a name. * Maybe I have my path wrong. * Will this work? Just a test... * Try using a plugin instead. * And if I define the function manually at the top? * Maybe this will fix the load. * Try to turn unstable into failed. * Hopefully fix documentation builds. * Fix script blocks. * Maybe fix static code analysis job. * Try to adapt PR number variable. * First attempt at cross-compilation job. * Try to fix some syntax. * Clean workspaces after build. * Try to put the matrix in the right place. * Another attempt at the matrix configuration. * Maybe I have to nest it deeper. * Maybe I have to clean always? * What we need is more tabbing. * Use try/catch to handle failed junit processing. * Better handling of environment variables. * Try a differernt approach than try/catch. * Try to get some more information about ccache. * Is it possible we could store the ccache at a higher level? * Maybe I have the variable name wrong. * Clean the cross-compilation workspace. * Try mounting the ccache so it can be shared across multiple jobs. * Always pull images. * We need to run on the same node. * Run on only one core. * Try building in the Docker container in a different way. * Do I have the order backwards? * Can I run anything at all in the container? * The static code analysis job isn't helpful. * Try to set the user of the docker container. * Rebuild the Docker container instead. * Always pull an updated image. * Download any necessary dependencies too. * Oops, use the correct CMake options. * Fix line break in the wrong place. * Make sure to use the correct architecture. * We can't use MATCHES, that is a regex. * Oops, we need to use STREQUAL. * Bump to an older version since newer versions don't have gfortran. * Try to run the tests on the target. * Correct syntax. * Okay, I'm not allowed to generate a stage name. * Try cleaning the workspace at the start of the build. * Okay, so I just can't depend on the workspace cleaning job, wonderful. * Try and add the passphrase correctly. * Fix path for memory checks. * Fix path to test. * Fix PR number variable. * Try to fix path for test copying. * Try to get the PR number correct. * Try and centralize where the link cache is stored. * Why is it being printed strangely? * Is there some weird restriction where this all has to be on one line? * Always publish the HTML, and fix a link. * Try to fix SSH host key check. * Make the reports directory. * Try to fix file parsing. * Try to enable ccache. * Try to set ccache directory correctly. * Try to get the full pipeline set up correctly for cross-compilation. * Fix path to test data. * Allow debug builds when cross-compiling. * Remember to unpack all the test data! * Fail tests when the data isn't there. * Maybe I can use find instead. * Double escape for backslash? * What if we just run the test? * Port Catch2 improvement for junit runner. See https://github.com/catchorg/Catch2/commit/c29e198eab0ccdb190495397854b937677385e2e. * Re-enable junit testing (hopefully it will work now). * Output directly to the xml file. * Try to clean up regex. * Try to set IN PROGRESS status. * Could it be called RUNNING? * I guess I don't get access to set jobs in progress through this API. * Fix regex for test name extraction. * Try to clean up Jenkinsfiles. * Fix parameter name. * Maybe fix syntax? * Does it work without keyword arguments? * Correctly accept named parameters. * Abort previous builds to reduce load on Jenkins. * Use optimization when compiling. * Fix syntax for abortPrevious. * Fix missing closing brace... * Update links in CI documentation and try to fix memory check job. * Add a few more hosts for testing. * Document the additional systems. * Separate build directories for each matrix entry. * Use safer directory name. * What directory are we in? * Try an alternate strategy of setting build names. * Fix typo. * Assemble container name. * Oops, forgot one. * Oops, fix the last use of to . * Fix bad merge. * Set different page sizes for different systems. * Try different quotation strategy. * Make sure the variable actually gets substituted in. * Quotes, bane of my existence. * Update Jetson Orin Nano link. * Try to use CORTEXA72 for the BB-AI again. * Try to set flags for the Jetson Orin Nano too. * Remove board names and use architecture names instead. * Re-add RPI4 as BCM2711. * Try to get the junit files back using the correct variable.
13 KiB
Setting up an mlpack cross-compilation environment
The following table contains a list of different architectures that you can
compile or cross compile mlpack to. This page assumes that you have a
functional operating system (e.g., Linux, MacOS, Windows) with compatible
ABI on both the host and the target. In addition, your objective is to create
an embedded ABI (eabi). For now, this guide does not support none-eabi or
bare-metal C/C++. The following table refers only to possible values of
ARCH_NAME CMake flag that needs to be specified before the compilation
process starts.
If your device has a fully functional package manager such as apt (for Debian systems), and you have enough RAM on your embedded device (e.g., RAM > 4GB), then you will probably be able to compile directly on the device. However, if this is not the case, then you will need to follow these instructions for cross-compilation.
Setting up the cross compilation toolchain is generally easy, especially when using bootlin toolchains; but other toolchains work too. Once you have the toolchain set up, then you need to identify two parameters to configure mlpack with CMake:
TOOLCHAIN_PREFIX: this specifies the prefix to use when calling compilers and other tools inside the toolchainCMAKE_SYSROOT: this specifies the system root for the cross-compilation environment; in the Bootlin toolchains, this is thesysroot/directory
For more detailed information on these options see this tutorial.
You can use the table below with your desired architecture to find links to
appropriate Bootlin toolchains, plus the TOOLCHAIN_PREFIX and CMAKE_SYSROOT
options you can use with those toolchains. If you have provided your own
toolchain, you will need to adapt the options accordingly.
Once you have found the correct TOOLCHAIN_PREFIX and CMAKE_SYSROOT options,
adapt the CMake command below. Don't forget to change
/path/to/bootlin/toolchain/ to the correct path on your system!
cmake \
-DBUILD_TESTS=ON \
-DARCH_NAME=(Check the following table) \
-DCMAKE_CROSSCOMPILING=ON \
-DCMAKE_TOOLCHAIN_FILE=../CMake/crosscompile-toolchain.cmake \
-DTOOLCHAIN_PREFIX=(Check the following table) \
-DCMAKE_SYSROOT=(Check the following table) \
../
|-----------------------------------------------------------------------------
| ARCH_NAME | link to crosscompiler | CMake command | Example applications |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ARM11 | Bootlin toolchain link | Sysroot and toolchain prefix | ARM11 on Wikipedia |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CORTEXA7 | Bootlin toolchain link | Sysroot and toolchain prefix | Cortex A7 on Wikipedia |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CORTEXA8 | Bootlin toolchain link | Sysroot and toolchain prefix | Cortex A8 on Wikipedia |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CORTEXA9 | Bootlin toolchain link | Sysroot and toolchain prefix |Cortex A9 on Wikipedia |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CORTEXA15 | Bootlin toolchain link | Sysroot and toolchain prefix | Cortex A15 on Wikipedia |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CORTEXA53 | Bootlin toolchain link | Sysroot and toolchain prefix | Cortex A53 on Wikipedia |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CORTEXA72 | Bootlin toolchain link | Sysroot and toolchain prefix | Cortex A72 on Wikipedia |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CORTEXA76 | Bootlin toolchain link | Sysroot and toolchain prefix | Cortex A76 on Wikipedia |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CORTEXA78 | Bootlin toolchain link | Sysroot and toolchain prefix | Cortex A78 on Wikipedia |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| BCM2711 | Bootlin toolchain link | Sysroot and toolchain prefix | Raspberry Pi 4 on Wikipedia |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| C906 | Bootlin toolchain link| Sysroot and toolchain prefix | C906 on riscv |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| x280 | Bootlin toolchain link| Sysroot and toolchain prefix | x280 on SiFive |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| KATAMI | Bootlin toolchain link | Sysroot and toolchain prefix |Pentium 3 on Wikipedia |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| NORTHWOOD | Bootlin toolchain link | Sysroot and toolchain prefix |Pentium 4 on Wikipedia |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| COPPERMINE | Bootlin toolchain link | Sysroot and toolchain prefix |Pentium 3 on Wikipedia |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
If you didn't see your architecture in the table above, use the closest
architecture with a similar word size, or, adapt the parameters directly in
CMake/crosscompile-arch-config.cmake and feel free to open a pull request so we can get
the new architecture added to this table.
ARM11
-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/armv6-eabihf--glibc--stable-2024.02-1/bin/arm-buildroot-linux-gnueabihf-
-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/armv6-eabihf--glibc--stable-2024.02-1/arm-buildroot-linux-gnueabihf/sysroot
CORTEXA7
-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/armv7-eabihf--glibc--stable-2024.02-1/bin/arm-buildroot-linux-gnueabihf-
-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/armv7-eabihf--glibc--stable-2024.02-1/arm-buildroot-linux-gnueabihf/sysroot
CORTEXA8
-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/armv7-eabihf--glibc--stable-2024.02-1/bin/arm-buildroot-linux-gnueabihf-
-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/armv7-eabihf--glibc--stable-2024.02-1/arm-buildroot-linux-gnueabihf/sysroot
CORTEXA9
-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/armv7-eabihf--glibc--stable-2024.02-1/bin/arm-buildroot-linux-gnueabihf-
-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/armv7-eabihf--glibc--stable-2024.02-1/arm-buildroot-linux-gnueabihf/sysroot
CORTEXA15
-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/armv7-eabihf--glibc--stable-2024.02-1/bin/arm-buildroot-linux-gnueabihf-
-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/armv7-eabihf--glibc--stable-2024.02-1/arm-buildroot-linux-gnueabihf/sysroot
CORTEXA53
-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/aarch64--glibc--stable-2024.02-1/bin/aarch64-buildroot-linux-gnueabihf-
-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/aarch64--glibc--stable-2024.02-1/aarch64-buildroot-linux-gnueabihf/sysroot
CORTEXA72
-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/aarch64--glibc--stable-2024.02-1/bin/aarch64-buildroot-linux-gnueabihf-
-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/aarch64--glibc--stable-2024.02-1/aarch64-buildroot-linux-gnueabihf/sysroot
CORTEXA76
-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/aarch64--glibc--stable-2024.02-1/bin/aarch64-buildroot-linux-gnu-
-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/aarch64--glibc--stable-2024.02-1/aarch64-buildroot-linux-gnu/sysroot
CORTEXA78
-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/aarch64--glibc--stable-2024.02-1/bin/aarch64-buildroot-linux-gnu-
-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/aarch64--glibc--stable-2024.02-1/aarch64-buildroot-linux-gnu/sysroot
BCM2711
-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/aarch64--glibc--stable-2024.02-1/bin/aarch64-buildroot-linux-gnueabihf-
-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/aarch64--glibc--stable-2024.02-1/aarch64-buildroot-linux-gnueabihf/sysroot
C906
-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/riscv64-lp64d--glibc--stable-2024.02-1/bin/riscv64-buildroot-linux-gnueabihf-
-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/riscv64-lp64d--glibc--stable-2024.02-1/riscv64-buildroot-linux-gnueabihf/sysroot
x280
-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/riscv64-lp64d--glibc--stable-2024.02-1/bin/riscv64-buildroot-linux-gnueabihf-
-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/riscv64-lp64d--glibc--stable-2024.02-1/riscv64-buildroot-linux-gnueabihf/sysroot
KATAMI
-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/x86-i686--glibc--stable-2024.02-1/bin/x86-i686-buildroot-linux-gnueabihf-
-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/x86-i686--glibc--stable-2024.02-1/x86-i686-buildroot-linux-gnueabihf/sysroot
NORTHWOOD
-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/x86-64--glibc--stable-2024.02-1/bin/x86-64-buildroot-linux-gnueabihf-
-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/x86-64--glibc--stable-2024.02-1/x86-64-buildroot-linux-gnueabihf/sysroot
COPPERMINE
-DTOOLCHAIN_PREFIX=/path/to/bootlin/toolchain/x86-i686--glibc--stable-2024.02-1/bin/x86-i686-buildroot-linux-gnueabihf-
-DCMAKE_SYSROOT=/path/to/bootlin/toolchain/x86-i686--glibc--stable-2024.02-1/x86-i686-buildroot-linux-gnueabihf/sysroot