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

Error when building with cargo xtask in bare repository with custom target directory. #2089

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

Comments

@ThomasFrans
Copy link

Basic information
There is a build error when building Zellij in a bare git repository with worktrees and a custom target directory in zellij.git/.cargo/config.toml. I realize this is very specific, and I could look into this, but I wanted to ask whether this is something that would be accepted, since the use case is so specific. Basically, the directory given to include_bytes!() isn't correct as it doesn't take into account the custom target directory. I don't know whether there are ways to find out the target directory at build time, but that could help.

Error

error: couldn't read /mnt/data/thomas/Documents/development/forks/zellij.git/fix-underline-bug/zellij-utils/../target/wasm32-wasi/debug/compact-bar.wasm: No such file or directory (os error 2)
  --> zellij-utils/src/consts.rs:67:17
   |
67 | /                 include_bytes!(concat!(
68 | |                     env!("CARGO_MANIFEST_DIR"),
69 | |                     "/../target/wasm32-wasi/debug/",
70 | |                     $plugin
71 | |                 ))
   | |__________________^
...
81 |               add_plugin!(assets, "compact-bar.wasm");
   |               --------------------------------------- in this macro invocation
   |
   = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

To reproduce

git clone --bare <zelij-url>
cd zellij.git
git worktree add main
mkdir .cargo
echo "[build]\ntarget-dir=\"target\"" > .cargo/config.toml
cd main
cargo xtask build

uname -av or ver(Windows):
Linux thomas-desktop 6.1.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 04 Jan 2023 16:28:15 +0000 x86_64 GNU/Linux

Further information
Reproduction steps, noticeable behavior, related issues, etc

@ThomasFrans ThomasFrans added the bug Something isn't working label Jan 13, 2023
@raphCode
Copy link
Contributor

@har7an maybe can you say something about it?

@har7an
Copy link
Contributor

har7an commented Jan 22, 2023

Hello,

@ThomasFrans Unfortunately we cannot support custom target directories due to how we include the plugins into the application code. We have to resolve the path where we take the plugins from during compile time, and cargo doesn't expose the target dir (as far as I'm aware) via env variables. If you really want/need this for your specific application, you can try the following procedure (Although I haven't tested this, but it should work):

  1. Build the plugins in release mode: cargo x build -p -r
  2. Try to manually enter/adapt the command from here

Although this is probably a lot of overhead. I cannot think of another way, though. Does that help you?

@ThomasFrans
Copy link
Author

Ah, that's ok. I know that this was a very specific request. From the little bit I read online I also noticed cargo might not give any method to get the target dir at compile time. A normal repo works fine :)

algitbot pushed a commit to alpinelinux/aports that referenced this issue May 29, 2023
Disable check. It is troublesome to even get the debug binary built.
Ref: zellij-org/zellij#2089 (comment)
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

No branches or pull requests

3 participants