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

ahash cyclic dependence with the js feature for getrandom crate #3263

Closed
jianshu93 opened this issue Jul 26, 2024 · 7 comments
Closed

ahash cyclic dependence with the js feature for getrandom crate #3263

jianshu93 opened this issue Jul 26, 2024 · 7 comments

Comments

@jianshu93
Copy link

Dear sourmash team,

When use sourmash as a library dependency, the js feature from get random is enabled by default and cause this error:

error: cyclic package dependency: package ahash v0.8.11 depends on itself. Cycle:
package ahash v0.8.11
... which satisfies dependency ahash = "^0.8.7" of package hashbrown v0.14.5
... which satisfies dependency hashbrown = "^0.14.1" of package indexmap v2.2.6
... which satisfies dependency indexmap = "^2.2.3" of package serde_json v1.0.120
... which satisfies dependency serde_json = "^1.0" of package wasm-bindgen v0.2.92
... which satisfies dependency wasm-bindgen = "^0.2.92" of package js-sys v0.3.69
... which satisfies dependency js-sys = "^0.3" of package getrandom v0.2.15
... which satisfies dependency getrandom = "^0.2.7" of package ahash v0.8.11

tkaitchuck/aHash#95 (comment), see also discussion here. Ahash is a widely used hash library for many other crates this is why we see the error. Since the wasm feature of sourmash is not enabled by default, the js feature is also not needed I think? I disabled the js from getrandom crate in Cargo.toml and it worked. A solution related to wasm-bingen is also provided: tkaitchuck/aHash#95 (comment), maybe also this solution. Not sure about it.

Can you please check and update the sourmash crate on crates.io?

Thanks,

Jianshu

@luizirber
Copy link
Member

Thanks for the info, @jianshu93!

ahash is turning into quite a problematic indirect dependency, it also affected the [emscripten-forge](emscripten-forge/recipes#288 package PR) and was fixed in #3243 (still need to do a Python release for it).

#3250 is bumping the Rust crate to 0.15.0, will work on releasing it to crates.io this weekend

@luizirber
Copy link
Member

@jianshu93 can you try with

sourmash = { git = "https://github.com/sourmash-bio/sourmash.git", branch = "lirber/rocksdb_storage", features = ["branchwater"] }

in your Cargo.toml to see if the problem still happen?

@jianshu93
Copy link
Author

hi @luizirber,

It worked but for me, build the lib rocksdb_storage took much longer and the binary size is also much larger. Is the js feature from getrandom necessary for the database storage features? Is there a possibility to make it optional in this case.

Thanks,
Jianshu

@luizirber
Copy link
Member

oh, yes, you don't need the features = ["branchwater"] bit if you're not using the rocksdb stuff, forgot to take it out 😓

@jianshu93
Copy link
Author

It worked and is fast now to build! Thanks. I will use the v0.15.0 on crates.io when you publish it this weekend.

Jianshu

@luizirber
Copy link
Member

https://crates.io/crates/sourmash/0.15.0 released!

Thanks again for reporting the problem and pointing to the solution =]

@jianshu93
Copy link
Author

Thank you so much!

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

2 participants