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

bug: cairo_filesystem detect_corelib fails when used as a git dependency #1595

Closed
shramee opened this issue Jan 1, 2023 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@shramee
Copy link
Contributor

shramee commented Jan 1, 2023

Bug Report

Cairo version:

74b4d12

Current behavior:

thread 'main' panicked at 'Corelib not found.', /Users/shramee/.cargo/git/checkouts/cairo-f086c7e6d4098a68/74b4d12/crates/cairo-filesystem/src/detect.rs:34:5

When using cairo_compiler::db::RootDatabase; to get default let mut db_val = RootDatabase::default();

Using crates from the git repo like so,

# . . .
[dependencies]

# Members of starkware-libs/cairo
# . . .
cairo-filesystem = { git = "https://github.com/starkware-libs/cairo" }
cairo-compiler = { git = "https://github.com/starkware-libs/cairo" }
# . . .

Expected behavior:

Corelib dir to be found from installed git crate path.

Steps to reproduce:

Related code:

Tiniest reproducible version:

Issue is in cairo_filesystem::detect::detect_corelib.

Cargo.toml

[package]
name = "cairo-corelibs-bug"
version = "0.1.0"
edition = "2021"

[dependencies]
cairo-filesystem = { git = "https://github.com/starkware-libs/cairo" }

[[bin]]
name = "test"
path = "test.rs"

test.rs

use cairo_filesystem::detect::detect_corelib;
fn main() {
    let path = detect_corelib();
    print!("Found corelibs at {:#?}.", path);
}

Other information:

@shramee shramee added the bug Something isn't working label Jan 1, 2023
shramee added a commit to shramee/cairo that referenced this issue Jan 1, 2023
starkware-libs#1595 Find `corelib` in current crate path (from file path)
shramee added a commit to shramee/creative-cairo that referenced this issue Jan 1, 2023
Until starkware-libs/cairo#1595 is resolved
And serve.rs tweaks
@mkaput
Copy link
Contributor

mkaput commented Jan 5, 2023

@maciektr will work on this. Our goal is to provide an API to provide custom paths to the corelib and in the future I foresee giving an ability to provide the corelib via virtual filesystem objects.

@shramee
Copy link
Contributor Author

shramee commented Jan 6, 2023

I second virtual FS corelib. Projects shouldn't have to include corelibs in their project files. Those should fall back corelibs from the main workspace.

@spapinistarkware
Copy link
Contributor

I think this is fixed now. You can probably check out how Scarb are doing it. If it's still an issue, I'll reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants