Skip to content

Build errors due to outdated crates #1196

@theoparis

Description

@theoparis

I used this default.nix from another issue on this repository and received build errors due to the unmaintained proc-macro-error crate (the flake.nix file wants me to rebuild rustc). I think the clap crate is the problem.

# nix-build -E 'with import <nixpkgs> {}; callPackage ./default.nix {}'

{
  lib,
  pkgs,
  rustPlatform,
}:

rustPlatform.buildRustPackage {
  pname = "c2rust";
  version = "unstable";
  src = ./.;
  cargoHash = "sha256-yZC78yI0D9wLK5bY6mtuiqjkSOCeLBL0tsFQSoekBmM=";

  LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
  LIBCXX_INCLUDE_DIR = "${pkgs.llvmPackages.libcxx.dev}/include";
  LLVM_CONFIG_PATH = "${pkgs.llvmPackages.llvm.dev}/bin/llvm-config";
  LLVM_INCLUDE_DIR = "${pkgs.llvmPackages.llvm.dev}/include"; # /nix/store/w8p79yfq5059141frg9p4z17nr6s999w-llvm-11.1.0-dev/include
  LLVM_LIB_DIR = "${pkgs.llvmPackages.llvm.lib}/lib";
  LIBC_INCLUDE_DIR = "${pkgs.llvmPackages.libclang.lib}/lib/clang/${pkgs.llvmPackages.libclang.version}/include";
  # Required to prevent cmake from downloading tinycbor
  DOCS_RS = true;

  nativeBuildInputs = [
    pkgs.python3 # c2rust-refactor -> python3 process_ast.py
    pkgs.pkg-config # c2rust-bitfields-derive -> pkg-config --libs --cflags openssl
    pkgs.llvmPackages.llvm # c2rust-ast-exporter -> llvm-config
    pkgs.llvmPackages.llvm.dev # c2rust-ast-exporter -> #include "llvm/Support/CommandLine.h"
    pkgs.cmake # c2rust-ast-exporter
    pkgs.tinycbor # c2rust-ast-exporter
  ];
  buildInputs = [
    pkgs.openssl
    pkgs.zlib
    pkgs.llvmPackages.libclang.lib
    pkgs.llvmPackages.libclang.dev # c2rust-ast-exporter -> #include "clang/Frontend/FrontendActions.h"
    pkgs.llvmPackages.libcxx
    pkgs.llvmPackages.libcxx.dev # c2rust-ast-exporter -> #include <algorithm>
    pkgs.tinycbor # c2rust-ast-exporter
  ];

  meta = with lib; {
    description = "Migrate C code to Rust";
    homepage = "https://github.com/immunant/c2rust";
    license = licenses.bsd3;
  };
}

Error:

> error[E0277]: the trait bound `proc_macro2::Span: From<proc_macro::Span>` is not satisfied
       >    --> /build/c2rust-unstable-vendor.tar.gz/proc-macro-error/src/lib.rs:549:37
       >     |
       > 549 |                 first: self.clone().into(),
       >     |                                     ^^^^ the trait `From<proc_macro::Span>` is not implemented for `proc_macro2::Span`, which is required by `proc_macro::Span: Into<_>`
       >     |
       >     = note: required for `proc_macro::Span` to implement `Into<proc_macro2::Span>`
       >
       > error[E0277]: the trait bound `proc_macro2::Span: From<proc_macro::Span>` is not satisfied
       >    --> /build/c2rust-unstable-vendor.tar.gz/proc-macro-error/src/lib.rs:550:36
       >     |
       > 550 |                 last: self.clone().into(),
       >     |                                    ^^^^ the trait `From<proc_macro::Span>` is not implemented for `proc_macro2::Span`, which is required by `proc_macro::Span: Into<_>`
       >     |
       >     = note: required for `proc_macro::Span` to implement `Into<proc_macro2::Span>`
       >
       > For more information about this error, try `rustc --explain E0277`.
       > error: could not compile `proc-macro-error` (lib) due to 2 previous errors
       > warning: build failed, waiting for other jobs to finish...

Metadata

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