#Linux dependency hell

96 messages · Page 1 of 1 (latest)

rotund kernel
#

Trying to get a tauri app running on linux... Every single time i try to compile I seem to be getting a new dependency issue. Currently geetting complaints about javscriptcoregtk not existing aswell as some other libraries versions not being new enough (glib, gio, gobjectg) aswell as webkit2gtk not being found, aswell as libsoup.

Followed the prerequisites for Linux on the tauri site aswell as some google searches to try resolve this myself and I cannot get anywhere.

I tried linux to avoid the hell of OpenSSL on windows as I couldn't get my Windows install to find my OpenSSL install no matter what, and I'm beginning to wonder which is worse...

#

Uploaded on April 11 2023 at 2:24 AM

Uploaded on April 11 2023 at 2:25 AM

Uploaded on April 11 2023 at 2:25 AM

Uploaded on April 11 2023 at 2:25 AM

Uploaded on April 11 2023 at 2:25 AM

#

all of the issues together

#

running on zorin os (based on ubuntu 20.04)

rich briar
#

What version of Tauri are you trying to use? Tauri v2 requires WebKit2GTK-4.1 which is only available on Ubuntu 22.04 and onwards.

rotund kernel
#

yeah, using v2..

rich briar
rotund kernel
#

well, thank you anyway

#

i'll have to try and resolve my issue with OpenSSL on windows then

open reef
#

@rotund kernel you should probably take a look at nix

rotund kernel
#

hm?

open reef
#

I had similar pains, I just wrote a flake.nix with all the dependencies I needed

#
{
  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 {
        buildInputs = packages;
      };
    });
  };
}
rotund kernel
#

i have no experience with nix at all, i think i will just find a way around the issue using publish-tauri to create my linux binaries...

still need a solution to the OpenSSL issue on windows though - i want to compile my app for android but can't when openssl-sys won't compile :(

#

i've installed openssl like 4 different ways by now, messed with too many env vars to name

#

and nothing can make it compile

open reef
#

Yeah I understand perfectly, it's why I'm suggesting nix

#

it's solving this issue

rotund kernel
#

don't you need to be running nixos to deal with all that stuff? it's truly out of my depth cus i know nothing about it lol

open reef
#

I even gave you the flake I use which works

#

no, you can use nix without nixos

rich briar
#

You shouldn't have too many issues with OpenSSL on Windows if you use the Microsoft-provided version since that will provide all the environment variables you need. You can find this version under Settings > Apps > Optional Features.

open reef
#

nix is made of 3 parts, nix the langauge, nix the tool, and nix the os

rotund kernel
#

nothing i googled gave me this answer

#

always about either vcpkg or manual installation

rich briar
#

Git also bundles it so installing Git for Windows would give you OpenSSL. Microsoft-vetted way seems the most stable approach though.

rotund kernel
#

yeah, i have openssl installed in multiple places.. but openssl-sys refuses to find it..

rich briar
#

Uh... nevermind. It was OpenSSH I was thinking of.

#

Sorry.

rotund kernel
#

yeah, just checked

#

it's fine

rich briar
#

I try to use Windows as little as possible.

rotund kernel
#

me too, that's why i tried to switch to linux to avoid the openssl issue

#

since sudo apt install libssl-dev will always be 1000x easier !

rich briar
#

It's weird that you ran into environment variable problems if you used an installer.

rotund kernel
#

there's not really a proper openssl installer on windows that will actually try to populate env vars for dev purposes

#

i used an installer to install openssl itself and there was no env vars created

#

installed openssl thru vcpkg too, setting env vars for vcpkg's root aswell as env vars for all of the openssl stuff

#

nothing can make openssl-sys find a single install of openssl

rich briar
#

Oh... that's why I thought it had a package for Windows. winget install openssl

rotund kernel
#

it can't even find my vcpkg install, even tho there's also an env var set for that

rich briar
rotund kernel
#

yeah, it does

#

i'm trying it

#

still happens even after installing it through winget:

#

i have a comical amount of env vars set related to vcpkg and openssl, i really don't understand

rich briar
#

Uh... are you trying to compile for Android?

rotund kernel
#

yeah, i am

rich briar
#

Does it compile normally for Windows?

rotund kernel
#

i haven't tried a windows compile since i upgraded to tauri v2, let me try

#

compiles on windows, but that's because it doesn't even attempt to install openssl-sys..

rich briar
rotund kernel
#

yep

rich briar
#

Hm... is your project source-available?

rotund kernel
#

uhhh no

#

i don't think that's too relevant though - since i think openssl-sys is required as part of the android compile process

#

just would be useful if i could figure out why it refuses to detect one of my like 3 openssl installs

rich briar
#

If you create a new project using [npm|pnpm|yarn] create tauri-app --alpha or cargo install create-tauri-app && cargo create-tauri-app --alpha, do you have the same problem or is this an issue integrating into an existing project? I ask because you mentioned upgrading to v2 earlier.

rotund kernel
#

let me try

#

hm, that project also fails - but for a different reason

#

the default project doesn't seem to have any libs or features which require openssl, so that part works fine

#

i get all the way to the end of compilation and then get a linker error about android llvm

#

hm, this probably is not a hard solution

#

yeah, okay, my ndk version has some weirdness but it looks solvable - will try that

#

still doesn't help for the case of my actual app tho, using the default program only avoids the requirement of openssl-sys

rich briar
#

The requirement for openssl-sys is probably added when you enable the http module in tauri.conf.json.

rotund kernel
#

i don't have it

rich briar
#

Hm... any other differences in your allowlist?

rotund kernel
#

yeah, only for file operations though

#

it's probably one of the crates i use, since i for example have reqwest as a crate

rich briar
#

Tauri now uses reqwest by default for the http module, so try enabling it and see if the same problem occurs.

rotund kernel
#

i think i managed to solve it by using rustls-tls for reqwest

#

i just have to fix ndk now

rich briar
#

Oh, it should have been doing that automatically in the latest version.

rotund kernel
#

yeah - it did, the dependency was in my code not tauri's

#

hm, got the app itself to compile but

#

gradle is now complaining

rich briar
#

Gradle is beyond my experience, unfortunately.

rotund kernel
#

fixed it by manually updating the gradle version

#

only to ensure more issues.. god i love gradle

#

i will probably give up with android for now, this is a mess

old crown
#

btw did you have homebrew installed on your Linux system? That's the only thing known to cause issues (other than straight up not having dependencies installed)

thorny fern
#

Do you have pkg-config installed?

rotund kernel
thorny fern
rotund kernel
#

yeah.. i think it doesn’t like the java version i have installed

#

tried using android studio to have it use java 11 instead and it still complains

#

google seems to think that my java version is too new for the gradle version in the project

#

so i tried updating gradle, but then got an issue where it said the project is using outdated gradle stuff that is dropping support in gradle 9 so would not let me compile

#

but it got me further than the default project settings atleast

thorny fern
#

The fastest way to ensure you don't have a system dependencies related issue is to try building inside my dev container since all dependencies are taken care of for you
https://github.com/simonhyll/devcontainer
Whether you decide to actually use it or not is up to you, I use it for basically all my projects nowadays, but it's a really good tool for debugging your Android setup