tauri-apps / tauri-action

Build your Web application as a Tauri binary for macOS, Linux and Windows
https://tauri.app
MIT License
782 stars 134 forks source link

Example in homepage causes problems with Target Triples and Sidecars #812

Closed kareemmahlees closed 1 month ago

kareemmahlees commented 1 month ago

Description

While migrating my application to Tauri V2, I also updated my release actions to the example mentioned here. Then I started to notice that the matrix with target x86_64-apple-darwin always fails to resolve the correct target triple ( it resolved to the same target triple as the first matrix ).

Solution

By doing some research I found out that the target triple of the second matrix is of macos-13, and macos-latest resolves to macos-14 which gives a completely different target triple.

matrix:
        include:
          - platform: 'macos-latest' 
            args: '--target aarch64-apple-darwin'
          - platform: 'macos-13' #< --- change this
            args: '--target x86_64-apple-darwin'

If this deserves a dedicated PR I am happy to help!

FabianLars commented 1 month ago

Hmm, this sounds more like a tauri issue. It's supposed to use the target flag to resolve the triple and not use the current platform's arch.

Will check it out tomorrow, thanks for the report :)

kareemmahlees commented 1 month ago

It's supposed to use the target flag to resolve the triple and not use the current platform's arch.

Is it ? Because then, there is no way for us to know what target flags are being passed to tauri in order to prepare/rename the sidecar with the corresponding triple, moreover the scripts mentioned here would be useless because they rely on the underlying arch.

I think it is more convenient for tauri to depend on the arch as a single source of truth dyt ?

FabianLars commented 1 month ago

Depending on the currently running arch makes no sense if you're trying to cross compile. And yes, the example scripts do not expect cross compilation.

For example if you use macos-latest, and for the sake of the argument let's assume macos-13 has been removed (which will happen at some point), you will compile on aarch64, but sidecars/apps compiled on aarch64 for aarch64 can not run on intel macs (the other way around works via rosetta).

kareemmahlees commented 1 month ago

You mean tauri should be able to ( for e.g. ) compile aarch64 and intel binaries from the same macos machine?

FabianLars commented 1 month ago

yes, and ignoring the sidecar issue, it is able to do that (cross-arch on all platforms, cross-platform only when targetting windows).

kareemmahlees commented 1 month ago

hmm, cool! Actually I think there is no issue here because the scripts ( as you have stated ) doesn't take into consideration cross-compilation specifically corss-arch complication and therefore doesn't rename the sidecar differently when using different targets. so I think I will modify the scripts a bit to accept an optional target argument.