Closed Magellol closed 5 days ago
This is the wall I smashed into too :(
this is probably the same issue as outlined here: https://github.com/tauri-apps/tao/issues/383 But it was solved an merged last year.. It shouldn't be a problem still. Quite upsetting
EDIT: Have tried to use nix to sidestep this issue, but then webkitgtk
fails to build on my mac. This is frustrating..
@datner How would nix help solving this problem? I'm a too running nix but I'm only using it to have the rustup
dependency here. I feel this is due to newer macos sdks having missing dependencies to build but I can't figure out if it's possible to tell cargo
to use an older one? 🤔
@Magellol after many many many hours of bashing my head against the wall, it crumbled. I'm using this flake and everything works exactly as I wish it to. Big thanks to @yusefnapora for figuring it out in the first place.
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = {
nixpkgs,
rust-overlay,
...
}: let
overlays = [(import rust-overlay)];
# Helper generating outputs for each desired system
forAllSystems = nixpkgs.lib.genAttrs [
"x86_64-darwin"
"x86_64-linux"
"aarch64-darwin"
"aarch64-linux"
];
# Import nixpkgs' package set for each system.
nixpkgsFor = forAllSystems(system:
import nixpkgs {
inherit system overlays;
});
in {
formatter = forAllSystems (system: nixpkgsFor.${system}.alejandra);
devShells = forAllSystems (system: let
pkgs = import nixpkgs {
inherit system overlays;
};
inherit (pkgs.stdenv) isLinux;
rust-toolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = ["rust-analyzer" "rust-src" "rust-std"];
targets = ["wasm32-unknown-unknown"];
};
packages-linux = with pkgs; [
rust-toolchain
nodejs-18_x
nodePackages.pnpm
pkg-config
gtk3
webkitgtk
libayatana-appindicator.dev
alsa-lib.dev
];
packages-darwin = with pkgs; [
rust-toolchain
nodejs-18_x
nodePackages.pnpm
curl
wget
pkg-config
libiconv
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.CoreServices
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.Foundation
darwin.apple_sdk.frameworks.AppKit
darwin.apple_sdk.frameworks.WebKit
darwin.apple_sdk.frameworks.Cocoa
];
packages =
if isLinux
then packages-linux
else packages-darwin;
in {
default = pkgs.mkShell {
name = "@bubble/client";
buildInputs = packages;
};
});
};
}
It's not optimized or anything, can be made more elegant. But it's plenty good enough for me
@datner I was able to make this work as well having a somewhat similar flake file as yours. Thank you! For reference, this is what I ended up using
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs =
{ nixpkgs
, rust-overlay
, ...
}:
let
overlays = [ (import rust-overlay) ];
# Helper generating outputs for each desired system
forAllSystems = nixpkgs.lib.genAttrs [
"aarch64-darwin"
];
# Import nixpkgs' package set for each system.
nixpkgsFor = forAllSystems (system:
import nixpkgs {
inherit system overlays;
});
in
{
devShells = forAllSystems (system:
let
pkgs = import nixpkgs {
inherit system overlays;
};
packages-darwin = with pkgs; [
rustup
libiconv
darwin.apple_sdk.frameworks.AppKit
darwin.apple_sdk.frameworks.WebKit
];
packages = packages-darwin;
in
{
default = pkgs.mkShell {
buildInputs = packages;
};
});
};
}
And this works perfectly building on mac os apple silicon. I was curious if you knew what was rust-overlay
, it's the only bit I don't fully understand here.
And this works perfectly building on mac os apple silicon. I was curious if you knew what was rust-overlay, it's the only bit I don't fully understand here.
@Magellol Yeah ofc, you can also read about it from their repo. But basically instead of installing from rustup in fragments, it's a pre-built binaries you can consume. Like everything in nix, it's more complicated than that, but in short - it's faster and more deterministic than installing the rust toolchain manually.
I saw you removed most of the 'fat' from the apple_sdk
, I should probably do that as well since I ended up not using them.
I have made an unoffical flake that should work for this: https://github.com/eveeifyeve/nix-tauri
Note: The devenv flake works not the deafult one so just use nix flake init github:eveeifyeve/nix-tauri#devenv
for now.
I have made an unoffical flake that should work for this: https://github.com/eveeifyeve/nix-tauri
Describe the bug
Hello. I'm trying to build a basic app on macos. I was reading this might be due to newer Macosx SDKs not including the Carbon header file although I'm pretty new to native apps so I'm not sure what to do with that information.
I've tried to download an older SDK here, set the
SDKROOT
env variable to try and tell cargo to use the older SDK but that didn't seem to work. Possible I didn't do this right, like I said I'm pretty new to building native apps. I'm currently usingmacOS 12.3
SDK as default.I've tried building the app on windows (native, not cross compiling) and it builds fine. Let me know if you have any ideas, thank you!
FYI,
cargo build
fails with the following error:Reproduction
No response
Expected behavior
No response
Platform and versions