JekSun97 / gdTree3D

Plugin for procedural generation of 3D trees of varying complexity for Godot Engine.
Other
160 stars 5 forks source link

Requires GLIBCXX 3.4.32 #10

Open SoapSpangledGames opened 1 week ago

SoapSpangledGames commented 1 week ago

I am trying to use Tree3D on Ubuntu 20.04, which has glibc 2.31, but the Tree3D Linux binaries are built against glib 3.4.32. Is there a way to get libraries compatible with Ubuntu 20.04?

FibreFoX commented 1 week ago

Ubuntu 20 LTS will drop support in 2025 (see https://ubuntu.com/about/release-cycle), so keep in mind that they will remove their support too in half a year. grafik

Godot itself does not have any requirements to the used OS (see https://docs.godotengine.org/en/stable/about/system_requirements.html#desktop-or-laptop-pc-recommended): grafik

Right now we use Ubuntu 24 for compiling the binaries (see https://github.com/JekSun97/gdTree3D/blob/f34effd250a1bab6af0df09c6e61b740f83a4af0/Dockerfile#L1). I was not aware of such a problem, will check if this can be easily downgraded.

FibreFoX commented 1 week ago

Which Godot version are you using? @SoapSpangledGames

FibreFoX commented 1 week ago

Note to self: needs some more work than just switching to Ubuntu 20.04 inside the Dockerfile:

root@d75a78707437:/source# scons target=template_debug arch=x86_64
scons: Reading SConscript files ...
SCons 4.0 or greater required, but you have SCons 3.1.2

Will check if using PIP for installing SCons will help, and I will check if generated binaries still work with later glibc version. (I hate these version conflicts)

SoapSpangledGames commented 1 week ago

I'm using Godot 4.3. I am planning on building Tree3D myself in order to get the correct binaries for Ubuntu 20.04.

SoapSpangledGames commented 1 week ago

I downloaded SCons 4.8.1, so I think I will be able to build it.

SoapSpangledGames commented 1 week ago

It's building now.

FibreFoX commented 1 week ago

I've found an issue over at the Godot project regarding glibc, but they are discussion glibc 2.x stuff,: https://github.com/godotengine/godot/issues/95182

Not sure if we need to supply special versions here, I would prefer to glibc 3, but it needs to be documented. I'm building the extension on my local machine too and will then push through all the test-devices I have.

SoapSpangledGames commented 1 week ago

The build completed, but I don't know what to do now. Since you're building, perhaps I should just wait for you to finish.

FibreFoX commented 1 week ago

Depending on how you've built it, look into the demo/addons/Tree3D directory, the binaries should be placed there. I will report back when I've found a proper way for having the binary working 😺

SoapSpangledGames commented 1 week ago

I built it with "scons target=template_release arch=x86_64 platform=linux", and I found it under demo/addons/Tree3D. However, I need to build the debug version.

FibreFoX commented 1 week ago

I am a bit puzzled, I have rechecked the build system, the glibc installed there is having glibc 2.39 installed:

root@a5ca9727583b:/source# /lib/x86_64-linux-gnu/libc.so.6
GNU C Library (Ubuntu GLIBC 2.39-0ubuntu8.3) stable release version 2.39.
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 13.2.0.
libc ABIs: UNIQUE IFUNC ABSOLUTE
Minimum supported kernel: 3.2.0
For bug reporting instructions, please see:
<https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>.

When switching to Ubuntu 20.04 it states the following:

root@3bdb336af230:/source# /lib/x86_64-linux-gnu/lib
libc-2.31.so        libc.so.6           libfakeroot/        libpthread-2.31.so  libpthread.so       libpthread.so.0
root@3bdb336af230:/source# /lib/x86_64-linux-gnu/libc.so.6
GNU C Library (Ubuntu GLIBC 2.31-0ubuntu9.16) stable release version 2.31.
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 9.4.0.
libc ABIs: UNIQUE IFUNC ABSOLUTE
For bug reporting instructions, please see:
<https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>.

Can you show me, what lib the .so file is showing to on your system? ldd demo/addons/Tree3D/libTree3D.linux.template_debug.x86_64.so

How did you get the information about glibc 3.4.32 ?

SoapSpangledGames commented 1 week ago

Woohoo! It worked! I have a default tree in my scene now:

image

SoapSpangledGames commented 1 week ago

ldd libTree3D.linux.template_debug.x86_64.so

linux-vdso.so.1 (0x00007ffcdd0eb000) libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f406a6cf000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f406a57f000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f406a387000) /lib64/ld-linux-x86-64.so.2 (0x00007f406a9af000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f406a367000)

FibreFoX commented 1 week ago

I am looking back to the original report: https://github.com/JekSun97/gdTree3D/issues/2#issuecomment-2338452642

Can you please change the title of this issue to Requires GLIBCXX 3.4.32 please? Because that's a different library ;)

Just to make sure, can you post me which version it is (ls -althr /lib/x86_64-linux-gnu/libstdc++.so.6) ?

EDIT: Can you post what versions your system supports?

strings /lib/x86_64-linux-gnu/libstdc++.so.6  | grep GLIBCXX
SoapSpangledGames commented 1 week ago

I got the information about the library when I ran Godot from the command line.

SoapSpangledGames commented 1 week ago

ls -althr /lib/x86_64-linux-gnu/libstdc++.so.6

lrwxrwxrwx 1 root root 19 Jul 9 2023 /lib/x86_64-linux-gnu/libstdc++.so.6 -> libstdc++.so.6.0.28

strings /lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX

GLIBCXX_3.4 GLIBCXX_3.4.1 GLIBCXX_3.4.2 GLIBCXX_3.4.3 GLIBCXX_3.4.4 GLIBCXX_3.4.5 GLIBCXX_3.4.6 GLIBCXX_3.4.7 GLIBCXX_3.4.8 GLIBCXX_3.4.9 GLIBCXX_3.4.10 GLIBCXX_3.4.11 GLIBCXX_3.4.12 GLIBCXX_3.4.13 GLIBCXX_3.4.14 GLIBCXX_3.4.15 GLIBCXX_3.4.16 GLIBCXX_3.4.17 GLIBCXX_3.4.18 GLIBCXX_3.4.19 GLIBCXX_3.4.20 GLIBCXX_3.4.21 GLIBCXX_3.4.22 GLIBCXX_3.4.23 GLIBCXX_3.4.24 GLIBCXX_3.4.25 GLIBCXX_3.4.26 GLIBCXX_3.4.27 GLIBCXX_3.4.28 GLIBCXX_DEBUG_MESSAGE_LENGTH

FibreFoX commented 1 week ago

Compiled with Ubuntu 20.04

root@9029fe173472:/source# strings demo/addons/Tree3D/libTree3D.linux.template_release.x86_64.so | grep GLIBCXX
GLIBCXX_3.4.18
GLIBCXX_3.4.11
GLIBCXX_3.4.15
GLIBCXX_3.4

Compiled with Ubuntu 22.04

GLIBCXX_3.4.18
GLIBCXX_3.4.29
GLIBCXX_3.4.11
GLIBCXX_3.4.15
GLIBCXX_3.4

Compiled with Ubuntu 24.04

root@9029fe173472:/source# strings demo/addons/Tree3D/libTree3D.linux.template_release.x86_64.so | grep GLIBCXX
GLIBCXX_3.4.32
GLIBCXX_3.4.18
GLIBCXX_3.4.29
GLIBCXX_3.4.11
GLIBCXX_3.4.15
GLIBCXX_3.4

When compiled with Ubuntu 24.04 the generated SO file is 4kb less in size for the template_release-version.

@JekSun97 What versions of Ubuntu do you want to support? Right now there are no proper restrictions from Godot itself, so there are no checks available. There is another issue at the Godot project, where static linking was discussed: https://github.com/godotengine/godot/issues/3468 We might be able to create a special version for these kind of Linux versions (not only Ubuntu) that have a pretty old version of libstdc++6. I am not sure about the implications (because I am not a C/C++ programmer).

For me there are now multiple options:

EDIT: as far as I can see, the generated .so files with the older libstdc++6 do work on more modern Ubuntu-versions, so maybe we "just" need make a change to the Dockerfile

Example:

FROM ubuntu:20.04

RUN apt-get update && apt-get install -y \
# linux build dependencies
gcc g++ gcc-multilib g++-multilib \
# windows build dependencies
mingw-w64 \
# build system
python3 python3-pip

# use specific SCons version
# Godot 4.0 needs a specific version
# see https://github.com/godotengine/godot-cpp/issues/1518
# see https://github.com/godotengine/godot-cpp/pull/1526
RUN python3 -m pip install scons==4.7.0

WORKDIR /source
FibreFoX commented 1 week ago

One sidenote regarding static linking:

From what I found, it is adviced against static linking

FibreFoX commented 1 week ago

@SoapSpangledGames An alternative, that came up very frequently while researching:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -y

This adds a repository to your Ubuntu-system ... but there might be a lot of other packages, that you would "by accident" replace. So I am not sure if that solution would fit your needs.

EDIT:

1. Nobody wants backup, everybody wants restore.
2. To restore, you need a backup.
3. Have a backup. 

https://adminzen.org/backup/

SoapSpangledGames commented 1 week ago

My personal opinion is to avoid statically linking system libraries, as security fixes in system libraries are too important to rely on application programmers to apply.

I've always been fine with statically linking application libraries, though.

SoapSpangledGames commented 1 week ago

I will upgrade to the latest Ubuntu (I actually use Kubuntu) shortly before end of life. I'm just waiting for Wayland to not suck. It seems to be getting there quickly, so I'm crossing my fingers that it will be ready before 20.04 support ends. With X11 on life support, there will soon be no other choice. The last time I tried to install Kubuntu with Wayland video on my three-monitor setup, it was an adventure that didn't end well.

I'm VERY wary of using system PPA's. I tried it once, and it completely hosed my system. I will likely not try them a second time.

FibreFoX commented 1 week ago

In the meantime, you just can use your custom compiled binaries ;) at least that works