The fundamental problem is that you're using the same folder for the compiler prefix and the sysroot. This does not work, files for the host and the target do not belong in the same directory. A sysroot should contain only libraries, startup files etc. for the target. Common conventions are to use prefix/arm-linux-gnueabihf or prefix/arm-linux-gnueabihf/sysroot for the sysroot. You'll need to re-build your toolchains to fix this.
The sysroot always points to the root of the target filesystem, not to /usr. If you try to point the CMAKE_SYSROOT variable to /usr, the system libraries and start files won't be located correctly.
Moreover, you generally should not install other packages into the sysroot, you use a "staging" directory for those instead. You can specify this using e.g. CMAKE_STAGING_PREFIX. When installing your package to the RPi, you then only install the files in the staging directory, you don't want to install any system libraries from the sysroot, those should already be present on the Pi. To prevent modification of the sysroot and other parts of the toolchain, it is common to make the entire toolchain folder read-only (chmod -R a-w path/to/toolchain).
Finally, if you have a lot of dependencies, you may want to use a package manager such as Conan instead of building them all manually.
The sysroot always points to the root of the target filesystem, not to /usr. If you try to point the CMAKE_SYSROOT variable to /usr, the system libraries and start files won't be located correctly.
Moreover, you generally should not install other packages into the sysroot, you use a "staging" directory for those instead. You can specify this using e.g. CMAKE_STAGING_PREFIX. When installing your package to the RPi, you then only install the files in the staging directory, you don't want to install any system libraries from the sysroot, those should already be present on the Pi. To prevent modification of the sysroot and other parts of the toolchain, it is common to make the entire toolchain folder read-only (chmod -R a-w path/to/toolchain).
Finally, if you have a lot of dependencies, you may want to use a package manager such as Conan instead of building them all manually.
Statistics: Posted by tttapa — Sun Nov 03, 2024 11:09 am