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] "runner": "cross" in tauri.conf.json did not work when packaging linux AppImage. #4255

Closed
liudonghua123 opened this issue Jun 2, 2022 · 3 comments

Comments

@liudonghua123
Copy link

liudonghua123 commented Jun 2, 2022

Describe the bug

I tried to write a github ci/cd action for a tauri app. And I use "runner": "cross" in tauri.conf.json. The binary compilation is ok in the docker container, but I find the linux AppImage packaging is not running in the docker container but in the host, so it always failed with ERROR: Could not find dependency, see linuxdeploy/linuxdeploy#203 for more details.

image

Reproduction

  1. create a demo tauri app via yarn create tauri-app
  2. install cross via cargo install cross
  3. config "runner": "cross" in tauri.conf.json
  4. add Cross.toml in src-tauri as the following contents.
    [target.i686-unknown-linux-gnu]
    image = "liudonghua123/cross:i686-unknown-linux-gnu-tauri"
    [target.x86_64-unknown-linux-gnu]
    image = "liudonghua123/cross:x86_64-unknown-linux-gnu-tauri"
  5. execute yarn tauri build -t x86_64-unknown-linux-gnu -v and yarn tauri build -t i686-unknown-linux-gnu -v

Expected behavior

Both the compilation and packaging are executed in the docker container, not the host environment.

Platform and versions

liudonghua@DESKTOP-DELL:/mnt/d/code/rust/hoppscotch-app$ npm run tauri info

> tauri
> tauri "info"


Environment
  › OS: Ubuntu 22.04 X64
  › Node.js: 18.2.0
  › npm: 8.9.0
  › pnpm: 7.1.7
  › yarn: 1.22.18
  › rustup: 1.24.3
  › rustc: 1.61.0
  › cargo: 1.61.0
  › Rust toolchain: stable-x86_64-unknown-linux-gnu

Packages
  › @tauri-apps/cli [NPM]: 1.0.0-rc.13
  › @tauri-apps/api [NPM]: 1.0.0-rc.6
  › tauri [RUST]: 1.0.0-rc.14,
  › tauri-build [RUST]: 1.0.0-rc.12,
  › tao [RUST]: 0.9.1,
  › wry [RUST]: 0.17.0,

App
  › build-type: bundle
  › CSP: default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
  › distDir: dist
  › devPath: dist

App directory structure
  ├─ .git
  ├─ .github
  ├─ dist
  ├─ hoppscotch
  ├─ node_modules
  └─ src-tauri
npm notice
npm notice New minor version of npm available! 8.9.0 -> 8.12.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.12.0
npm notice Run npm install -g npm@8.12.0 to update!
npm notice
liudonghua@DESKTOP-DELL:/mnt/d/code/rust/hoppscotch-app$

Stack trace

No response

Additional context

No response

@lucasfernog
Copy link
Member

"runner": "cross" just configures our CLI to use cross instead of cargo to compile the Rust code and generate the executable. The bundling phase is still executed in the host machine. You'll need to setup a docker and run our CLI there if you want to run the entire process in the container.

@liudonghua123
Copy link
Author

@lucasfernog Hi, how can I separate the packaging phase from tauri build?

@liudonghua123
Copy link
Author

It seems that I can just generate the executable via passing a -b none options like yarn tauri build -t x86_64-pc-windows-msvc -b none.

If I want to make a bundle later, then I can invoke it without -b none options again.

D:\code\rust\tauri-app>yarn tauri build --help
yarn run v1.22.17
warning package.json: No license field
$ tauri build --help
yarn-run-tauri-build 1.0.0-rc.13
Tauri build

USAGE:
    yarn run tauri build [OPTIONS] [ARGS]...

ARGS:
    <ARGS>...    Command line arguments passed to the runner

OPTIONS:
    -b, --bundles <BUNDLES>      List of bundles to package
    -c, --config <CONFIG>        JSON string or path to JSON file to merge with tauri.conf.json
    -d, --debug                  Builds with the debug flag
    -f, --features <FEATURES>    List of cargo features to activate
    -h, --help                   Print help information
    -r, --runner <RUNNER>        Binary to use to build the application, defaults to `cargo`
    -t, --target <TARGET>        Target triple to build against. It must be one of the values
                                 outputted by `$rustc --print target-list` or
                                 `universal-apple-darwin` for an universal macOS application. Note
                                 that compiling an universal macOS application requires both
                                 `aarch64-apple-darwin` and `x86_64-apple-darwin` targets to be
                                 installed
    -v, --verbose                Enables verbose logging
    -V, --version                Print version information
Done in 0.24s.

D:\code\rust\tauri-app>

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

2 participants