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

/usr/lib/libc.so.6: version `GLIBC_2.33' not found #1355

Closed
BurnyLlama opened this issue Mar 14, 2021 · 32 comments
Closed

/usr/lib/libc.so.6: version `GLIBC_2.33' not found #1355

BurnyLlama opened this issue Mar 14, 2021 · 32 comments

Comments

@BurnyLlama
Copy link

Describe the bug
I build my application on one machine, then I have a friend who tries to launch the appimage on another machine using another glibc version. They get the following error:

./my-app: /usr/lib/libc.so.6: version `GLIBC_2.33' not found (required by ./my-app)

To Reproduce
Steps to reproduce the behavior:

  1. Build an appimage with one machine.
  2. Try to launch the appimage on another machine. (With another version of glibc.)
  3. See the error; the app does not launch.

Expected behavior
I expect the appimage to "just work", since as far as I know appimages should have static libraries and therefore launch on any machine.

Are there any solutions to this?

Platform and Versions (please complete the following information):

Operating System - Linux(5.11.4-zen1-1-zen) - linux/x64

Node.js environment
  Node.js - 15.11.0
  tauri.js - 0.14.1

Rust environment
  rustc - 1.50.0
  cargo - 1.50.0
  tauri-bundler - 0.9.4

Global packages
  NPM - 7.6.1
  yarn - 1.22.10

App directory structure
/.git
/dist
/src-tauri

App
  tauri.rs - 0.11.1
  mode - embedded-server
  build-type - bundle
  CSP - default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'
  distDir - ../dist
  devPath - http://localhost:4000
@nothingismagick
Copy link
Member

If this happens with the dev branch, then please reopen this issue.
To use the dev branch, please view this page:
https://github.com/tauri-apps/tauri/blob/dev/.github/CONTRIBUTING.md#development-guide

For more information, see: #1253

@pansila
Copy link

pansila commented Apr 21, 2021

It should not be closed, I got the same issue and found no solution here! It's not cross-platform at all!

@nothingismagick
Copy link
Member

Can you confirm this is still happening on Dev / beta @pansila ?

@nothingismagick
Copy link
Member

FYI - the reason it was closed is because of our policy not treating issues apparently related to the alpha (and webview/webview) version of Tauri.

@nothingismagick
Copy link
Member

Our research has shown that we might have to resort to "rust compiler tricks" because for whatever reason older versions of GCC are forwards compatible, but newer ones are not backwards compatible. I had hoped that things had "fixed themselves" recently, but will reopen to be on the safe side.

@pansila
Copy link

pansila commented Apr 21, 2021

Can you confirm this is still happening on Dev / beta @pansila ?

I'm using tauri@1.0.0-beta-rc.0

@nothingismagick
Copy link
Member

that is not latest. can you try cargo update ? we are on beta-rc.2 already

@pansila
Copy link

pansila commented Apr 21, 2021

It's not GCC compatibility issue, but the glibc version mismatch on different machines. I'm now trying to build the tauri app targeting at x86_64_unknown_linux_musl, but openssl and glib-sys failed to build with musl. openssl issue could be circumvented with vendored feature (openssl = { version = "0.10.33", features = ["vendored"] }) while got no idea for glib-sys.

@nothingismagick
Copy link
Member

sorry, I meant glibc not gcc
https://redbeardlab.com/2019/05/07/rust-and-glibc-version/

@pansila
Copy link

pansila commented Apr 22, 2021

I managed to use the Cross to build the tauri app. Just need to build a new docker image based on the Cross docker image rustembedded/cross:x86_64-unknown-linux-gnu (glibc 2.15 which is old enough) to provide a complete build environment for tauri.

Dockerfile:

FROM rustembedded/cross:x86_64-unknown-linux-gnu

RUN apt-get update && apt-get install --assume-yes \
    libssl-dev libglib2.0-dev libcairo2-dev libpango1.0-dev \
    libatk1.0-dev libgdk-pixbuf2.0-dev libsoup2.4-dev \
    libgtk-3-dev libwebkit2gtk-4.0-dev

@pansila
Copy link

pansila commented Apr 22, 2021

I also need to replace tauri-cli executable to use cross instead of cargo when building.

rust.rs

pub fn build_project(debug: bool) -> crate::Result<()> {
...
-  let status = Command::new("cargo").args(args).status()?;
+  let status = Command::new("cross").args(args).status()?;
...

Put it in the path node_modules/@tauri-apps/cli/bin/tauri-cli.

Add distPath in the src-tauri/tauri.config.json:

  "build": {
    "distDir": "./target/webpack_dist",

@nothingismagick
Copy link
Member

awesome work and insight

@pansila
Copy link

pansila commented Apr 22, 2021

But failed to run if target machines's glibc version is lower than GLIBC_2.18.

How can I compile a Rust program so it doesn't use __cxa_thread_atexit_impl?

@nothingismagick
Copy link
Member

The use of the weak symbol in the Rust code is not particularly useful because GNU's particular version of ELF symbol versioning does not have weak symbol versions. We might change that eventually, but right now, the best way to deal with this is to compile with a sufficiently old toolchain.

@lucasfernog
Copy link
Member

lucasfernog commented Apr 23, 2021

Can you see if compiling with this env variable fixes the issue?
$ export RUSTFLAGS="-C target-feature=-crt-static"

@nothingismagick
Copy link
Member

But failed to run if target machines's glibc version is lower than GLIBC_2.18.

I get that, but at some point we just have to cut our losses and admit that if a user is not keeping fundamental libs up to date then there isn't much we can do about it - other than perhaps informing them to join the 21st century. :P

@nothingismagick
Copy link
Member

Jokes aside, 2.18 was released in 2013 - and only RHEL considers it still useful. Please compare:
https://sourceware.org/glibc/wiki/Release#Distribution_Branch_Mapping

@pansila
Copy link

pansila commented Apr 26, 2021

Can you see if compiling with this env variable fixes the issue?
$ export RUSTFLAGS="-C target-feature=-crt-static"

Thanks, didn't work though.

...crt-static feature which is turned off by default (except for musl).

@lucasfernog
Copy link
Member

Hmm this is tricky. I also found out that statically linking glibc is highly discouraged. So if we want to share Tauri apps with older machines, we need to compile with an older glibc version too :/

@ghost
Copy link

ghost commented Aug 11, 2021

I hit this issue trying to release to centos 7 having built on ubuntu. The workaround is to create a docker image for the environment you are releasing to, or use a tool like rust embedded cross build that does this automatically for you (I haven't used that tool yet).

so the trick is you also need to build tauri and build your app with that version (not the downloaded node package)

Here's the important steps at tleast for centos 7 (for example):

FROM centos:centos7.3.1611

RUN yum install -y \
  # notice I'm using an old version of webkit. It works!
  webkitgtk4-devel \
  openssl-devel \
  curl \
  wget \
  squashfs-tools \
  gcc \
  gcc-c++ \
  make \
  file \
  # for scp transfer of build
  openssh-clients \
  openssh && \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash && \
. $HOME/.nvm/nvm.sh && \
nvm install node --latest-npm && \
nvm use node && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
. $HOME/.cargo/env && \
cargo --help && echo $(rustc --version) && \
# do not use downloaded packages of tauri - you must build it yourself in this environment for correct GLIBC version
cargo install tauri-cli --vers 1.0.0-beta.5 && \
cargo install tauri-macros --vers 0.0.0

# now instead you build your appimage like:
# cargo tauri build --debug --verbose

@lucasfernog
Copy link
Member

I hit this issue trying to release to centos 7 having built on ubuntu. The workaround is to create a docker image for the environment you are releasing to, or use a tool like rust embedded cross build that does this automatically for you (I haven't used that tool yet).

so the trick is you also need to build tauri and build your app with that version (not the downloaded node package)

Here's the important steps at tleast for centos 7 (for example):

FROM centos:centos7.3.1611

RUN yum install -y \
  # notice I'm using an old version of webkit. It works!
  webkitgtk4-devel \
  openssl-devel \
  curl \
  wget \
  squashfs-tools \
  gcc \
  gcc-c++ \
  make \
  file \
  # for scp transfer of build
  openssh-clients \
  openssh && \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash && \
. $HOME/.nvm/nvm.sh && \
nvm install node --latest-npm && \
nvm use node && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
. $HOME/.cargo/env && \
cargo --help && echo $(rustc --version) && \
# do not use downloaded packages of tauri - you must build it yourself in this environment for correct GLIBC version
cargo install tauri-cli --vers 1.0.0-beta.5 && \
cargo install tauri-macros --vers 0.0.0

# now instead you build your appimage like:
# cargo tauri build --debug --verbose

Btw I've changed the CLI binary build CI to run on ubuntu-18.04 (that's the lowest available ubuntu on github actions :/) so maybe you won't need to build the CLI by yourself on the next release.

@ghost
Copy link

ghost commented Aug 14, 2021

@lucasfernog thanks, and actually appimage has documented the best practice for this exact issue:

You should use a binary that has been compiled on an older system. Unfortunately, the complication is that distributions usually compile the latest versions of applications only on the latest systems, which means that you will have a hard time finding binaries of bleeding-edge software that runs on older systems. A way around this is to compile dependencies yourself on a not too recent base system, and/or to use LibcWrapGenerator or glibc_version_header or bingcc.

If I build my appimage on centos7 it does not run on ubuntu 18.04, but there is an issue in AppImage about this as well:

error while loading shared libraries: libssl.so.10

@lucasfernog
Copy link
Member

Yeah we still need to take care of copying shared libraries to the appimage.

@mattduguid
Copy link

had similar issue with lastpass-cli, compiled and ran fine on laptop using "ubuntu 21.04" but trying to execute that binary in an azure devops pipeline with hosted agent using "ubuntu 20.04" got error "GLIBC_2.33 not found", workaround was to build it in the pipeline

@lucasfernog
Copy link
Member

I'll close this since we fixed the AppImage issues and there's nothing we can do regarding the glibc version. This will be documented.

@customautosys
Copy link

I hit this issue trying to release to centos 7 having built on ubuntu. The workaround is to create a docker image for the environment you are releasing to, or use a tool like rust embedded cross build that does this automatically for you (I haven't used that tool yet).

so the trick is you also need to build tauri and build your app with that version (not the downloaded node package)

Here's the important steps at tleast for centos 7 (for example):

FROM centos:centos7.3.1611

RUN yum install -y \
  # notice I'm using an old version of webkit. It works!
  webkitgtk4-devel \
  openssl-devel \
  curl \
  wget \
  squashfs-tools \
  gcc \
  gcc-c++ \
  make \
  file \
  # for scp transfer of build
  openssh-clients \
  openssh && \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash && \
. $HOME/.nvm/nvm.sh && \
nvm install node --latest-npm && \
nvm use node && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
. $HOME/.cargo/env && \
cargo --help && echo $(rustc --version) && \
# do not use downloaded packages of tauri - you must build it yourself in this environment for correct GLIBC version
cargo install tauri-cli --vers 1.0.0-beta.5 && \
cargo install tauri-macros --vers 0.0.0

# now instead you build your appimage like:
# cargo tauri build --debug --verbose

Is there an equivalent to this for (K)ubuntu?

@FabianLars
Copy link
Member

@siauderman I'd recommend using github actions for this since it supports ubuntu 18.04 too and you could build for mac and windows at the same time. Alternatively we added support for cross quite some time which should make this pretty straight forward too.

If you still want to use the docker script you need to

  • Replace the first line with an ubuntu image
  • replace RUN yum install [...packages...] with the ubuntu instructions from our docs
  • update the tauri-cli version (or use the npm package since we build that on ubuntu 18.04 too so it should work)
  • remove the tauri-macros line

@liudonghua123
Copy link

I have the same errors when using cross to build a tauri app a few days ago. And I found it is because the packaging phase did not running in the docker container. See #4255.

@rfdonnelly
Copy link

I have successfully built and run a Tauri app on CentOS/RHEL 7. I found the information in this thread helpful (#1355 (comment) in particular) but incomplete. I modified the Dockerfile provided above and add step-by-step instructions to build Tauri apps that will work on CentOS/RHEL 7 (glibc 2.17) and newer.

I've captured this at https://github.com/rfdonnelly/tauri-builders but I've also copied and pasted the relevant information below:

Dockerfile

# Adapted from: https://github.com/tauri-apps/tauri/issues/1355#issuecomment-896434917

FROM centos:centos7.9.2009

# Install dependencies
RUN \
    yum install -y \
        # notice I'm using an old version of webkit. It works!
        webkitgtk4-devel \
        openssl-devel \
        curl \
        wget \
        squashfs-tools \
        gcc \
        gcc-c++ \
        make \
        file \
        librsvg2-devel

# Install NVM
RUN \
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash \
    && source $HOME/.nvm/nvm.sh \
    && nvm install 14 --latest-npm \
    && nvm use node

# Install Rust
RUN \
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

# Install Tauri CLI
RUN \
    source $HOME/.cargo/env \
    # do not use downloaded packages of tauri - you must build it yourself in this environment for correct GLIBC version
    && cargo install tauri-cli --vers 1.0.4
    # NOTE: tauri-macros has nothing to install (no binaries) so this isn't needed
    # && cargo install tauri-macros --vers 1.0.4

ENV PATH=/root/.nvm/versions/node/v14.20.0/bin:$PATH
ENV PATH=/root/.cargo/bin:$PATH

# now instead you build your appimage like:
# cargo tauri build --debug --verbose

Instructions

Create a Tauri app

# Select the default for all prompts (just keeping pressing Enter)
npm create tauri-app

Install the dependencies

cd tauri-app
npm install

Modify the Tauri bundle identifier

# Edit src-tauri/tauri.conf.json and change the value of tauri.bundle.identifier to "test"
vim src-tauri/tauri.conf.json

Build the CentOS 7 Tauri build image

docker build -t tauri:centos7 .

Build the Tauri app

docker run -it --rm \
    -v $PWD:/src \
    -w /src \
    tauri:centos7 \
    /bin/bash -c "cargo tauri build --debug"

Run the Tauri app

src-tauri/target/debug/bundle/appimage/tauri-app_0.1.0_amd64.AppImage

Video

The following video shows a Tauri app being built in a CentOS 7 Docker container and being run on Ubuntu 22.10 under WSL 2.

tauri-centos7.mp4

@ommz
Copy link

ommz commented Sep 7, 2023

In my case, running rustup default stable solved it (Ubuntu 20.04)

@bryanlarsen
Copy link

Has anybody figured this out for tauri-v2-beta yet? I'm trying to get an appImage that will work on Centos Stream 9, but haven't found an OS that will build for me yet.

It appears we need an OS with GLIBC <= 2.34 (to support CentOS Stream 9) and a gnome glib >= 2.70 (which is what it appears that Tauri needs).

Am I just going to have to build gnome from source?

@super-fun-surf
Copy link

Just built on arch based system and tried to run the Appimage on debian.
failed missing GLIBC .
/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38'

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