Skip to content

[Bug] Unable to build on musl platforms #499

@gmartin82

Description

@gmartin82

Describe the bug

Cross-building for musl targets currently fails due to a link issue with the cyclors crate.

  error: linking with `x86_64-linux-musl-gcc` failed: exit status: 1
    |
    = note: LC_ALL="C" PATH="/rust/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/rust/bin" VSLANG="1033" "x86_64-linux-musl-gcc" "-m64" "/tmp/rustcbv9cCJ/symbols.o" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/tmp/rustcbv9cCJ/{libblake3-29c15492f95584c6.rlib,libcyclors-02cc33282643057d.rlib,libring-4af89ca913ab372c.rlib}" "/rust/lib/rustlib/x86_64-unknown-linux-musl/lib/{libcompiler_builtins-cc81168744dff734.rlib}" "-Wl,-Bdynamic" "-ldl" "-lgcc_s" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/target/x86_64-unknown-linux-musl/release/build/ring-0daefb7cc7709f2f/out" "-L" "/target/x86_64-unknown-linux-musl/release/build/cyclors-0b50ece9ad445532/out/cyclonedds-build/lib" "-L" "/target/x86_64-unknown-linux-musl/release/build/cyclors-0b50ece9ad445532/out/cyclocut-build/lib" "-L" "/target/x86_64-unknown-linux-musl/release/build/blake3-146c55510a96ff3f/out" "-L" "/target/x86_64-unknown-linux-musl/release/build/blake3-146c55510a96ff3f/out" "-L" "/rust/lib/rustlib/x86_64-unknown-linux-musl/lib" "-o" "/target/x86_64-unknown-linux-musl/release/deps/zenoh_bridge_dds-f58a172aefd7a6f0" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-debug" "-nodefaultlibs"
    = note: some arguments are omitted. use `--verbose` to show all linker arguments
    = note: /usr/local/bin/../lib/gcc/x86_64-linux-musl/9.2.0/../../../../x86_64-linux-musl/bin/ld: /tmp/rustcbv9cCJ/libcyclors-02cc33282643057d.rlib(threads.c.o): in function `ddsrt_thread_create':
            threads.c:(.text.ddsrt_thread_create+0x126): undefined reference to `pthread_attr_setaffinity_np'
            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#rustc-link-lib)
  
  error: could not compile `zenoh-bridge-dds` (bin "zenoh-bridge-dds") due to 1 previous error

To reproduce

  1. Run cross build --target x86_64-unknown-linux-musl

System info

  • Platform: Ubuntu 24.04
  • Target: x86_64-unknown-linux-musl

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions