install package (library) for crosscompiler

Viewed 203

I would like to

  • use the crosscompiler gcc-aarch64-linux-gnu to build a binary
  • link a precompiled library (e.g. libxml2.so/libxml2.a) to that binary
  • use cmake

I thought of the following way to achieve the above:

  1. creating a sysroot folder (is this the correct term?)
  2. downloading the library by apt-get download libxml2-dev:arm64
  3. "installing" the package into the sysroot folder by dpkg-deb -x libxml2_*_arm64.deb ./sysroot/
  4. declaring the sysroot folder in CMAKE_FIND_ROOT_PATH
  5. using find_package() in cmake to locate the library in sysroot

Question: Is the way above a good one? Is there a better one? I am surely not the first one facing that problem, therefore I think there might be a better way.

0 Answers
Related