rapiz1 / rathole

A lightweight and high-performance reverse proxy for NAT traversal, written in Rust. An alternative to frp and ngrok.
Apache License 2.0
9.8k stars 488 forks source link

release里面下载的文件运行不了 #164

Closed fyhong closed 2 years ago

fyhong commented 2 years ago

mtk7620的路由器运行mipsel-unknown-linux-musl的会提示找不到文件

root@Hiwifi:/tmp/storage/mmcblk0# ./rathole -h -ash: ./rathole: not found

rapiz1 commented 2 years ago

这种情况你需要先确认路由器上是用的哪个libc和其版本。 一般是libc不匹配(glibc/muslc用混)或者libc版本过旧导致的。

fyhong commented 2 years ago

怎样确认

fyhong commented 2 years ago

我尝试用rust-cross-musl的docker来重新编译,但编译不成功

Compiling openssl-sys v0.9.73 error: failed to run custom build command for openssl-sys v0.9.73

Caused by: process didn't exit successfully: /home/rust/src/target/release/build/openssl-sys-f9a53358ecf798de/build-script-main (exit status: 101) --- stdout cargo:rustc-cfg=const_fn cargo:rerun-if-env-changed=MIPSEL_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR MIPSEL_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=OPENSSL_LIB_DIR OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=MIPSEL_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR MIPSEL_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=MIPSEL_UNKNOWN_LINUX_MUSL_OPENSSL_DIR MIPSEL_UNKNOWN_LINUX_MUSL_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_ALLOW_CROSS_mipsel-unknown-linux-musl cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_mipsel_unknown_linux_musl cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS cargo:rerun-if-env-changed=PKG_CONFIG_mipsel-unknown-linux-musl cargo:rerun-if-env-changed=PKG_CONFIG_mipsel_unknown_linux_musl cargo:rerun-if-env-changed=TARGET_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_mipsel-unknown-linux-musl cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_mipsel_unknown_linux_musl cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR run pkg_config fail: "pkg-config has not been configured to support cross-compilation.\n\nInstall a sysroot for the target platform and configure it via\nPKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\ncross-compiling wrapper for pkg-config and set it via\nPKG_CONFIG environment variable."

--- stderr thread 'main' panicked at '

Could not find directory of OpenSSL installation, and this -sys crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set the OPENSSL_DIR environment variable for the compilation process.

Make sure you also have the development packages of openssl installed. For example, libssl-dev on Ubuntu or openssl-devel on Fedora.

If you're in a situation where you think the directory should be found automatically, please open a bug at https://github.com/sfackler/rust-openssl and include information about your system as well as this message.

$HOST = x86_64-unknown-linux-gnu $TARGET = mipsel-unknown-linux-musl openssl-sys = 0.9.73

', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.73/build/find_normal.rs:191:5 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace warning: build failed, waiting for other jobs to finish...

rapiz1 commented 2 years ago

怎样确认

没有通用的方法,和你的发行版有关。一般是检查/usr/lib/,/lib这些目录下带有libc字样的相关文件。

如果 release 中提供的二进制运行不了的话,首先尝试升级libc到最新版本。如果不行,则可能需要你的发行版的sdk来编译,或者交叉编译到一个更第低的libc版本。

我尝试用rust-cross-musl的docker来重新编译,但编译不成功

提示的意思是缺少依赖 openssl。交叉编译很难处理这个依赖。可以尝试添加编译选项 --no-default-features --features client,server 关闭 tls 功能

CosmicSnow commented 2 years ago

我尝试用rust-cross-musl的docker来重新编译,但编译不成功

Compiling openssl-sys v0.9.73 error: failed to run custom build command for openssl-sys v0.9.73

Caused by: process didn't exit successfully: /home/rust/src/target/release/build/openssl-sys-f9a53358ecf798de/build-script-main (exit status: 101) --- stdout cargo:rustc-cfg=const_fn cargo:rerun-if-env-changed=MIPSEL_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR MIPSEL_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=OPENSSL_LIB_DIR OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=MIPSEL_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR MIPSEL_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=MIPSEL_UNKNOWN_LINUX_MUSL_OPENSSL_DIR MIPSEL_UNKNOWN_LINUX_MUSL_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_ALLOW_CROSS_mipsel-unknown-linux-musl cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_mipsel_unknown_linux_musl cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS cargo:rerun-if-env-changed=PKG_CONFIG_mipsel-unknown-linux-musl cargo:rerun-if-env-changed=PKG_CONFIG_mipsel_unknown_linux_musl cargo:rerun-if-env-changed=TARGET_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_mipsel-unknown-linux-musl cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_mipsel_unknown_linux_musl cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR run pkg_config fail: "pkg-config has not been configured to support cross-compilation.\n\nInstall a sysroot for the target platform and configure it via\nPKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\ncross-compiling wrapper for pkg-config and set it via\nPKG_CONFIG environment variable."

--- stderr thread 'main' panicked at '

Could not find directory of OpenSSL installation, and this -sys crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set the OPENSSL_DIR environment variable for the compilation process.

Make sure you also have the development packages of openssl installed. For example, libssl-dev on Ubuntu or openssl-devel on Fedora.

If you're in a situation where you think the directory should be found automatically, please open a bug at https://github.com/sfackler/rust-openssl and include information about your system as well as this message.

$HOST = x86_64-unknown-linux-gnu $TARGET = mipsel-unknown-linux-musl openssl-sys = 0.9.73

', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.73/build/find_normal.rs:191:5 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace warning: build failed, waiting for other jobs to finish...

HI!

I found the solution by installing some packages, but, I am using Oracle ARM64, with ubuntu. My problem was the OpenSSL installation not found.

just install the necessary packages with: apt install pkg-config libssl-dev

an retry the build. It built with no problems for me after installing these. Best luck!