amazonlinux / amazon-linux-2023

Amazon Linux 2023
https://aws.amazon.com/linux/amazon-linux-2023/
Other
501 stars 38 forks source link

[Bug] - `libstdc++` rebuild failure #627

Open denisgabriel5 opened 4 months ago

denisgabriel5 commented 4 months ago

Describe the bug I am trying to rebuild libstdc++ and it fails because of missing dependecies. I suspect that it needs i686 version of /lib/libc.so.6 and /usr/lib/libc.so.

To Reproduce Steps to reproduce the behavior:

  1. Create a tree of folders using rpmdev-setuptree. For the sake of the example let's use the $HOME directory, so run: cd $HOME && rpmdev-setuptree.
  2. Go to directory $HOME/rpmbuild/SOURCES
  3. Get source by running: dnf download --source libstdc++
  4. The step above will download a file called gcc-11.4.1-2.amzn2023.0.2.src.rpm. After that, rebuild by running: rpmbuild -rc gcc-11.4.1-2.amzn2023.0.2.src.rpm

Expected behavior Should create a directory containing the build in $HOME/rpmbuild/BUILD

Additional context I am running an AL2023 VM on an Ubuntu host using QEMU. I downloaded the AL2023 image from here.

Host: Linux 5.15.0-92-generic #102-Ubuntu SMP Wed Jan 10 09:33:48 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

VM: Linux 6.1.72-96.166.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jan 17 00:42:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

denisgabriel5 commented 4 months ago

@stewartsmith, do you have any suggestions for how I should tackle this problem?

stewartsmith commented 4 months ago

The quirk here is a result of how you have to end up bootstrapping the ability to build 32bit packages in a koji built linux distribution.

Although we don't ship any 32bit userspace in AL2023, we hedged our bets for a while on this just to see if we could find the use case and reason there was still 32bit packages in AL2.

Basically, you need to build a 32bit glibc, and then proceed with everything.

Needing a new libstdc++ is rather atypical though, and likely a sign you're trying to run binaries that have been built for a different OS.

denisgabriel5 commented 4 months ago

I am not trying to run binaries that have been built for a different OS, but rather recompile packages with different CFLAGS and CXXFLAGS.

I am completely open to hearing any suggestions you might have regarding alternative methods for doing this.

gorloffslava commented 4 months ago

@denisgabriel5 you have to use --disable-multilib flag, which is set by default in GCC configuration (libstdc++ is part of that). If you'd pass it somehow, it will only build the x86_64 variant of libraries and will not complain about the x86 one. Not sure how to do it w/ RPM, as we're usually building all our software from sources, but the following link may be helpful.

https://gcc.gnu.org/install/configure.html