0

I am using arm-linux-gnueabihf-gcc compiler toolchain for RaspberryPi from http://gnutoolchains.com/raspberry/

It is based on MinGW (as I understood from its documentation). It is installed with sysroot copy from Raspbian with libraries and headers.

Question: How to setup a sysroot folder (e.g. using env variable) for this toolset?

enter image description here

For example, when doing flags.make contains:

C_INCLUDES = -I/opt/vc/include 

This folder is accessible at C:\SysGC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include.

Toolset binaries are installed in C:\SysGC\raspberry\arm-linux-gnueabihf\bin\ (accessible via %PATH%).

But compiler and linker doesnt look for libraries and headers in that sysroot folder.

I can still pass full windows host path for cmake but it will be more elegant and convenient to set it up once and keep original cmake configuration.

I tried do something like

set SYSROOT=C:\SysGC\raspberry\arm-linux-gnueabihf\sysroot

but it does not work. gcc compilers has option --sysroot but that does not seem to be passed correctly via cmake/make toolchain.

Any advice, please?

Pawel
  • 900
  • 2
  • 10
  • 19
  • Shouldn't the folder be called `sys-root` instead of sysroot? – ssbssa Jul 30 '18 at 10:24
  • This is how the original installer named it. I can try change it according to your suggestion. – Pawel Jul 30 '18 at 10:26
  • I tried. The name is correct. After changing it to 'sys-root' the toolset could not found the 'stdio.h' header (it's in \usr\include) – Pawel Jul 31 '18 at 09:20
  • Can you try compiling a simple application with `-v`, it should tell you what include and library paths are used/searched. – ssbssa Jul 31 '18 at 10:18
  • I played with that option, thanks. The compiler used is `arm-linux-gnueabihf-g++`. The cmake generates include options in a format `-I/opt/vc/include`. Provided like this makes compiler to look for nonexisting path _/opt/vc/include_. If provided like `-I=/opt/vc/include` the compiler looks correctly in the host sysroot. – Pawel Aug 02 '18 at 15:15
  • How can I made cmake generating include options like `-I=/opt/include/` instead of `-I/opt/include`? – Pawel Aug 02 '18 at 15:31
  • I'm not completely sure, are you looking for something like [this](https://stackoverflow.com/a/24304959/1983398)? – ssbssa Aug 02 '18 at 18:12

0 Answers0