zerotier / zeronsd

A DNS server for ZeroTier users
https://zerotier.com
BSD 3-Clause "New" or "Revised" License
493 stars 57 forks source link

Cross Compiling suggestion #162

Closed daoudeddy closed 2 years ago

daoudeddy commented 2 years ago

The issue:

I've been working on a project of mine for Home Assistant when I encountered a problem with cross compiling ZeroNS caused by openssl not found for cpu architecture other than the host

The fix:

Maybe this is my first time building a rust project, the way I fixed it is by adding to the dependencies

openssl = { version = "0.10.38", features = ["vendored"] } build successed and tested on Ubuntu amd64 for Alpine amd64

Is it something you can implement it in this project?

erikh commented 2 years ago

Hmm. Not sure how well this'll work with the different packages, but I'm willing to try it out!

daoudeddy commented 2 years ago

Okay thank you

erikh commented 2 years ago

I think you misunderstood me. Let's try it, see how it works. I'll report back here once I have. Let's leave this open until I do.

erikh commented 2 years ago

Please note this didn't work as well as I'd hoped: #177 resolves some issues with this. You'll need to use this method to install zeronsd on your hosts. Hope it helps!

daoudeddy commented 2 years ago

Thats a great news, I'll test it in my project and report back, thank you again.

Edit: Working perfectly, thank you

daoudeddy commented 2 years ago

Cross compile re-broke after version 0.5 with the same error as before the fix you implemented while running

cargo build --features vendored-openssl

With the following error:

failed to run custom build command for 'openssl-sys v0.9.73' Caused by: process didn't exit successfully:'/target/release/build/openssl-sys-79a29d2c768cb8be/build-script-main' (exit status: 101) --- stdout cargo:rustc-cfg=const_fn cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=OPENSSL_LIB_DIR OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset cargo:rerun-if-env-changed=OPENSSL_DIR OPENSSL_DIR unset cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG cargo:rerun-if-env-changed=OPENSSL_STATIC cargo:rerun-if-env-changed=OPENSSL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH cargo:rerun-if-env-changed=PKG_CONFIG_PATH cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR run pkg_config fail: "\"pkg-config\" \"--libs\" \"--cflags\" \"openssl\" did not exit successfully: exit status: 1\nerror: could not find system library 'openssl' required by the 'openssl-sys' crate\n\n--- stderr\nPackage openssl was not found in the pkg-config search path.\nPerhaps you should add the directory containing 'openssl.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'openssl' found\n"'