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

rustbuild misses -pthread on final link #39215

Closed
ishitatsuyuki opened this issue Jan 21, 2017 · 8 comments
Closed

rustbuild misses -pthread on final link #39215

ishitatsuyuki opened this issue Jan 21, 2017 · 8 comments
Labels
T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@ishitatsuyuki
Copy link
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"
@alexcrichton
Copy link
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
Copy link
Contributor Author

Arch amd64, with the provided compilation flags.

@ishitatsuyuki
Copy link
Contributor Author

@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
Copy link
Member

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

@ishitatsuyuki
Copy link
Contributor Author

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

@ishitatsuyuki
Copy link
Contributor Author

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.

@frewsxcv frewsxcv added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Feb 2, 2017
@ishitatsuyuki
Copy link
Contributor Author

https://github.com/rust-lang/rust/blob/master/mk/cfg/x86_64-unknown-linux-gnu.mk#L13

@alexcrichton This is not by luck, this is intended in the old buildsystem.

@tamird
Copy link
Contributor

tamird commented Feb 4, 2017

829b5de

frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 5, 2017
liballoc_jemalloc: fix linking with system library

Fix rust-lang#39215
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 5, 2017
liballoc_jemalloc: fix linking with system library

Fix rust-lang#39215
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 5, 2017
liballoc_jemalloc: fix linking with system library

Fix rust-lang#39215
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

5 participants