{"id":16174058,"url":"https://github.com/robamu/rpi-file-concurrency","last_synced_at":"2026-04-16T12:01:50.460Z","repository":{"id":103550906,"uuid":"371477067","full_name":"robamu/rpi-file-concurrency","owner":"robamu","description":"Testing thread-safety of Linux filesystem on a Raspberry Pi","archived":false,"fork":false,"pushed_at":"2021-05-28T14:15:32.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-23T01:13:58.027Z","etag":null,"topics":["concurrency","cpp17","raspberry-pi"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robamu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-27T19:04:12.000Z","updated_at":"2021-05-28T14:15:35.000Z","dependencies_parsed_at":"2023-03-13T15:07:25.870Z","dependency_job_id":null,"html_url":"https://github.com/robamu/rpi-file-concurrency","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.125,"last_synced_commit":"7cd1dbdca5041cdbf490da2ff20e257d4591d676"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":"robamu-org/raspberrypi-crosscompiling","purl":"pkg:github/robamu/rpi-file-concurrency","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robamu%2Frpi-file-concurrency","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robamu%2Frpi-file-concurrency/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robamu%2Frpi-file-concurrency/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robamu%2Frpi-file-concurrency/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robamu","download_url":"https://codeload.github.com/robamu/rpi-file-concurrency/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robamu%2Frpi-file-concurrency/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31884929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T11:36:10.202Z","status":"ssl_error","status_checked_at":"2026-04-16T11:36:09.652Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["concurrency","cpp17","raspberry-pi"],"created_at":"2024-10-10T04:10:42.696Z","updated_at":"2026-04-16T12:01:50.443Z","avatar_url":"https://github.com/robamu.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Cross-Compiling for the Raspberry Pi\n=====\n\nThis repository shows how to cross-compile a simple Hello World program and run it on\na Raspberry Pi. It also shows how to install and setup a TCF agent on the Raspberry Pi\nfor remote debugging with Eclipse.\n\n# Building Commands\n\nAdd `-G \"MinGW Makefiles\"` on Windows\n\n## Hosted\n\n```\nmkdir build \u0026\u0026 cd build\ncmake ..\ncmake --build . -j\n```\n\n## Raspberry Pi\n\n```\nmkdir build \u0026\u0026 cd build\ncmake -DOS_APP=rpi ..\ncmake --build . -j\n```\n\n# Prerequisites for cross-compiling\n\n1. `CMake` installed\n2. ARM Linux cross compiler installed\n3. Raspberry Pi sysroot folder mirrored on the host machine, using `rsync` and `scp`.\n   See the related [chapter](#rootfs) for more information.\n4. Optional: `tcf-agent` running on the Raspberry Pi for remote debugging with Eclipse. See the\n   related [chapter](#tcfagent) for more information.\n\n# Windows\n\nThere are  two options to cross-compile on Windows: Use the native tools and the Unix environment\nprovided by MinGW64 or perform the Linux steps in WSL2. If you want to use WLS2, follow the Linux\ninstructions (not tested yet, but should work). The following instructions show\nhow to cross-compile using MinGW64. It is still recommended to clone the sysroot with Linux\ntools, using WSL2, because cloning with the MinGW64 can be problematic.\n\nInstall [MSYS2](https://www.msys2.org/) first.\n\nPrepare MSYS2 by running the following commands in MinGW64\n\n```\npacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-make rsync\n```\n\nYou can also run `pacman -S mingw-w64-x86_64-toolchain` to install the full build chain with\n`gcc` and `g++`\n\n1. Install the correct [ARM Linux cross-compile toolchain provided by SysProgs](https://gnutoolchains.com/raspberry/).\n   You can find out the distribution release of your Raspberry Pi by running `cat /etc/rpi-issue`.\n\n   Test the toolchain by running:\n\n   ```sh\n   arm-linux-gnueabihf-gcc --version\n   ``` \n\n2. Navigate into the toolchain folder inside MinGW64.\n\n   ```sh\n   cd \u003ctoolchainPath\u003e/bin\n   pwd\n   ```\n\n   Copy the path and run the following command to add the tool binary path to the MinGW64 path\n\n   ```sh\n   export PATH=$PATH:\"\u003ccopied path\u003e\"\n   ```\n\n3. It is assumed the root filesystem is located somewhere on the host machine (see [rootfs](#rootfs)\n   chapter for more information how to do this). Set in in an environmental variable which \n   `CMake` can use\n\n   ```sh\n   export RASPBIAN_ROOTFS=\"\u003cpathToRootfs\u003e\"\n   ```\n\n   Note that you can add the commands in step 2 and step 3 to the `~/.bashrc` to set the path\n   and the environment variable up permanently\n\n4. Set the Raspberry Pi version by setting the `RASPBERRY_VERSION` environmental variable, for\n   example like this for the Raspberry Pi 4\n   \n   ```sh\n   export RASPBERRY_VERSION=4\n   ```\n   \n5. Build the application using CMake. Run the following commands inside the repository\n\n   ```sh\n   mkdir build \u0026\u0026 cd build\n   cmake -G \"MinGW Makefiles\" ..\n   cmake --build . -j\n   chmod +x hello\n   ```\n \n6. Transfer to application to the Raspberry Pi and run it to test it\n\n   ```sh\n   scp hello \u003cusername\u003e@raspberrypi.local:/tmp\n   ssh \u003cusername\u003e@raspberrypi.local\n   cd /tmp\n   ./hello\n   ```\n\n# Linux\n\nInstructions for an Ubuntu host\n\n1. Install the pre-built ARM cross-compile with the following command\n\n    ```sh\n    wget https://github.com/Pro/raspi-toolchain/releases/latest/download/raspi-toolchain.tar.gz\n    ```\n\n   Then extract to the opt folder:\n   \n   ```sh\n   sudo tar xfz raspi-toolchain.tar.gz --strip-components=1 -C /opt\n   ```\n   \n   Please note that this version of the toolchain might become obsolete in the future.\n   If another toolchain installation is used, it is still recommended to unpack the toolchain in the \n   `/opt/cross-pi-gcc` folder so that the Eclipse configuration and helper \n   scripts work without adaptions. Add the folder to the system path. On Linux,\n   this can generally be done with the following command\n\n   ```sh\n   export PATH=$PATH:\"/opt/cross-pi-gcc/bin\"\n   ``` \n\n   You can add this line to the `.bashrc` or `.profile` file in the `$HOME` directory \n   to add environmental variables permanently. More experienced users can\n   perform this step is a shell script which is `source`d to keep the environment clean.\n\n   Test the toolchain with the following command\n\n   ```sh\n   arm-linux-gnueabihf-gcc --version\n   ``` \n\n2. Navigate into the toolchain folder.\n\n   ```sh\n   cd \u003ctoolchainPath\u003e/bin\n   pwd\n   ```\n\n   Copy the path and run the following command to add the tool binary path to the MinGW64 path\n\n   ```sh\n   export PATH=$PATH:\"\u003ccopied path\u003e\"\n   ```\n\n3. It is assumed the root filesystem is located somewhere on the host machine (see [rootfs](#rootfs)\n   chapter for more information how to do this). Set in in an environmental variable which \n   `CMake` can use\n\n   ```sh\n   export RASPBIAN_ROOTFS=\"\u003cpathToRootfs\u003e\"\n   ```\n\n   Note that you can add the commands in step 2 and step 3 to the `~/.bashrc` to set the path\n   and the environment variable up permanently.\n\n4. Set the Raspberry Pi version by setting the `RASPBERRY_VERSION` environmental variable, for\n   example like this for the Raspberry Pi 4\n   \n   ```sh\n   export RASPBERRY_VERSION=4\n   ```\n\n5. Build the application using CMake. Run the following commands inside the repository\n\n   ```sh\n   mkdir build \u0026\u0026 cd build\n   cmake ..\n   cmake --build . -j\n   chmod +x hello\n   ```\n\n6. Transfer to application to the Raspberry Pi and run it to test it\n\n   ```sh\n   scp hello \u003cusername\u003e@raspberrypi.local:/tmp\n   ssh \u003cusername\u003e@raspberrypi.local\n   cd /tmp\n   ./hello\n   ```\n\n# \u003ca id=\"rootfs\"\u003e\u003c/a\u003e Cloning the root filesystem\n\nYou can also download a basic root filesystem for the Raspberry Pi 4 with `libgpiod` installed\nfrom [here](https://drive.google.com/file/d/10o7Mrp4hzJyqTw3xzyr4AQDCxJSEvYIS/view?usp=sharing).\n\n## Linux Host\n\nSet up a sysroot folder on the local host machine. Make sure the SSH connection to\nthe Raspberry Pi is working without issues. Then perform the following steps\n\n```sh\ncd $HOME\nmkdir raspberrypi\ncd raspberrypi\nmkdir rootfs\ncd rootfs\npwd\n```\n\nStore the result of `pwd`, it is going to be used by `rsync` later.\n\nNow use `rsync` to clone the Raspberry Pi sysroot to the local host machine.\nYou can replace `\u003cip-address\u003e` with `raspberrypi.local` to use DNS.\nUse the rootfs location stored from the previous steps as `\u003crootfs-path\u003e`.\n\n```sh\nrsync -avHAXR --delete-after --info=progress2 --numeric-ids \u003cuser_name\u003e@\u003cip_address\u003e:/{lib,usr,opt/vc/lib} \u003crootfs_path\u003e\n```\n\nOn Linux, it is recommended to repair some symlinks which can be problematic:\nNavigate to the folder containing the symlinks first:\n\n```sh\ncd \u003crootfs_path\u003e/usr/lib/arm-linux-gnueabihf\n```\n\nYou can now use\n\n```sh\nreadlink libpthread.so\n```\n\nwhich will show an absolute location of a shared library the symlinks points to. This location\nneeds to be converted into a relative path.\n\nRun the following command to create a relative symlinks instead of an absolute ones. The pointed\nto location might change to check it with `readlink` first before removing the symlinks:\n\n```sh\nrm libpthread.so\nrm librt.so\nln -s ../../../lib/arm-linux-gnueabihf/libpthread.so.0 libpthread.so\nln -s ../../../lib/arm-linux-gnueabihf/librt.so.1 librt.so\n```\n\nFor more information on issues which can occur when cloning the root filesystem,\nsee the [troubleshooting](#troubleshooting) section.\n\n## Windows Host\n\nThis requires [MSYS2](https://www.msys2.org/) installed. All command line steps shown here\nwere performed in the MSYS2 MinGW64 shell (not the default MSYS2, use MinGW64!).\nReplace `\u003cUserName\u003e` with respectively. It is recommended to set up\naliases in the `.bashrc` file to allow quick navigation to the `fsfw_example`\nrepository and to run `git config --global core.autocrlf true` for git in\nMinGW64.\n\nSet up a sysroot folder on the local host machine. Make sure the SSH connection to\nthe Raspberry Pi is working without issues. Then perform the following steps\n\n```sh\ncd /c/Users/\u003cUserName\u003e\nmkdir raspberrypi\ncd raspberrypi\nmkdir rootfs\ncd rootfs\npwd\n```\n\nStore the result of `pwd`, it is going to be used by `rsync` later.\n\nNow use rsync to clone the RPi sysroot to the local host machine.\nYou can replace `\u003cip-address\u003e` with `raspberrypi.local` to use DNS.\nUse the rootfs location stored from the previous steps as `\u003crootfs-path\u003e`.\n\n```sh\nrsync -avHAXR --numeric-ids --info=progress2 \u003cusername\u003e@\u003cip-address\u003e:/{lib,usr,opt/vc/lib} \u003crootfs-path\u003e\n```\n\nPlease note that `rsync` sometimes does not copy shared libraries or symlinks properly,\nwhich might result in errors when cross-compiling and cross-linking. It is recommended to run\nthe following commands in addition to the `rsync` command on Windows:\n\n```sh\nscp \u003cuser_name\u003e@\u003cip-address\u003e:/lib/arm-linux-gnueabihf/{libc.so.6,ld-linux-armhf.so.3,libm.so.6} \u003crootfs_path\u003e/lib/arm-linux-gnueabihf\nscp \u003cuser_name\u003e@\u003cip-address\u003e:/usr/lib/arm-linux-gnueabihf/{libpthread.so,libc.so,librt.so} \u003crootfs_path\u003e/usr/lib/arm-linux-gnueabihf\n```\n\nFor more information on issues which can occur when cloning the root filesystem,\nsee the [troubleshooting](#troubleshooting) section.\n\n# \u003ca id=\"tcfagent\"\u003e\u003c/a\u003e Installing the TCF agent on the Raspberry Pi\n\nThe [TCF agent](https://wiki.eclipse.org/TCF) allows comfortable\nEclipse remote debugging and other features like a remote  file explorer in Eclipse.\nThe following steps show how to setup the TCF agent on the Raspberry Pi and add it to the\nauto-startup applications. The steps are based\non [this guide](https://wiki.eclipse.org/TCF/Raspberry_Pi)\n\n1. Install required packages on the Raspberry Pi\n\n   ```sh\n   sudo apt-get install git uuid uuid-dev libssl-dev\n   ```\n\n2. Clone the repository and perform some preparation steps\n   ```sh\n   git clone git://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent.git\n   cd org.eclipse.tcf.agent.git/agent\n   ```\n\n3. Build the TCF agent\n   ```sh\n   make\n   ```\n\n   and then test it by running\n\n   ```sh\n   obj/GNU/Linux/arm/Debug/agent –S\n   ```\n\n4. Finally install the agent for auto-start with the following steps. And set it up for \n   auto-start.\n\n   ```sh\n   cd org.eclipse.tcf.agent/agent\n   make install\n   sudo make install INSTALLROOT=\n   sudo update-rc.d tcf-agent defaults\n   ```\n\n5. Restart the Raspberry Pi and verify the tcf-agent is running with the following command\n\n   ```sh\n   systemctl status tcf-agent\n   ```\n\n# Using Eclipse\n\n1. Install Eclipse for C/C++ with the \n   [installer](https://www.eclipse.org/downloads/packages/installer)\n2. Install the TCF agent plugin in Eclipse from the\n   [releases](https://www.eclipse.org/tcf/downloads.php). Go to\n   Help \u0026rarr; Install New Software and use the download page, for\n   example https://download.eclipse.org/tools/tcf/releases/1.6/1.6.2/ to search \n   for the plugin and install it.\n3. Eclipse project files were supplied to get started. You can copy the `.cproject` and `.project`\n   files to the system root and then add the repository as an Eclipse project to get started. \n   Only select the root folder check box here. The build system still needs to be generated from\n   command line, but you can build and debug the project conveniently in Eclipse after that.\n4. Set the `RASPBIAN_ROOTFS` Eclipse variable and the toolchain binary path correctly in the project\n   settings to make full use of the Eclipse indexer.\n5. If the `tcf-agent` is running on the Raspberry Pi, you should be able to connect to it using\n   the TCF plugin.\n6. If you are connected, right click on the generated image in the build tree and select\n   `Debug As` \u0026rarr; `Remote Application` to perform remote debugging\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobamu%2Frpi-file-concurrency","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobamu%2Frpi-file-concurrency","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobamu%2Frpi-file-concurrency/lists"}