Skip to content

rustbuild misses -pthread on final link #39215

Closed
@ishitatsuyuki

Description

@ishitatsuyuki
Contributor

Logs available at https://paste.rs/M2c

    ./configure \
        --prefix=/usr \
        --enable-ninja \
        --llvm-root=/usr \
        --disable-codegen-tests \
        --jemalloc-root=/usr/lib/libjemalloc_pic.a
# BROKEN: https://github.com/rust-lang/rust/issues/35349
#        --jemalloc-root=/usr/lib/

    export RUSTFLAGS="$RUSTFLAGS -C link-args=-lffi"
    export CFLAGS="$CFLAGS -fPIC -w"

Activity

alexcrichton

alexcrichton commented on Jan 22, 2017

@alexcrichton
Member

This is typically the reponsibility of the standard library but I don't see -lpthread in the output at all... odd! What system are you on? (to help in reproducing this)

ishitatsuyuki

ishitatsuyuki commented on Jan 22, 2017

@ishitatsuyuki
ContributorAuthor

Arch amd64, with the provided compilation flags.

ishitatsuyuki

ishitatsuyuki commented on Jan 29, 2017

@ishitatsuyuki
ContributorAuthor

@alexcrichton: "-l pthread" is passed but possibly somehow truncated in the log. Sorry for the inconvenience.

Back to the topic, you're passing -lpthread(wrong), not -pthread(correct).

sfackler

sfackler commented on Jan 29, 2017

@sfackler
Member

IIRC -pthread only differs from -lpthread by changing configuration for the macro processor which is not relevant when linking.

ishitatsuyuki

ishitatsuyuki commented on Jan 30, 2017

@ishitatsuyuki
ContributorAuthor

@sfackler: -pthread is not passed even when compiling, causing it referencing to undefined symbols.

ishitatsuyuki

ishitatsuyuki commented on Jan 30, 2017

@ishitatsuyuki
ContributorAuthor

There's two way to achieve this:

  1. Allow arbitrary flags in cargo:rustc-flags to add -pthread.
  2. Refactor and add it in the gcc crate.
added
T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
on Feb 2, 2017
ishitatsuyuki

ishitatsuyuki commented on Feb 3, 2017

@ishitatsuyuki
ContributorAuthor
tamird

tamird commented on Feb 4, 2017

@tamird
Contributor
added 3 commits that reference this issue on Feb 5, 2017

Rollup merge of rust-lang#39481 - ishitatsuyuki:master, r=alexcrichton

3621ff4

Rollup merge of rust-lang#39481 - ishitatsuyuki:master, r=alexcrichton

628f1a6

Rollup merge of rust-lang#39481 - ishitatsuyuki:master, r=alexcrichton

d021a3f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @alexcrichton@frewsxcv@sfackler@tamird@ishitatsuyuki

        Issue actions

          rustbuild misses -pthread on final link · Issue #39215 · rust-lang/rust