BBB x-compile guide added #7

Merged
gaisser merged 17 commits from mueller/bbb-guide into master 2021-05-04 15:16:28 +02:00
2 changed files with 123 additions and 83 deletions
Showing only changes of commit f967fd71a2 - Show all commits

View File

@ -103,7 +103,7 @@ These prerequisites are valid for Linux as well as Windows hosts.
```
4. Set up a sysroot folder on the local host machine. Make sure the SSH connection to
the Raspberry Pi is working without issues. Then perform the following steps
the BBB is working without issues. Then perform the following steps
```sh
cd /c/Users/<UserName>
@ -116,53 +116,28 @@ These prerequisites are valid for Linux as well as Windows hosts.
Store the result of `pwd`, it is going to be used by `rsync` later.
Now use rsync to clone the Rapsberry Pi sysroot to the local host machine.
Now use rsync to clone the BBB sysroot to the local host machine.
You can replace `<ip-address>` with `beaglebone.local` to use DNS.
Use the rootfs location stored from the previous steps as `<rootfs-path>`.
```sh
rsync -vR --progress -rl --delete-after --safe-links <username>@<ip-address>:/{lib,usr,opt/vc/lib} <rootfs-path>
rsync -vR --progress -rl --delete-after --safe-links <username>@<ip-address>:/{lib,usr} <rootfs-path>
```
Please note that `rsync` sometimes does not copy shared libraries or symlinks properly,
which might result in errors when cross-compiling and cross-linking. See the
[troubleshooting](#troubleshooting) section for more details.
5. There might be some issues with the pthread symbolic links. Navigate to the folder
containing the symlinks
```sh
cd /c/User/<UserName>/beaglebone/rootfs/usr/lib/arm-linux-gnueabihf
```
Type `more libpthread`, press `TAB` and check whether the symbolic
link `libpthread.so` is shown. If it is not, we are going to set it up
manually to avoid issues when linking against `pthread` later.
Run the following command to create a symlink to `libpthread.so.0`
```sh
ln -s ../../../lib/arm-linux-gnueabihf/libpthread.so.0 libpthread.so
```
Please note that there might also be issues with some symlinks or libraries not being copied
properly. This has occured with files like `libc.so.6`. If there are linker issues at a later
stage, you can try to rerun `rsync` without `--safe-links` or copy the shared libraries or
symlinks manually from the Raspberry Pi to the sysroot with `scp`.
For example, you can copy `libc.so.6` from the Raspberry Pi to the sysroot with
the following command
```sh
scp pi@<ip-address>:lib/arm-linux-gnueabihf/lib.so.6 <rootfs-path>/lib/arm-linux-gnueabihf
```
6. It is recommended to install `gdb-multiarch`.
This tool will allow remote debugging on the host computer. Replace
`x86_64` with the correct processor architecture for other architectures.
5. It is recommended to install `gdb-multiarch`. This tool will allow remote debugging on the host
computer. Replace `x86_64` with the correct processor architecture for other architectures.
This is not required if the `tcf-agent` is used.
```sh
pacman -S mingw-w64-x86_64-gdb-multiarch
```
7. Perform the steps [in the following chapter](#cross-test) to build the
software for the Raspberry Pi and test it.
6. Perform the steps [in the following chapter](#cross-test) to build the
software for the BBB and test it.
## <a id="cross-test"></a> Testing the cross-compilation
@ -289,3 +264,52 @@ from [this guide](https://wiki.eclipse.org/TCF/Raspberry_Pi)
The [Eclipse README](README-eclipse.md#top) specifies how to perform remote
debugging using the TCF agent.
# <a id="troubleshooting"></a> Troubleshooting
## Cloning Sysroot
There might be some issues with the pthread symbolic links.
Navigate to the folder containing the symlinks
```sh
cd /c/User/<UserName>/beaglebone/rootfs/usr/lib/arm-linux-gnueabihf
```
Type `more libpthread`, press `TAB` and check whether the symbolic
link `libpthread.so` is shown. If it is not, we are going to set it up
manually to avoid issues when linking against `pthread` later.
Run the following command to create a symlink to `libpthread.so.0`
```sh
ln -s ../../../lib/arm-linux-gnueabihf/libpthread.so.0 libpthread.so
```
Please note that there might also be issues with some symlinks or libraries not being copied
properly. This has occured with files like `libc.so.6`. If there are linker issues at a later
stage, you can try to rerun `rsync` without `--safe-links` or copy the shared libraries or
symlinks manually from the Linux board to the sysroot with `scp`.
For example, you can copy `libc.so.6` from the Linux board to the sysroot with
the following command
```sh
scp <user_name>@<ip-address>:lib/arm-linux-gnueabihf/lib.so.6 <rootfs-path>/lib/arm-linux-gnueabihf
```
If there are issues with the cross-compilation process, manually copying these shared
libraries can help
```sh
scp <user_name>@<ip-address>:/usr/lib/arm-linux-gnueabihf/libc.so <rootfs_path>/usr/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/usr/lib/arm-linux-gnueabihf/libc.a <rootfs_path>/usr/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/usr/lib/arm-linux-gnueabihf/librt.a <rootfs_path>/usr/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/usr/lib/arm-linux-gnueabihf/librt.so <rootfs_path>/usr/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/librt.so.1 <rootfs_path>/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/libpthread.so.0 <rootfs_path>/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3 <rootfs_path>/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/libc.so.6 <rootfs_path>/lib/arm-linux-gnueabihf
```

View File

@ -126,20 +126,12 @@ toolchain binaries are added to the path accordingly.
rsync -vR --progress -rl --delete-after --safe-links pi@<ip-address>:/{lib,usr,opt/vc/lib} <rootfs-path>
```
Please note that there might be issues with some symlinks or libraries not being copied properly.
This has occured with files like `libc.so.6`. If there are linker issues at a later stage,
you can try to rerun `rsync` without the`--safe-links` flag or copy the shared libraries or
symlinks manually from the Raspberry Pi to the sysroot with `scp`.
For example, you can copy `libc.so.6` from the Raspberry Pi to the sysroot with
the following command
```sh
scp pi@<ip-address>:lib/arm-linux-gnueabihf/lib.so.6 <rootfs-path>/lib/arm-linux-gnueabihf
```
Please note that `rsync` sometimes does not copy shared libraries or symlinks properly,
which might result in errors when cross-compiling and cross-linking. See the
[troubleshooting](#troubleshooting) section for more details.
3. It is recommended to install `gdb-multiarch`. This tool will allow remote debugging
on the host computer. You don't need to do this if the TCF agent is used.
on the host computer. This step is not required if the `tcf-agent` is used.
```sh
sudo apt-get install gdb-multiarch
@ -202,45 +194,20 @@ toolchain binaries are added to the path accordingly.
```sh
rsync -vR --progress -rl --delete-after --safe-links pi@<ip-address>:/{lib,usr,opt/vc/lib} <rootfs-path>
```
Please note that `rsync` sometimes does not copy shared libraries or symlinks properly,
which might result in errors when cross-compiling and cross-linking. See the
[troubleshooting](#troubleshooting) section for more details.
5. There might be some issues with the pthread symbolic links. Navigate to the folder
containing the symlinks
```sh
cd /c/User/<UserName>/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf
```
Type `more libpthread`, press `TAB` and check whether the symbolic
link `libpthread.so` is shown. If it is not, we are going to set it up
manually to avoid issues when linking against `pthread` later.
Run the following command to create a symlink to `libpthread.so.0`
```sh
ln -s ../../../lib/arm-linux-gnueabihf/libpthread.so.0 libpthread.so
```
Please note that there might also be issues with some symlinks or libraries not being copied
properly. This has occured with files like `libc.so.6`. If there are linker issues at a later
stage, you can try to rerun `rsync` without `--safe-links` or copy the shared libraries or
symlinks manually from the Raspberry Pi to the sysroot with `scp`.
For example, you can copy `libc.so.6` from the Raspberry Pi to the sysroot with
the following command
```sh
scp pi@<ip-address>:lib/arm-linux-gnueabihf/lib.so.6 <rootfs-path>/lib/arm-linux-gnueabihf
```
6. It is recommended to install `gdb-multiarch`.
This tool will allow remote debugging on the host computer. Replace
`x86_64` with the correct processor architecture for other architectures.
5. It is recommended to install `gdb-multiarch`. This tool will allow remote debugging on the host
computer. Replace `x86_64` with the correct processor architecture for other architectures.
This is not required if the `tcf-agent` is used.
```sh
pacman -S mingw-w64-x86_64-gdb-multiarch
```
7. Perform the steps [in the following chapter](#cross-test) to build the
6. Perform the steps [in the following chapter](#cross-test) to build the
software for the Raspberry Pi and test it.
## <a id="cross-test"></a> Testing the cross-compilation
@ -372,3 +339,52 @@ from [this guide](https://wiki.eclipse.org/TCF/Raspberry_Pi)
The [Eclipse README](README-eclipse.md#top) specifies how to perform remote
debugging using the TCF agent.
# <a id="troubleshooting"></a> Troubleshooting
## Cloning Sysroot
There might be some issues with the pthread symbolic links.
Navigate to the folder containing the symlinks
```sh
cd /c/User/<UserName>/beaglebone/rootfs/usr/lib/arm-linux-gnueabihf
```
Type `more libpthread`, press `TAB` and check whether the symbolic
link `libpthread.so` is shown. If it is not, we are going to set it up
manually to avoid issues when linking against `pthread` later.
Run the following command to create a symlink to `libpthread.so.0`
```sh
ln -s ../../../lib/arm-linux-gnueabihf/libpthread.so.0 libpthread.so
```
Please note that there might also be issues with some symlinks or libraries not being copied
properly. This has occured with files like `libc.so.6`. If there are linker issues at a later
stage, you can try to rerun `rsync` without `--safe-links` or copy the shared libraries or
symlinks manually from the Linux board to the sysroot with `scp`.
For example, you can copy `libc.so.6` from the Linux board to the sysroot with
the following command
```sh
scp <user_name>@<ip-address>:lib/arm-linux-gnueabihf/lib.so.6 <rootfs-path>/lib/arm-linux-gnueabihf
```
If there are issues with the cross-compilation process, manually copying these shared
libraries can help
```sh
scp <user_name>@<ip-address>:/usr/lib/arm-linux-gnueabihf/libc.so <rootfs_path>/usr/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/usr/lib/arm-linux-gnueabihf/libc.a <rootfs_path>/usr/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/usr/lib/arm-linux-gnueabihf/librt.a <rootfs_path>/usr/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/usr/lib/arm-linux-gnueabihf/librt.so <rootfs_path>/usr/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/librt.so.1 <rootfs_path>/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/libpthread.so.0 <rootfs_path>/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3 <rootfs_path>/lib/arm-linux-gnueabihf
scp <user_name>@<ip-address>:/lib/arm-linux-gnueabihf/libc.so.6 <rootfs_path>/lib/arm-linux-gnueabihf
```