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

Build fails in Cargo workspace #1007

Closed
nklayman opened this issue Sep 2, 2020 · 4 comments
Closed

Build fails in Cargo workspace #1007

nklayman opened this issue Sep 2, 2020 · 4 comments

Comments

@nklayman
Copy link
Member

nklayman commented Sep 2, 2020

Describe the bug
If the Tauri project is inside of a Cargo workspace, the target dir will be different then usual. The bundle will fail when it tries to create installers as they look in src-tauri/target for the executable when it is really up 2 levels from that due to the workspace dist.

To Reproduce
Steps to reproduce the behavior:

  1. Create a tauri project inside of a Cargo workspace
  2. Try to build the project

Expected behavior
It should either output the executable to src-tauri/target and ignore the workspace dist dir or it should look in the proper dir for the executable when bundling the installers.

Screenshots
image

Platform and Versions (please complete the following information):
Any

Additional context
tauri-apps/vue-cli-plugin-tauri#20

@victorhqc
Copy link

victorhqc commented Sep 9, 2020

Having the same issue, tried to workaround it by adding a .cargo/config file in the same path that the tauri application

[build]
target-dir = "src-tauri/target"

But couldn't make it work 😢 had to move all my code to its own repository for now.

Update

Made it work by using full path in .cargo/config

  1. Do pwd to get full path

  2. Modify .cargo/config and replace <pwd> with full path for repository targeting the correct src-tauri location.

    [build]
    target-dir = "<pwd>/src-tauri/target"

@x7c1
Copy link
Contributor

x7c1 commented Feb 14, 2021

I've found similar workaround which doesn't need embedding the full path.

Instead of modifying .cargo/config, you can add an environment variable in package.json :

  "scripts": {
    "tauri": "CARGO_BUILD_TARGET_DIR=$(pwd)/src-tauri/target tauri",

tauri build will be able to find src-tauri/target as usual 👍

npm run tauri build

@lucasfernog
Copy link
Member

The tauri bundler has some logic to detect workspaces, I guess it's not working properly. I'll investigate.

@lucasfernog
Copy link
Member

Closed by #1235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants