Skip to content

undefined reference to `pthread_create' #1596

Open
@thewh1teagle

Description

Checklist

Describe your issue

I'm trying to compile the crate espeak-rs-sys with cross for linux arm64 but it failed with this error:

  [ 95%] Linking CXX executable espeak-ng

  --- stderr
  Failed to run rustfmt: cannot find binary path (non-fatal, continuing)
  make: warning: -j8 forced in submake: resetting jobserver mode.
  /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: libespeak-ng/libespeak-ng.a(event.c.o): in function `event_init':
  event.c:(.text.event_init+0xd0): undefined reference to `pthread_create'
  /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: libespeak-ng/libespeak-ng.a(event.c.o): in function `event_terminate':
  event.c:(.text.event_terminate+0x60): undefined reference to `pthread_join'
  /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: libespeak-ng/libespeak-ng.a(fifo.c.o): in function `fifo_init':
  fifo.c:(.text.fifo_init+0x1d0): undefined reference to `pthread_create'
  /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: libespeak-ng/libespeak-ng.a(fifo.c.o): in function `fifo_terminate':
  fifo.c:(.text.fifo_terminate+0x70): undefined reference to `pthread_join'
  collect2: error: ld returned 1 exit status
  make[2]: *** [src/CMakeFiles/espeak-ng-bin.dir/build.make:100: src/espeak-ng] Error 1
  make[1]: *** [CMakeFiles/Makefile2:940: src/CMakeFiles/espeak-ng-bin.dir/all] Error 2
  make: *** [Makefile:166: all] Error 2
  thread 'main' panicked at /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.51/src/lib.rs:1100:5:

  command did not execute successfully, got: exit status: 2

  build script failed, must exit now
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

cross config:
https://github.com/thewh1teagle/piper-rs/blob/5191355716a2818913381e01d8a8ac8e7d3b6525/Cargo.toml#L34-L39

What target(s) are you cross-compiling for?

aarch64-unknown-linux-gnu

Which operating system is the host (e.g computer cross is on) running?

  • macOS
  • Windows
  • Linux / BSD
  • other OS (specify in description)

What architecture is the host?

  • x86_64 / AMD64
  • arm32
  • arm64 (including Mac M1)

What container engine is cross using?

  • docker
  • podman
  • other container engine (specify in description)

cross version

cross 0.2.5 (4090bec 2024-10-15)

Example

git clone --recursive --branch feat/linux-arm64 https://github.com/thewh1teagle/piper-rs
cd piper-rs
cross build --no-default-features -p espeak-rs-sys --target aarch64-unknown-linux-gnu

Additional information / notes

it builds in thewh1teagle/piper-rs#5 manually on ubuntu 22.04 x64
Also in Dockerfile.linux.arm64

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions