Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fuse-rs cannot build with target x86_64-unknown-linux-musl #161

Open
teawater opened this issue Apr 6, 2022 · 2 comments
Open

fuse-rs cannot build with target x86_64-unknown-linux-musl #161

teawater opened this issue Apr 6, 2022 · 2 comments

Comments

@teawater
Copy link

teawater commented Apr 6, 2022

With target x86_64-unknown-linux-musl

cargo build --jobs 10 --examples --target x86_64-unknown-linux-musl
   Compiling fuse-sys v0.4.0-dev (/home/teawater/fuse-rs/fuse-sys)
   Compiling regex v1.5.5
error: failed to run custom build command for `fuse-sys v0.4.0-dev (/home/teawater/fuse-rs/fuse-sys)`

Caused by:
  process didn't exit successfully: `/home/teawater/fuse-rs/target/debug/build/fuse-sys-b1102c79a2fb4df4/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=FUSE_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_x86_64_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_x86_64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_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_x86_64-unknown-linux-musl
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_musl
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  pkg-config has not been configured to support cross-compilation.

  Install a sysroot for the target platform and configure it via
  PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a
  cross-compiling wrapper for pkg-config and set it via
  PKG_CONFIG environment variable.
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ()', fuse-sys/build.rs:12:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

Without x86_64-unknown-linux-musl can build.

cargo build --jobs 10 --examples
   Compiling cfg-if v1.0.0
   Compiling quick-error v1.2.3
   Compiling regex-syntax v0.6.25
   Compiling thread-scoped v1.0.2
   Compiling fuse-abi v0.4.0-dev (/home/teawater/fuse-rs/fuse-abi)
   Compiling termcolor v1.1.3
   Compiling libc v0.2.121
   Compiling memchr v2.4.1
   Compiling log v0.4.16
   Compiling fuse-sys v0.4.0-dev (/home/teawater/fuse-rs/fuse-sys)
   Compiling humantime v1.3.0
   Compiling aho-corasick v0.7.18
   Compiling atty v0.2.14
   Compiling fuse v0.4.0-dev (/home/teawater/fuse-rs)
   Compiling regex v1.5.5
   Compiling env_logger v0.6.2
    Finished dev [unoptimized + debuginfo] target(s) in 6.31s
@Xuanwo
Copy link

Xuanwo commented May 4, 2022

Please set env: PKG_CONFIG_ALLOW_CROSS=1

@famz
Copy link

famz commented Dec 23, 2022

The lib can build with PKG_CONFIG_ALLOW_CROSS=1 set, but I have a link error:

  = note: "cc" "-m64" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/rcrt1.o" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crti.o" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtbeginS.o" "/tmp/rustc2Ik28f/symbols.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.18d7d8pz9mq9djva.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.1h3em126u5obk6c9.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.1k9rlzvzui81uzzy.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.1z1uisrt21k44r5i.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.23loediq03seq2ov.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.26b9al7v0nq43yvh.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.2ff33lx3ktepylli.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.2g7rsggatot65bao.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.2iq2e2ykv108tbd9.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.2qwhd0bskklq2rfl.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.36qmki34ro70c20h.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.3hxlfk6nwtfglt1z.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.3igu6qis06d5xvz0.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.3izfesopnck12kzl.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.3j4a9okamsrzt46b.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.3nqp38tfrqry3yys.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.3uiazbaafp9ojzrd.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.43p16cntq8pqhcux.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.46ee5gnndjty7gpw.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.4823km4gu448x4xm.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.49w0e52xqbmm182o.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.4daola7dfof5qrkz.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.4ivph1mq2q8y7yee.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.4ked6e0771dxwu3d.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.4uvotqzmusejsh2t.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.4uwxdbzxsr3josnq.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.52brxao47gmv13q8.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.52iegm9gsfb3vga0.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.52t60y1phh2x15vf.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.58adi2a2h78hswts.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.5cmjkjomb9lvf4h9.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.5cva3bv4msr33l1z.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.6lbfkky6kd70vve.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.j8e694vrmo4qyxc.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.l4lhu6cn6vach56.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.o2ru8qyeyaobjun.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.x0ooplm0qqr1zua.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.xdwbgbrsq66gpwy.rcgu.o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b.5bsd91ddl4frjhpr.rcgu.o" "-Wl,--as-needed" "-L" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps" "-L" "/home/fam/src/cassia/efused/target/debug/deps" "-L" "/usr/lib/x86_64-linux-gnu" "-L" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/libfuse-b6b3fdf6e7a886b7.rlib" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/libthread_scoped-6ce18bec8f7a30d5.rlib" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/liblog-b64e542dca7df01c.rlib" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/libcfg_if-e9302419824021d9.rlib" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/libfuse_sys-ae0f5e53cb387c77.rlib" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/libfuse_abi-88e01912041fd48a.rlib" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/liblibc-89426c4259882705.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-dd72223b9d53f0d3.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-74b4388f60f323df.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libobject-b64562206e8b8c08.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libmemchr-59dc3350c65ec3d1.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libaddr2line-4f67e8862fa0e329.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libgimli-364f22b05c7e89fa.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_demangle-4f16bb484d771bf4.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd_detect-2352afce7d18a4c3.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libcfg_if-349ddeef5dc70ada.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libhashbrown-e4fefbea61ed5f5f.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libminiz_oxide-7490af1cc8ac0fa3.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libadler-ce7363c87f2dd801.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_alloc-51b2a570aa0a2601.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-3c1b6bc94e3089f6.rlib" "-lunwind" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libcfg_if-f1db3cccdee749da.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-9fa9ee5bbebb767f.rlib" "-lc" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-0d873ef1f248a1f3.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_core-f1818df12a324b46.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-76930f0ff19494f5.rlib" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-be4ea8801358b306.rlib" "-Wl,-Bdynamic" "-lfuse" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-nostartfiles" "-L" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib" "-L" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained" "-o" "/home/fam/src/cassia/efused/target/x86_64-unknown-linux-musl/debug/deps/efused-94ef31dc00cca65b" "-Wl,--gc-sections" "-static-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtendS.o" "/home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtn.o"
  = note: /usr/bin/ld: /home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-dd72223b9d53f0d3.rlib(std-dd72223b9d53f0d3.std.a5fc7cf8-cgu.0.rcgu.o): in function `std::sys::unix::os::home_dir::fallback':
          /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys/unix/os.rs:626: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
          /usr/bin/ld: /home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-dd72223b9d53f0d3.rlib(std-dd72223b9d53f0d3.std.a5fc7cf8-cgu.0.rcgu.o): in function `<std::sys_common::net::LookupHost as core::convert::TryFrom<(&str,u16)>>::try_from::{{closure}}':
          /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/net.rs:206: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
          /usr/bin/ld: /home/fam/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-dd72223b9d53f0d3.rlib(std-dd72223b9d53f0d3.std.a5fc7cf8-cgu.0.rcgu.o): undefined reference to symbol '__tls_get_addr@@GLIBC_2.3'
          /usr/bin/ld: /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2: error adding symbols: DSO missing from command line
          collect2: error: ld returned 1 exit status

  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

I think the issue lies around "-Wl,-Bdynamic" "-lfuse" but even setting fuse_STATIC=1 doesn't help. My cargo command line is:

PKG_CONFIG_ALL_STATIC=1 fuse_STATIC=1 PKG_CONFIG_ALLOW_CROSS=1 cargo build --target=x86_64-unknown-linux-musl -vv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants