#Build application for other operating system other than the one youre using

175 messages · Page 1 of 1 (latest)

foggy thorn
#

There is no "deeper help" than this guide (talking about the Experimental section)

#

If you need more you need something like CI or VM. whatever gives you a native-ish host you can build on.

#

you can't cross-compile to linux or macos from other OSes.

viral rain
foggy thorn
#

that's on the page you linked

plucky salmon
#

@foggy thorn Speaking of cross compilation

foggy thorn
#

hi

plucky salmon
#

theres not much problem of that with windows & linux

#

In Windows, wsl is the best trick to compile to linux

foggy thorn
#

that's not cross compilation tho

#

that's basically a vm

plucky salmon
#

In linux, that guide kinda works

plucky salmon
#

but it takes a lot less resources than a normal vm

#

with quite great performance

#

In Linux, compiling for windows is experimental

#

Basically as much as I know

#

its because rust is compiled

#

and not interpreted

foggy thorn
#

that indeed makes it quite a lot harder, yes

plucky salmon
#

Also, this question mainly comes from those migrating from electron

foggy thorn
#

true

#

but kinda weird considering that electron's cross platform compilation support doesn't really exist either

#

at least if we're talking about installers/bundles

plucky salmon
#

yup lol

#

Electron's cross compilation is more like

#

changing the asar inside the bundle

#

nothing else

#

Fun fact is that

#

electron (their recommended electron-forage) only makes one click installers💀

#

@foggy thorn I forgot 1 thing

#

By any means, I don't think one can make macos build without a mac pc/gh actions

foggy thorn
#

okay soooooo

#

first of all, fuck apple

#

seriously

#

secondly it would be possible (on linux at least) if not for apple's shit licensing on the sdk

#

or well, maybe even then it's pretty hard for tauri apps at least. But in the broader rust ecosystem it should be easier

plucky salmon
#

Yeah

#

There's a lot of native stuff actually going on

foggy thorn
#

.app bundles are simple dirs so mostly work too, signing them is a bit ugly but there's a cool rust tool that reverse engineered the process and seems to work pretty nicely

#

the biggest problem tho is the .dmg file

#

that's macos only and it doesn't look like that'll change anytime soon

plucky salmon
#

and a really important question is coming in my mind

#

why the user doesn't prefer a CI CD pipeline

foggy thorn
foggy thorn
plucky salmon
foggy thorn
# foggy thorn good question

for private apps i kinda get it, macos ci runners are pretty expensive, but even many many open source apps (free ci on github) don't want it...

#

actually, i don't get it for private apps either tbh. Nowadays i feel like CI should always build your production apps.

plucky salmon
#

The CI would still be cheaper than buying a mac pc? or probably hackintosh?

foggy thorn
plucky salmon
#

My friend did make a hackintosh vm with macos 13

plucky salmon
#

after that Hackintosh is dead

foggy thorn
#

macos vms (on linux with qemu) are pretty easy to set up nowadays. But if apple finds out you release (paid) apps with them (or use them in CI) they may as well fck you up

foggy thorn
foggy thorn
plucky salmon
#

for cross compilation 💀

#

@foggy thorn I think the answer is kinda and depends on what target you want to build for

foggy thorn
#

And how much pain you can endure lol

plucky salmon
#

and for sure, better to not try apple lmao

viral rain
foggy thorn
#

wsl is a linux vm built into windows

#

therefore no

plucky salmon
#

Its lightweight

plucky salmon
#

its a lightweight linux vm

#

and basically forget about Macos

viral rain
#

So whats the best option there is to compile apps for windows but using linux

plucky salmon
#

in cross compilation

plucky salmon
#

Open Source repos have unlimited minutes

#

and private repos have 2000 minutes

viral rain
#

Whats those limit for?

plucky salmon
#

I suspect you're new to CI CD stuff

foggy thorn
#

if you exceed that you have to pay

foggy thorn
plucky salmon
#

they just stop the CI CD

viral rain
plucky salmon
#
name: Release
on:
  push:
    tags:
      - 'v*'
  workflow_dispatch:

jobs:
  release:
    permissions:
      contents: write
    strategy:
      fail-fast: false
      matrix:
        platform: [macos-latest, ubuntu-20.04, windows-latest]
    runs-on: ${{ matrix.platform }}

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Install dependencies (ubuntu only)
        if: matrix.platform == 'ubuntu-20.04'
        # You can remove libayatana-appindicator3-dev if you don't use the system tray feature.
        run: |
          sudo apt-get update
          sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev

      - name: Rust setup
        uses: dtolnay/rust-toolchain@stable

      - name: Rust cache
        uses: swatinem/rust-cache@v2
        with:
          workspaces: './src-tauri -> target'

      - name: Sync node version and setup cache
        uses: actions/setup-node@v3
        with:
          node-version: 'lts/*'
          cache: 'yarn' # Set this to npm, yarn or pnpm.

      - name: Install frontend dependencies
        # If you don't have `beforeBuildCommand` configured you may want to build your frontend here too.
        run: yarn install # Change this to npm, yarn or pnpm.

      - name: Build the app
        uses: tauri-apps/tauri-action@v0

        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tagName: ${{ github.ref_name }} # This only works if your workflow triggers on new tags.
          releaseName: 'App Name v__VERSION__' # tauri-action replaces \_\_VERSION\_\_ with the app version.
          releaseBody: 'See the assets to download and install this version.'
          releaseDraft: true
          prerelease: false
#

A simple ci cd example ☝️

#

||@foggy thorn why isn't it using ubuntu-latest tho btw?||

viral rain
plucky salmon
#

if its public

#

nothing to worry about

#

its unlimited

viral rain
plucky salmon
#

it'll auto terminate after 2000mins have passed*

#

*: if no payment has been setupped

viral rain
#

Okay thank you, I think Ill will try working with Github Action and Ill just message here if I have further questions

foggy thorn
#

Because it's also the minmum linux version for the user.

#

So for example, if you build on 20.04, users on 18.04 can't open your app

plucky salmon
#

i use ubuntu-latest to build my store app 💀

foggy thorn
#

as long as nobody complains i guess :D

viral rain
#

So my first step is to push my codes to git hub right?

plucky salmon
viral rain
#

So whats next?

plucky salmon
viral rain
# plucky salmon click actions tab

Okay. Just like said in the docs: Go to the Actions tab on your GitHub project and choose "New workflow", then choose "Set up a workflow yourself". Replace the file with the Tauri Action production build workflow example. Alternatively, you may set up the workflow based on the example at the bottom of this page

viral rain
#

And then i just commit the changes?

plucky salmon
viral rain
#

Done. And next?

plucky salmon
viral rain
#

No. It says There are no workflow runs yet.

#

Oh wait

viral rain
#

But what about on this part right here? DO I have to change it to npm as well?

#
        if: matrix.platform == 'ubuntu-20.04'
        # You can remove libayatana-appindicator3-dev if you don't use the system tray feature.
        run: |
          sudo npm update
          sudo npm install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev```
#

Pls ping me

foggy thorn
#

@viral rain No, it must be apt

#

that's the OS package manger, unrelated to your project

viral rain
foggy thorn
#

yes

viral rain
#

Okay. Hold on

viral rain
#

But how?

foggy thorn
viral rain
foggy thorn
#

did you commit the file to your default branch?

#

If it's on a secondary branch it won't be picked up

viral rain
foggy thorn
#

is your repo public?

viral rain
#

Its private @foggy thorn

#

Pls ping me. When you reply I will be busy in the next couple of hours

foggy thorn
#

@viral rain Can you run this in your local copy of the repo? git tag v0.0.0 && git push --tags

#

but before that, is the workflow in <project root>/.github/workflows/<workflow-name>.yml ?

viral rain
#

Wait

viral rain
foggy thorn
#

nope, the name doesn't matter

foggy thorn
#

yea

viral rain
foggy thorn
#

and it should've pushed it to github right?

#

if so, can you check the actions tab again?

viral rain
#

Yes It gave me a link

viral rain
foggy thorn
#

can you share your workflow file?

#

Also, what does your actions tab look like? Still like this?

#

alrighty, that looks good

#

Can you check this page too? https://github.com/<username>/<reponame>/settings/actions

#

on the left side, click on Release, does it show the workflow dispatch button in there maybe?

viral rain
viral rain
#

@foggy thorn

foggy thorn
#

yes?

#

did you click on the toggle on the right side yesterday?

#

idk what your question is :D

viral rain
#

And them it started running; A yellow circle?

foggy thorn
#

yeah, so that may take a while then

viral rain
foggy thorn
#

Navigate to the /releases tab in your repo

#

since it's a draft release it won't show up on the main page

foggy thorn
#

installer wise there's only the .deb for debian/ubuntu, correct

#

the AppImage should work on all distros though

viral rain
#

exe and msi for windows?

foggy thorn
#

yes

viral rain
#

How about dmg?

foggy thorn
#

macos

#

same for app.tar.gz

viral rain
#

Okay thank you very much for your assistance

plucky salmon
#

.AppImage works in every distro almost

#

Just to realize I'm kinda late