0

I am trying to compile GNU's ccRTP library to be used in an ARM environment (Android on mobile) with the following command

./configure --host=arm-linux-gnueabi && make

And I get the following error:

configure: error: libgcrypt headers not found.

When I remove the --host=arm-linux-gnueabi argument from the call I am able to compile the library with no issues. This makes perfect sense as I have already installed all the necessary packages to build on x86_64 architecture, but not for ARM architecture.

My assumption at this time is that, for me to get libccrtp.so compiled for the arm target environment I will need to also compile every one of its dependencies, since using

apt search gcrypt:arm

Returns no matches. This seems like an overkill approach and hopefully not the only one, as the list of dependencies is likely to grow with each library dependency I seek to compile.

So the question: is there a way to cross-compile a library without having to manually compile every dependency?

Thanks in advance. -Nick

  • 2
    Short answer: no there isn't. – Sam Varshavchik May 16 '21 at 01:33
  • I would have thought compiling would be fine, but I can't see how linking could ever work. And if you're using Autotools I don't know if you can compile without linking. So you might have to build your own Makefile if compiling is enough. – Galik May 16 '21 at 01:42
  • 1
    May be `vcpkg` can save you: https://stackoverflow.com/questions/58777810/how-to-integrate-vcpkg-in-linux-with-cross-build-toolchain-as-well-as-sysroot – prehistoricpenguin May 16 '21 at 01:44
  • I suppose you could simplify the question to "is there a way to **compile** a library without having to manually compile every dependency?" A key difference is that binaries for a different architecture are less likely to have been previously installed than native binaries. *...Hmm... or maybe the question is if there is a way to use a library for a platform other than the one for which it was compiled, negating the need for cross-compiling?* – JaMiT May 16 '21 at 02:02
  • I don't think that search works. `libgcrypt20-dev` is available for `arm64` and `armhf`. Maybe try `apt search gcrypt | grep arm` or `aptitude search '~n gcrypt ~r armhf'` – mkayaalp May 16 '21 at 02:09
  • Never mind, I just saw that it is Android, and not Debian/Ubuntu. – mkayaalp May 16 '21 at 02:13
  • @Galik Don't I _need_ to link them in order to use the library? – UndergroundCoding May 16 '21 at 02:32
  • @JaMiT are you suggesting I look for the libraries already built for the specified architecture? If so, I have already done that with no success. Do you have any suggestions on where I might find them? – UndergroundCoding May 16 '21 at 02:39
  • @UndergroundCoding Yes, but I don't know exactly what your needs are. It might have - for example - been possible to speed up part of the development process if you could perform part of it on a powerful development machine before having to transfer the compiled objects to a low powered device for linking and running. – Galik May 16 '21 at 02:39
  • 1
    @UndergroundCoding I'm suggesting that if you had not been able to find the dependencies already built for your native architecture, then you would have had to manually compile each of them when compiling your library for your native architecture. Cross-compiling is no different in this regard. – JaMiT May 16 '21 at 02:59

0 Answers0