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

Ubuntu-18.04 is too intruisive - forcing non compatible libstdc++ by default for c++ #3432

Closed
1 of 7 tasks
Milerius opened this issue May 21, 2021 · 10 comments
Closed
1 of 7 tasks

Comments

@Milerius
Copy link

Description

If you go start a fresh ubuntu 18.04 machine you should have the following:

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

However on your machine we got:

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_3.4.29

with GLIBCXX_3.4.29 -> https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html -> break abi forcing end user that download a app that have been build on github actions to have gcc 11.1.0 installed

due to strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep "GLIBCXX"

Please do not force such intruisive behaviour by default, every appimage that build on your VM 18.04 force user to atleast have gcc 11.1.0 or ubuntu hirsute

for infos: https://packages.ubuntu.com/bionic/libstdc++6 -> gcc 8.4.0 not gcc 11.1.0, if user want the last gcc, they should use the last ubuntu image, not the 18.04

Area for Triage:

Question, Bug, or Feature?:
Bug

Virtual environments affected

  • Ubuntu 16.04
  • Ubuntu 18.04
  • Ubuntu 20.04
  • macOS 10.15
  • macOS 11
  • Windows Server 2016 R2
  • Windows Server 2019

Expected behavior

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep "GLIBCXX"should return GLIBCXX_3.4.25 GLIBCXX_3.4.26 Maximum, not GLIBCXX_3.4.29

Actual behavior

A simple appimage build on 18.04 will produce the following behaviour:

smk762@pig:~/Downloads/atomicdex-desktop-ubuntu-qt-5-15-2-dc34150.zip/atomicdex-desktop-linux-dc34150/AntaraAtomicDexAppDir/usr/bin$ ./atomicdex-desktop
./atomicdex-desktop: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by ./atomicdex-desktop)
./atomicdex-desktop: /lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.13' not found (required by ./atomicdex-desktop)

Repro steps

Build an appimage with last version of clang using libstdc++ will produce the above error

@Milerius Milerius changed the title Ubuntu-18.04 is too intruisive - forcing non compatible binaries by default for c++ Ubuntu-18.04 is too intruisive - forcing non compatible libstdc++ by default for c++ May 21, 2021
@Darleev
Copy link
Contributor

Darleev commented May 21, 2021

Hello @Milerius,
There was another issue in the past, where it was requested to add gcc-11 to out Ubuntu images.
We will check this issue internally and inform you as soon as we make a decision.

@Darleev Darleev added investigate Collect additional information, like space on disk, other tool incompatibilities etc. Area: Clang OS: Ubuntu and removed needs triage labels May 21, 2021
@Milerius
Copy link
Author

Hello @Milerius,
There was another issue in the past, where it was requested to add gcc-11 to out Ubuntu images.
We will check this issue internally and inform you as soon as we make a decision.

I understand but 11.1.0 break the ABI, should not replace the default libstdc++ and break existing actions too !

Thanks for the response looking forward

@miketimofeev
Copy link
Contributor

miketimofeev commented May 21, 2021

@Milerius a small question — does GCC 10 also breaks the ABI or it's safe to leave version 10 on the image?

@Milerius
Copy link
Author

Milerius commented May 22, 2021

@Milerius a small question — does GCC 10 also breaks the ABI or it's safe to leave version 10 on the image?

I think the maximum version of 18.04 should be GCC 8.4, and on 20.04 GCC 10 according to official Ubuntu release

GCC 8.1.0: GLIBCXX_3.4.25, CXXABI_1.3.11

GCC 9.1.0: GLIBCXX_3.4.26, CXXABI_1.3.12

GCC 9.2.0: GLIBCXX_3.4.27, CXXABI_1.3.12

GCC 9.3.0: GLIBCXX_3.4.28, CXXABI_1.3.12

GCC 10.1.0: GLIBCXX_3.4.28, CXXABI_1.3.12

GCC 11.1.0: GLIBCXX_3.4.29, CXXABI_1.3.13

If you look at: https://packages.ubuntu.com/bionic/libstdc++6

You have the default version shipped for each Ubuntu distribution

@miketimofeev
Copy link
Contributor

@Milerius could you take a look at this PR #3451? What do you think about such an approach?

@jesec
Copy link
Contributor

jesec commented May 27, 2021

In #3376, a workaround has been suggested:

sudo apt-get autoremove -y libgcc-11-dev gcc-11

This deals with the header problem. It works well if you don't distribute built binaries to users. If you do distribute built binaries to users, and you expect the binaries to run Ubuntu 18.04, there is one more step to deal with the lib problem:

sudo apt-get install --allow-downgrades --no-remove --reinstall -y libstdc++6=8.4.0-1ubuntu1~18.04

You have to manually downgrade the C++ standard library.

Unfortunately, libstdc++ is so important that you can't remove the experimental PPA, uninstall the package and reinstall it from the Ubuntu archive. The version has to be explicitly specified here, and the downgrade must happen with reinstall. To get the version number:

$ apt-cache policy libstdc++6
libstdc++6:
  Installed: 8.4.0-1ubuntu1~18.04
  Candidate: 11.1.0-1ubuntu1~18.04.1
  Version table:
     11.1.0-1ubuntu1~18.04.1 500
        500 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu bionic/main amd64 Packages
 *** 8.4.0-1ubuntu1~18.04 500
        500 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
        100 /var/lib/dpkg/status
     8-20180414-1ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages

This again demonstrated how ugly the issue is. Feel free to share a way that allows the downgrade to happen without explicit version number.

jesec added a commit to vercel/pkg-fetch that referenced this issue May 27, 2021
Recently it comes to my attention that Github Actions image installs
experimental C++ standard library from an unsupported PPA, which
effectively breaks assumptions of binary compatibility for the OS
(in this case, Ubuntu 18.04+).

Unfortunately, as a result, the Github Actions environment can no
longer be trusted to compile proper binaries.

This change adds a Dockerfile that composes a proper Ubuntu 18.04
environment from official "ubuntu:bionic" image, and builds Node
binaries in it.

Bug: actions/runner-images#3432
jesec added a commit to vercel/pkg-fetch that referenced this issue May 27, 2021
Recently it comes to my attention that Github Actions image installs
experimental C++ standard library from an unsupported PPA, which
effectively breaks assumptions of binary compatibility for the OS
(in this case, Ubuntu 18.04+).

Unfortunately, as a result, the Github Actions environment can no
longer be trusted to compile proper binaries.

This change adds a Dockerfile that composes a proper Ubuntu 18.04
environment from official "ubuntu:bionic" image, and builds Node
binaries in it.

Bug: actions/runner-images#3432
@JCash
Copy link

JCash commented May 28, 2021

Thanks for the info @jesec !
However, after adding these two lines:

sudo apt-get autoremove -y libgcc-11-dev gcc-11
sudo apt-get install --allow-downgrades --no-remove --reinstall -y libstdc++6=8.4.0-1ubuntu1~18.04

I get the error:

sudo apt-get install --allow-downgrades --no-remove --reinstall -y libstdc++6=8.4.0-1ubuntu1~18.04
Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
g++-10 g++-9 libstdc++-10-dev libstdc++-9-dev
The following packages will be DOWNGRADED:
libstdc++6
0 upgraded, 0 newly installed, 1 downgraded, 4 to remove and 36 not upgraded.
E: Packages need to be removed but remove is disabled.

It seems related to the "--no-remove" flag, but since you got it working, I'm not sure.
Any ideas what I've missed?

@jesec
Copy link
Contributor

jesec commented May 28, 2021

Thanks for the info @jesec !
However, after adding these two lines:

sudo apt-get autoremove -y libgcc-11-dev gcc-11
sudo apt-get install --allow-downgrades --no-remove --reinstall -y libstdc++6=8.4.0-1ubuntu1~18.04

I get the error:

sudo apt-get install --allow-downgrades --no-remove --reinstall -y libstdc++6=8.4.0-1ubuntu1~18.04
Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
g++-10 g++-9 libstdc++-10-dev libstdc++-9-dev
The following packages will be DOWNGRADED:
libstdc++6
0 upgraded, 0 newly installed, 1 downgraded, 4 to remove and 36 not upgraded.
E: Packages need to be removed but remove is disabled.

It seems related to the "--no-remove" flag, but since you got it working, I'm not sure.
Any ideas what I've missed?

The flag is there to prevent accidental removal of libstdc++, as any C++ program will immediately break (incl. OS ones like dpkg and apt) without it.

Oops. It seems that on 18.04 the GCC 10 depends on libs from experimental PPA as well...

You have to remove GCC 10 as well in the previous (autoremove) step.

and maybe also 9...

@JCash
Copy link

JCash commented May 28, 2021

The updated snippet seems to work well, and the max version is now back to GLIBCXX_3.4.25.

sudo apt-get autoremove -y libgcc-9-dev gcc-9 libgcc-10-dev gcc-10 libgcc-11-dev gcc-11
sudo apt-get install --allow-downgrades --no-remove --reinstall -y libstdc++6=8.4.0-1ubuntu1~18.04

Thanks for the help!

@AlenaSviridenko
Copy link
Contributor

Hey! Ubuntu images without GCC 11 were fully deployed.
Please, let us know if the issue still persists, or feel free to close the issue if everything works fine. Thanks.

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

7 participants