Giter Club home page Giter Club logo

Comments (6)

kolloch avatar kolloch commented on July 19, 2024 1

I suspect this is down to the fact that the crate is called new_debug_unreachable but the library debug_unreachable: https://github.com/mbrubeck/rust-debug-unreachable/blob/fork/Cargo.toml#L12-L14

[lib]
name = "debug_unreachable"
path = "src/lib.rs"

That is exposed in the cargo metadata output:

{
        "id": "futf 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
        "dependencies": [
          "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
          "new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)"
        ],
        "deps": [
          {
            "name": "mac",
            "pkg": "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)"
          },
          {
            "name": "debug_unreachable",
            "pkg": "new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)"
          }
        ],
        "features": []
      },
  {
      "name": "new_debug_unreachable",
      "version": "1.0.3",
      "id": "new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
      "license": "MIT",
      "license_file": null,
      "description": "panic in debug, intrinsics::unreachable() in release (fork of debug_unreachable)",
      "source": "registry+https://github.com/rust-lang/crates.io-index",
      "dependencies": [],
      "targets": [
        {
          "kind": [
            "lib"
          ],
          "crate_types": [
            "lib"
          ],
          "name": "debug_unreachable",
          "src_path": "/home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/new_debug_unreachable-1.0.3/src/lib.rs",
          "edition": "2015"
        },
        {
          "kind": [
            "example"
          ],
          "crate_types": [
            "bin"
          ],
          "name": "simple",
          "src_path": "/home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/new_debug_unreachable-1.0.3/examples/simple.rs",
          "edition": "2015"
        },
        {
          "kind": [
            "test"
          ],
          "crate_types": [
            "bin"
          ],
          "name": "check",
          "src_path": "/home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/new_debug_unreachable-1.0.3/tests/check.rs",
          "edition": "2015"
        }
      ],
// ...

Now I need to investigate on how to make this work with buildRustCrate. Renaming the crate alone does not work but we can additionally provide an explicit source:

diff --git a/default.nix b/default.nix
index de58004..50fb7ea 100644
--- a/default.nix
+++ b/default.nix
@@ -235,10 +235,14 @@ rec {
             };
         "new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)"
             = buildRustCrate {
-                crateName = "new_debug_unreachable";
+                crateName = "debug_unreachable";
                 version = "1.0.3";
                 edition = "2015";
                 sha256 = "1lxbd0n9gwvzg41bxiij0c28g1sp1jhp4h1rh10qisc8viyhsdj0";
+                src = builtins.fetchGit {
+                    url = "https://github.com/mbrubeck/rust-debug-unreachable";
+                    rev = "e374f6990882871d62ddcd1d9964b26ac50c5c7e";
+                };
                 libPath = "src/lib.rs";
                 authors = [
                     "Matt Brubeck <[email protected]>"

(Obviously, the source should be fetched from crates.io instead, this is just a proof of concept.)

With this fix, I run into a similar problem with the utf_8 crate, though, which exports the utf8 library.

I'll try to fix this today -- if that doesn't work out, you'll probably need to wait until at least next weekend :(

from crate2nix.

kolloch avatar kolloch commented on July 19, 2024 1

I created #5 for this.

from crate2nix.

kolloch avatar kolloch commented on July 19, 2024

Thanks for reporting this including a repo for reproducing the error and your detailed report!

I see a further difference:

--extern new_debug_unreachable=/nix/store/qz5ffk70ibllz27awjnpp9v7rbcrxnq5-rust_new_debug_unreachable-1.0.3/lib/libnew_debug_unreachable-6437ae92c0.rlib

vs

--extern debug_unreachable=/home/ed/git/url-bot-rs/target/debug/deps/libdebug_unreachable-6884cd8b03bd695e.rlib

Which explains why the library is available as debug_unreachable in the second case...

I'll investigate further...

from crate2nix.

kolloch avatar kolloch commented on July 19, 2024

Does this solve your problem?

Please continue to send me such awesome bug reports, @nuxeh!

from crate2nix.

nuxeh avatar nuxeh commented on July 19, 2024

@kolloch it does appear to have solved the problem for the test repo, but for my own project, https://github.com/nuxeh/url-bot-rs, there's still the following error, this time for cssparser:

Building src/lib.rs (cssparser)
Running rustc --crate-name cssparser src/lib.rs --crate-type lib -C opt-level=3 -C codegen-units=4 --edition 2015 -C metadata=15b8375349 -C extra-filename=-15b8375349 --out-dir target/lib --emit=dep-info,link -L dependency=target/deps --extern cssparser_macros=/nix/store/8yl9hhivlcpr1q485d9h9kywwlxiia91-rust_cssparser-macros-0.3.5/lib/libcssparser_macros-57e42b786a.so --extern dtoa_short=/nix/store/4v891ffdrzxa2yv547mn3dcdc7iqvak0-rust_dtoa-short-0.3.2/lib/libdtoa_short-77d68b4a44.rlib --extern itoa=/nix/store/adhj88qqyin8zf9bd10xqv1dsizv3bhr-rust_itoa-0.4.3/lib/libitoa-a6f76c7f27.rlib --extern matches=/nix/store/j3laann65lzck6lyg9bpjk7gjw9ihk2k-rust_matches-0.1.8/lib/libmatches-47ddbc585f.rlib --extern phf=/nix/store/qcvaa9ya6vgcrpmmyiq042a8jpb4niid-rust_phf-0.7.24/lib/libphf-95b8a51ebb.rlib --extern procedural_masquerade=/nix/store/rwzpk2qq99bkvr83hckj8akf6xq84dfy-rust_procedural-masquerade-0.1.6/lib/libprocedural_masquerade-e6f18a276f.rlib --extern smallvec=/nix/store/nh1i2602n3nphcrxmznrjbnvmpn747iq-rust_smallvec-0.6.9/lib/libsmallvec-99bacd0cdd.rlib --cap-lints allow -L /build/cssparser-0.24.1.tar.gz/target/build/cssparser.out --cfg rustc_has_pr45225 --color always
error: extern location for cssparser_macros does not exist: /nix/store/8yl9hhivlcpr1q485d9h9kywwlxiia91-rust_cssparser-macros-0.3.5/lib/libcssparser_macros-57e42b786a.so

error[E0463]: can't find crate for `cssparser_macros`
  --> src/lib.rs:73:14
   |
73 | #[macro_use] extern crate cssparser_macros;
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0463`.
builder for '/nix/store/dj2mwhaqg6yma100xscp0rx0s43h7zi8-rust_cssparser-0.24.1.drv' failed with exit code 1
cannot build derivation '/nix/store/378wm523mf1mscvbqc7vjhvy8n3hmdj8-rust_url-bot-rs-0.2.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/378wm523mf1mscvbqc7vjhvy8n3hmdj8-rust_url-bot-rs-0.2.0.drv' failed

So as far as i can tell, not out of the woods yet.

Thanks for looking at this, i'll certainly report anything else i find :)

from crate2nix.

nuxeh avatar nuxeh commented on July 19, 2024

Hmm, cssparser-macros seems to be a sub-crate within cssparser, I wonder if that has anything to do with this.

I can't imagine that that's uncommon, but it looks slightly suspicious for a normal Cargo project to me, just lib.rs and Cargo.toml.

https://github.com/servo/rust-cssparser/tree/master/macros

from crate2nix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.