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

question about build errors regarding dependency on smithay #44

Closed
jokeyrhyme opened this issue Oct 16, 2022 · 5 comments
Closed

question about build errors regarding dependency on smithay #44

jokeyrhyme opened this issue Oct 16, 2022 · 5 comments

Comments

@jokeyrhyme
Copy link
Contributor

jokeyrhyme commented Oct 16, 2022

Howdie, thanks so much for sharing this project, I'm excited to see it! <3

I've landed here from the submodule in cosmic-epoch as of https://github.com/pop-os/cosmic-epoch/tree/e6aeb0ae6127ceb485ce3302912597af1d7f7013

That submodule reference points to https://github.com/pop-os/cosmic-comp/tree/d843919502b50237399ca1492ce64aafdb698b08

When I run just sysext over in cosmic-epoch or cargo build --release inside the cosmic-comp submodule, I get this error:

❯ cargo build --release
    Updating git repository `https://github.com/Smithay//smithay`
error: failed to load source for dependency `smithay`

Caused by:
  Unable to update https://github.com/Smithay//smithay?rev=625cbca5#625cbca5

Caused by:
  failed to fetch into: /home/user/.cargo/git/db/smithay-0141b1fcb9e16729

Caused by:
  process didn't exit successfully: `git fetch --tags --force --update-head-ok 'https://github.com/Smithay//smithay' '+refs/heads/*:refs/remotes/origin/*' '+HEAD:refs/remotes/origin/HEAD'` (exit status: 128)
  --- stderr
  fatal: remote error:
    Smithay//smithay is not a valid repository name
    Visit https://support.github.com/ for help

I believe this is caused by the double-slash here:

smithay = { git = "https://github.com/Smithay//smithay", rev = "625cbca5" }

But, when I remove the extra slash, I get this new error:

❯ cargo build --release
    Updating git repository `https://github.com/Smithay/smithay`
error: failed to resolve patches for `https://github.com/Smithay/smithay.git`

Caused by:
  patch for `smithay` in `https://github.com/Smithay/smithay.git` points to the same source, but patches must point to different sources

I believe this is caused by that patch line having a different git revision than the one on this line:

rev = "606d2d5c"

But, if I remove the patch line, I get:

❯ cargo build --release
    Updating git repository `https://github.com/Smithay/smithay.git`
    Updating crates.io index
error: failed to select a version for `wayland-backend`.
    ... required by package `smithay v0.3.0 (https://github.com/Smithay/smithay.git?rev=606d2d5c#606d2d5c)`
    ... which satisfies git dependency `smithay` of package `cosmic-comp v0.1.0 (/home/user/GitHub/pop-os/cosmic-epoch/cosmic-comp)`
versions that meet the requirements `=0.1.0-beta.8` are: 0.1.0-beta.8

all possible versions conflict with previously selected packages.

  previously selected package `wayland-backend v0.1.0-beta.10`
    ... which satisfies dependency `wayland-backend = "=0.1.0-beta.10"` (locked to 0.1.0-beta.10) of package `cosmic-comp v0.1.0 (/home/user/GitHub/pop-os/cosmic-epoch/cosmic-comp)`

failed to select a version for `wayland-backend` which could resolve this conflict

And then, if I change the dependency version to the (now deleted) patch revision, I get:

❯ cargo build --release
    Updating git repository `https://github.com/Smithay/smithay.git`
    Updating git repository `https://github.com/Smithay/smithay.git`
    Updating crates.io index
error: failed to select a version for `wayland-protocols`.
    ... required by package `smithay v0.3.0 (https://github.com/Smithay/smithay.git?rev=606d2d5c#606d2d5c)`
    ... which satisfies git dependency `smithay` of package `smithay-egui v0.1.0 (https://github.com/Smithay/smithay-egui.git?rev=939febaf#939febaf)`
    ... which satisfies git dependency `smithay-egui` (locked to 0.1.0) of package `cosmic-comp v0.1.0 (/home/user/GitHub/pop-os/cosmic-epoch/cosmic-comp)`
versions that meet the requirements `=0.30.0-beta.8` are: 0.30.0-beta.8

all possible versions conflict with previously selected packages.

  previously selected package `wayland-protocols v0.30.0-beta.10`
    ... which satisfies dependency `wayland-protocols = "^0.30.0-beta.8"` (locked to 0.30.0-beta.10) of package `cosmic-protocols v0.1.0 (https://github.com/pop-os/cosmic-protocols?branch=main#3ff11df3)`
    ... which satisfies git dependency `cosmic-protocols` (locked to 0.1.0) of package `cosmic-comp v0.1.0 (/home/user/GitHub/pop-os/cosmic-epoch/cosmic-comp)`

failed to select a version for `wayland-protocols` which could resolve this conflict

I believe the original double-slash problem is caused by my ~/.cargo/config.toml:

[net]
git-fetch-with-cli = true

However, without that, my SSH setup for GitHub fails completely and everything fails at the crate download/update step

I'm going to see if I can find a combination of versions of dependencies that allows this to compile, but I was wondering if you had any thoughts/suggestions about what else I could try? Cheers!

@jokeyrhyme
Copy link
Contributor Author

Okay, well, I think I have a temporary hack: I've forked smithay, and pointed the patch line at my own fork without the extra slash (but keeping the patch revision the same)

@jokeyrhyme
Copy link
Contributor Author

Okay, I've find a different workaround, which is to remove net.git-fetch-with-cli from my ~/.cargo/config.toml and to instead configure git so that it leaves https://github.com/ repository URLs alone and only changes them to SSH if I'm trying to push/write to a repository, per this comment: rust-lang/cargo#8172 (comment)

Previously, my git settings would change https://github.com/ repository URLs to SSH for all operations, which isn't necessary for cargo to work in this case

@Drakulix
Copy link
Member

Which version of cargo are you using? Usually the slash works just fine as a work around for this error: rust-lang/cargo#5478

Basically you currently can't patch git-dependencies with the same location. Cargo used to strip the /, but recognized the different URL as a new source.

@jokeyrhyme
Copy link
Contributor Author

❯ cargo --version
cargo 1.64.0 (387270bc7 2022-09-16)

The cause of the issue for me is that cargo's implementation of SSH strips out the extra-slash, but I had disabled that in favour of net.git-fetch-with-cli=true in order to get it working with my particular SSH setup (I use Yubikeys for my SSH keys, and this doesn't seem to work with cargo's implementation of SSH)

And the git CLI does not strip out the extra-slash, but considers it an error

I assume, once smithay 0.4.0 or newer is released and adopted here, there won't be a need for that [patch] line, and I think this is the long-term fix for this

But in the short term, I have changed my ~/.gitconfig

This was what I used to have:

[url "[email protected]:"]
    insteadOf = https://github.com

And this is what I have in my ~/.gitconfig that works without having to use cargo's net.git-fetch-with-cli=true setting:

[url "[email protected]:"]
    pushInsteadOf = https://github.com

@jokeyrhyme
Copy link
Contributor Author

Using pushInsteadOf seems to be a best practice for git and SSH, so I'm going to close this as not being a problem specific to this project

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