Skip to content

rustc 1.43.0-nightly (7760cd0fb 2020-02-19) static builds on alpine throw compiler error on building any orjson/maturin #69327

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

Closed
autumnjolitz opened this issue Feb 20, 2020 · 2 comments

Comments

@autumnjolitz
Copy link

autumnjolitz commented Feb 20, 2020

Rust compiler states this is a bug and should be reported, so I'm listening to the compiler 😂

I use orjson in an alpine environment for fast json parsing in python. Unfortunately, the latest release and its dependencies have learned how to provoke a bug in rustc! 😮

Output:

Building wheels for collected packages: orjson
  Created temporary directory: /tmp/pip-wheel-puew_nt4
  Destination directory: /tmp/pip-wheel-puew_nt4
  Building wheel for orjson (PEP 517): started
  Running command /usr/local/bin/python3 /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp7cas0fmw
     Compiling proc-macro2 v1.0.8
     Compiling unicode-xid v0.2.0
     Compiling syn v1.0.14
     Compiling cfg-if v0.1.10
     Compiling ryu v1.0.2
     Compiling libc v0.2.66
     Compiling serde v1.0.104
     Compiling memchr v2.3.2
     Compiling typenum v1.11.2
     Compiling getrandom v0.1.14
     Compiling lazy_static v1.4.0
     Compiling autocfg v1.0.0
     Compiling regex-syntax v0.6.14
     Compiling itoa v0.4.5
     Compiling bitflags v1.2.1
     Compiling byteorder v1.3.4
     Compiling lexical-core v0.7.4
     Compiling unindent v0.1.5
     Compiling ppv-lite86 v0.2.6
     Compiling version_check v0.9.1
     Compiling scopeguard v1.1.0
     Compiling packed_simd v0.3.3
     Compiling smallvec v1.2.0
     Compiling encoding_rs v0.8.22
     Compiling arrayvec v0.5.1
     Compiling stable_deref_trait v1.1.1
     Compiling static_assertions v1.1.0
     Compiling heapless v0.5.3
     Compiling rand_core v0.4.2
     Compiling associative-cache v1.0.1
     Compiling inlinable_string v0.1.11
     Compiling thread_local v1.0.1
     Compiling lock_api v0.3.3
     Compiling wyhash v0.3.0
     Compiling c2-chacha v0.2.3
     Compiling num-traits v0.2.11
     Compiling aho-corasick v0.7.8
     Compiling hash32 v0.1.1
     Compiling quote v1.0.2
     Compiling parking_lot_core v0.7.0
     Compiling rand_core v0.5.1
     Compiling generic-array v0.12.3
     Compiling generic-array v0.13.2
     Compiling parking_lot v0.10.0
     Compiling rand_chacha v0.2.1
     Compiling regex v1.3.4
     Compiling as-slice v0.1.3
     Compiling rand v0.7.3
     Compiling pyo3-derive-backend v0.9.0-alpha.1
  thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4
  stack backtrace:
     0: backtrace::backtrace::libunwind::trace
               at /cargo/registry/src/gh.loli.garden-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
     1: backtrace::backtrace::trace_unsynchronized
               at /cargo/registry/src/gh.loli.garden-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
     2: std::sys_common::backtrace::_print_fmt
               at src/libstd/sys_common/backtrace.rs:78
     3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
               at src/libstd/sys_common/backtrace.rs:59
     4: core::fmt::write
               at src/libcore/fmt/mod.rs:1052
     5: std::io::Write::write_fmt
               at src/libstd/io/mod.rs:1428
     6: std::sys_common::backtrace::_print
               at src/libstd/sys_common/backtrace.rs:62
     7: std::sys_common::backtrace::print
               at src/libstd/sys_common/backtrace.rs:49
     8: std::panicking::default_hook::{{closure}}
               at src/libstd/panicking.rs:204
     9: std::panicking::default_hook
               at src/libstd/panicking.rs:224
    10: rustc_driver::report_ice
    11: std::panicking::rust_panic_with_hook
               at src/libstd/panicking.rs:474
    12: std::panicking::begin_panic
    13: rustc_errors::HandlerInner::span_bug
    14: rustc_errors::Handler::span_bug
    15: rustc::util::bug::opt_span_bug_fmt::{{closure}}
    16: rustc::ty::context::tls::with_opt::{{closure}}
    17: rustc::ty::context::tls::with_opt
    18: rustc::util::bug::opt_span_bug_fmt
    19: rustc::util::bug::span_bug_fmt
    20: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
    21: rustc_codegen_ssa::mir::block::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_call_terminator
    22: rustc_codegen_ssa::mir::block::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_block
    23: rustc_codegen_ssa::base::codegen_instance
    24: <rustc::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define
    25: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
    26: rustc::dep_graph::graph::DepGraph::with_task
    27: rustc_codegen_llvm::base::compile_codegen_unit
    28: rustc_codegen_ssa::base::codegen_crate
    29: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
    30: rustc_session::utils::<impl rustc_session::session::Session>::time
    31: rustc_interface::passes::QueryContext::enter
    32: rustc_interface::queries::Queries::ongoing_codegen
    33: rustc_interface::interface::run_compiler_in_existing_thread_pool
    34: scoped_tls::ScopedKey<T>::set
    35: syntax::attr::with_globals
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

  note: the compiler unexpectedly panicked. this is a bug.

  note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

  note: rustc 1.43.0-nightly (7760cd0fb 2020-02-19) running on x86_64-unknown-linux-musl

  note: compiler flags: -C opt-level=3 -C panic=abort -C codegen-units=1 -C target-feature=-crt-static --crate-type lib

  note: some of the compiler flags provided by cargo are hidden

  query stack during panic:
  end of query stack
  error: could not compile `encoding_rs`.

  To learn more, run the command again with --verbose.
  warning: build failed, waiting for other jobs to finish...
  error: build failed
  💥 maturin failed
    Caused by: Failed to build a native library through cargo
    Caused by: Cargo build finished with "exit code: 101": `cargo rustc --message-format json --manifest-path Cargo.toml --lib --release -- -Zmutable-noalias -C target-feature=+sse2 -C link-arg=-s`
  Running `maturin pep517 build-wheel -i python --manylinux=off --rustc-extra-args=-Zmutable-noalias -C target-feature=+sse2 --strip=on`
  Error: Command '['maturin', 'pep517', 'build-wheel', '-i', 'python', '--manylinux=off', '--rustc-extra-args=-Zmutable-noalias -C target-feature=+sse2', '--strip=on']' returned non-zero exit status 1.
  Building wheel for orjson (PEP 517): finished with status 'error'
  ERROR: Failed building wheel for orjson

Here's how I caused it (I use osx as a main development machine so all my linux builds are through docker 🙃

Dockerfile:

FROM python:3.7-alpine
ENV PIP_NO_CACHE_DIR=off \
    PIP_DISABLE_PIP_VERSION_CHECK=on \
    RUSTUP_HOME=/usr/local \
    CARGO_HOME=/usr/local \
    RUSTFLAGS="-C target-feature=-crt-static" \
    RUST_BACKTRACE=1
RUN apk add --no-cache build-base libffi-dev openssl-dev curl && \
    (curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path) && rustup install nightly && rustup default nightly && \
    python3 -m ensurepip && \
    pip3 install --upgrade pip setuptools wheel && \
    if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi
RUN python3 -m pip install --verbose orjson

Trigger the build via: docker build -f Dockerfile . and watch it explode

Just tried an earlier orjson. Same error 😳

@autumnjolitz autumnjolitz changed the title rustc 1.43.0-nightly (7760cd0fb 2020-02-19) static builds on alpine throw compiler error on building latest orjson/maturin rustc 1.43.0-nightly (7760cd0fb 2020-02-19) static builds on alpine throw compiler error on building any orjson/maturin Feb 20, 2020
@ijl
Copy link

ijl commented Feb 20, 2020

This is a duplicate of #69313.

@jonas-schievink
Copy link
Contributor

Closing as a duplicate then. Thanks for the report!

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