libhv icon indicating copy to clipboard operation
libhv copied to clipboard

Cross compile with OpenSSL

Open frbitten opened this issue 1 year ago • 4 comments

Hi I'm trying to cross-compile for arm64 with OpenSSL. When using cmake, findpackage searches for OpenSSL from x86 and not from the toolchain.

When compiling, the error below is generated because it uses OpenSSL from x86_64-linux-gnu

In file included from /usr/include/openssl/ssl.h:21, from /home/bitten/libhv/ssl/openssl.c:5:
/usr/include/openssl/macros.h:14:10: fatal error: openssl/opensslconf.h: No such file or directory
   14 | #include <openssl/opensslconf.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~

Has anyone tried compiling in this scenario?

Thanks

frbitten avatar Jul 28 '24 17:07 frbitten

Try cmake -DOPENSSL_ROOT_DIR=/path/to/openssl

ithewei avatar Jul 29 '24 15:07 ithewei

I don't have a path where OpenSSh is located. The sysroot has the folders /usr/include and /usr/lib that contain the information for cross-compilation.

That's why -DOPENSSL_ROOT_DIR can't be set. And setting it as /usr doesn't work.

frbitten avatar Jul 30 '24 13:07 frbitten

First of all, you need to have a compiled openssl library of arm64 version locally, otherwise how can you find and link openssl libraries?

ithewei avatar Jul 31 '24 14:07 ithewei

I have openssl compiled in ARM64 because the sysroot variable of the toolchain points to a folder with the same structure as the OS but with all the ARM64 version libraries.

frbitten avatar Aug 02 '24 09:08 frbitten