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

Error on install: "subslice patterns are unstable" #323

Closed
zdb999 opened this issue Jan 23, 2021 · 10 comments
Closed

Error on install: "subslice patterns are unstable" #323

zdb999 opened this issue Jan 23, 2021 · 10 comments

Comments

@zdb999
Copy link

zdb999 commented Jan 23, 2021

Hi,

I recently tried to install c2rust using the README instructions. I installed the nightly-2019-12-05 toolchain, and ran cargo +nightly-2019-12-05 install c2rust. Unfortunately, I kept getting the following build error in several places.

error[E0658]: subslice patterns are unstable
--> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/object-0.23.0/src/read/mod.rs:162:41
|
162 | [0x7f, b'E', b'L', b'F', 1, ..] => FileKind::Elf32,
| ^^
|
= note: for more information, see rust-lang/rust#62254
= help: add #![feature(slice_patterns)] to the crate attributes to enable

However, when I compile on the latest version I get past this error. However, I get a different one:

error[E0462]: found staticlib rustc instead of rlib or dylib
--> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/c2rust-ast-builder-0.15.0/src/lib.rs:2:1
|
2 | extern crate rustc;
| ^^^^^^^^^^^^^^^^^^^
|
= help: please recompile that crate using --crate-type lib
= note: the following crate versions were found:

Is it possible that the targeted version of Nightly has changed without updating the README? Is there anything else I should try to install c2rust successfully?

@thedataking
Copy link
Contributor

The nightly version has not changed (see rust-toolchain). What system are you on? If you are comfortable using docker, you can pull down one of the provisioned images here and see if the build steps also fail in that environment - if they don't, there might be a problem with the host environment.

@elichai
Copy link

elichai commented Jan 25, 2021

I just had the same problem.
I think the problem is that cargo install ignores the lock file and one of the dependencies got bumped.
The solution is to run:
cargo +nightly-2019-12-05 install c2rust --locked

See rust-lang/cargo#7169

@jperon
Copy link

jperon commented Jan 30, 2021

Just had the same error, that got fixed by --locked. But, for information, it raises two warnings:

warning: package `miow v0.3.5` in Cargo.lock is yanked in registry `crates.io`, consider running without --locked
warning: package `socket2 v0.3.15` in Cargo.lock is yanked in registry `crates.io`, consider running without --locked

@zdb999
Copy link
Author

zdb999 commented Jan 31, 2021 via email

@osa1
Copy link

osa1 commented Feb 15, 2021

I'm unable to build even with --locked. Without --locked the error is as shown in the original report. With --locked I get:

error: failed to run custom build command for `c2rust-ast-exporter v0.15.0`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installPa6nZs/release/build/c2rust-ast-exporter-6c61d149c2d152c6/build-script-build` (exit code: 1)
--- stdout
running: "cmake" "cmake" "/home/omer/.cargo/registry/src/github.com-1ecc6299db9ec823/c2rust-ast-exporter-0.15.0/src" "-DLLVM_DIR=/usr/lib/llvm-10/lib/cmake/llvm" "-DClang_DIR=/usr/lib/llvm-10/lib/cmake/clang" "-DCMAKE_INSTALL_PREFIX=/tmp/cargo-installPa6nZs/release/build/c2rust-ast-exporter-14d189b0ed66be60/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Release"
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/cargo-installPa6nZs/release/build/c2rust-ast-exporter-14d189b0ed66be60/out/build
running: "cmake" "cmake" "--build" "." "--target" "clangAstExporter" "--config" "Release" "--"
Scanning dependencies of target tinycbor_build
[  8%] Creating directories for 'tinycbor_build'
[ 16%] Performing download step (download, verify and extract) for 'tinycbor_build'
-- Downloading...
   dst='/tmp/cargo-installPa6nZs/release/build/c2rust-ast-exporter-14d189b0ed66be60/out/build/tinycbor/src/v0.5.3.tar.gz'
   timeout='none'
-- Using src='https://github.com/intel/tinycbor/archive/v0.5.3.tar.gz'
-- verifying file...
       file='/tmp/cargo-installPa6nZs/release/build/c2rust-ast-exporter-14d189b0ed66be60/out/build/tinycbor/src/v0.5.3.tar.gz'
-- Downloading... done
-- extracting...
     src='/tmp/cargo-installPa6nZs/release/build/c2rust-ast-exporter-14d189b0ed66be60/out/build/tinycbor/src/v0.5.3.tar.gz'
     dst='/tmp/cargo-installPa6nZs/release/build/c2rust-ast-exporter-14d189b0ed66be60/out/build/tinycbor/src/tinycbor_build'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[ 25%] No update step for 'tinycbor_build'
[ 33%] No patch step for 'tinycbor_build'
[ 41%] No configure step for 'tinycbor_build'
[ 50%] Performing build step for 'tinycbor_build'
.config file not yet created
[ 58%] Performing install step for 'tinycbor_build'
[ 66%] Completed 'tinycbor_build'
[ 66%] Built target tinycbor_build
Scanning dependencies of target clangAstExporter
[ 75%] Building CXX object CMakeFiles/clangAstExporter.dir/AstExporter.cpp.o
[ 83%] Building CXX object CMakeFiles/clangAstExporter.dir/FloatingLexer.cpp.o
[ 91%] Building CXX object CMakeFiles/clangAstExporter.dir/ExportResult.cpp.o
[100%] Linking CXX static library libclangAstExporter.a
[100%] Built target clangAstExporter
cargo:root=/tmp/cargo-installPa6nZs/release/build/c2rust-ast-exporter-14d189b0ed66be60/out
cargo:rustc-link-search=native=/tmp/cargo-installPa6nZs/release/build/c2rust-ast-exporter-14d189b0ed66be60/out/build/lib
cargo:rustc-link-search=native=/tmp/cargo-installPa6nZs/release/build/c2rust-ast-exporter-14d189b0ed66be60/out/build
cargo:rustc-link-lib=static=tinycbor
cargo:rustc-link-lib=static=clangAstExporter
cargo:rustc-link-search=native=/usr/lib/llvm-10/lib
cargo:rustc-link-lib=clangTooling
cargo:rustc-link-lib=clangFrontend
cargo:rustc-link-lib=clangASTMatchers
cargo:rustc-link-lib=clangParse
cargo:rustc-link-lib=clangSerialization
cargo:rustc-link-lib=clangSema
cargo:rustc-link-lib=clangEdit
cargo:rustc-link-lib=clangAnalysis
cargo:rustc-link-lib=clangDriver
cargo:rustc-link-lib=clangFormat
cargo:rustc-link-lib=clangToolingCore
cargo:rustc-link-lib=clangAST
cargo:rustc-link-lib=clangRewrite
cargo:rustc-link-lib=clangLex
cargo:rustc-link-lib=clangBasic
cargo:rustc-link-lib=LLVM-10
cargo:rustc-link-lib=stdc++

--- stderr
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_ASM_COMPILER
    CMAKE_ASM_FLAGS


make[4]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[4]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[4]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
src/ExportResult.hpp:11:10: fatal error: 'algorithm' file not found
src/ExportResult.hpp:11:10: fatal error: 'algorithm' file not found, err: true
Unable to generate ExportResult bindings

warning: build failed, waiting for other jobs to finish...
error: failed to compile `c2rust v0.15.1`, intermediate artifacts can be found at `/tmp/cargo-installPa6nZs`

Caused by:
  build failed

@thedataking
Copy link
Contributor

@osa1 this issue is about the problem with subslice patterns. Since your problem is another one, please open a separate issue for this. When you do, please include information about your build environment (macOS, Linux? If Linux, what distro, what c++ compiler are you using?). Off the top of my head, it looks like a problem with your toolchain but it is hard to say without more information.

@RReverser
Copy link

@elichai Ohhh, thank you! I would never guess that's the reason.

@nobuyuki
Copy link

nobuyuki commented Mar 2, 2021

This 'algorithm' file not found happened on my machine, too. I'm not sure but I guess c2rust does not handle non-standard, system/compiler-specific directories handled by compiler drivers, well. Here is my workaround which makes compilation successful.

Screenshot from 2021-03-02 14-57-32

@RReverser
Copy link

@nobuyuki As @thedataking said, that's unrelated to the current issue. No need to mix up different things in the same thread, as it pings everyone who's only interested in the current bug - please create a new issue instead.

@thedataking
Copy link
Contributor

Closing now that we're able to build on stable and newer nightlies.

@thedataking thedataking unpinned this issue May 15, 2022
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

Successfully merging a pull request may close this issue.

7 participants