Date: 01-02-23  Time: 22:28 PM

Author Topic: gcc11  (Read 4026 times)

0 Members and 1 Guest are viewing this topic.

yuzhichang

  • Jr. Member
  • **
  • Posts: 9
  • Karma: +0/-0
gcc11
« on: March 13, 2022, 03:15:39 AM »
The only workable gcc suite I found on AIX 6.1 is gcc 6.3.0 from perzl.org.
Some drawbacks of this package:
 - Many dependencies, without good management.
 - supports only C++14. I need C++17 features such as filesystem and atomic. I could build and install boost libraries but it's not ideal. I have managed to make other build envs(CentOS5, CentOS6, Win7) support C++17.

Any chance of packaging the latest gcc11 ...
Thanks for all you do...

yuzhichang

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1339
  • Karma: +0/-0
Re: gcc11
« Reply #1 on: March 14, 2022, 08:30:25 AM »
I'll think about it. But I have not built gcc for a long long time - as I don't use it. I also decided that support packages that demand gcc were not something I would pursue either.

But I'll think about it. I'm 'smarter' now than I was then, and should be able to fix many of the issues. HOWEVER, the bottleneck I recall is that after gcc-4.7.4 - you needed gcc to build gcc, i.e., starting with gcc5 they made many assumptions about the compiler used to compile gcc. And that introduces the dependency nightmare.

yuzhichang

  • Jr. Member
  • **
  • Posts: 9
  • Karma: +0/-0
Re: gcc11
« Reply #2 on: March 14, 2022, 08:44:42 AM »
Yes. Building gcc11 requires gcc5.0+. Here's my Dockerfile to build gcc11 on CentOS5 64bit:



FROM centos:5
RUN rm -f /etc/yum.repos.d/*
ADD centos5-vault.repo /etc/yum.repos.d/
RUN echo /usr/local/lib > /etc/ld.so.conf.d/local.conf && echo /usr/local/lib64 >> /etc/ld.so.conf.d/local.conf
ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig
ARG NUM_CPU=48
RUN yum install -y bzip2 gcc-c++ make m4 flex texinfo file pkgconfig perl expat-devel zlib-devel gettext \
    which openssh-clients rsync bzip2-devel readline-devel mesa-libGLU-devel man xz patch \
    libXt-devel libXtst libXrender libXi unzip libtool openssl-devel \
    && yum clean all && rm -rf /usr/share/locale
ADD clean /root/
WORKDIR /tmp

# The builtin ld is too old to work with gcc 11.2. It doesn't recognize option '-plugin'.
# binutils
COPY binutils-2.34.tar.bz2 /tmp
RUN tar xjf binutils-2.34.tar.bz2 \
    && cd binutils-2.34 && ./configure && make -j $NUM_CPU \
    && make install && /root/clean

# The builtin gcc 4.1.2 doesn't support C++11, and cannot build gcc 11.
# This can be solved with a ladder - gcc 5.5.
# gcc compilation depends on gmp, mpfr, mpc.
# gmp
COPY gmp-6.2.1.tar.bz2 /tmp
RUN tar xjf gmp-6.2.1.tar.bz2 \
    && cd gmp-6.2.1 && ./configure && make -j $NUM_CPU \
    && make install && /root/clean

# mpfr
COPY mpfr-4.1.0.tar.bz2 /tmp
RUN tar xjf mpfr-4.1.0.tar.bz2 \
    && cd mpfr-4.1.0 && ./configure && make -j $NUM_CPU \
    && make install && /root/clean

# mpc
COPY mpc-1.2.1.tar.gz /tmp
RUN tar xzf mpc-1.2.1.tar.gz \
    && cd mpc-1.2.1 && ./configure && make -j $NUM_CPU \
    && make install && /root/clean

# gcc 5.5
RUN yum install -y glibc-devel.i386 && yum clean all
COPY gcc-5.5.0.tar.gz /tmp
RUN tar xzf gcc-5.5.0.tar.gz \
    && cd gcc-5.5.0 && ./configure --enable-languages=c,c++ \
    && make -j $NUM_CPU && make install \
    && strip /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/5.5.0/* || true \
    && yum remove -y binutils libstdc++-devel \
    && cd /usr/local/bin && ln -s gcc cc && /root/clean

# gcc 11.2
COPY gcc-11.2.0.tar.gz /tmp
RUN tar xzf gcc-11.2.0.tar.gz \
    && cd gcc-11.2.0 && ./configure --enable-languages=c,c++ \
    && make -j $NUM_CPU && make install \
    && strip /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/11.2.0/* || true \
    && yum remove -y binutils libstdc++-devel \
    && cd /usr/local/bin && rm -f cc && ln -s gcc cc && /root/clean

# chrpath
COPY chrpath_0.16.orig.tar.gz /tmp
RUN tar xzf chrpath_0.16.orig.tar.gz \
    && cd chrpath-0.16 && ./configure && make install && /root/clean

# git
COPY git-2.35.1.tar.gz /tmp
RUN tar xzf git-2.35.1.tar.gz \
    && cd git-2.35.1 && ./configure --prefix=/usr/local && make -j $NUM_CPU  \
    && make NO_INSTALL_HARDLINKS=YesPlease install && /root/clean

# cmake
COPY cmake-3.13.5.tar.gz /tmp
RUN tar xzf cmake-3.13.5.tar.gz \
    && cd cmake-3.13.5 && ./bootstrap && make -j $NUM_CPU \
    && make install && /root/clean

# The builtin wget and curl are too old to connect https sites since they don't support TLS1.3. TLS1.3 was introduced in openssl1.1.1.
# The buildin perl 5.8.8 is too old to build openssl1.1.1.
# perl
COPY perl-5.10.0.tar.gz /tmp
RUN tar xzf perl-5.10.0.tar.gz \
    && cd perl-5.10.0 \
    && ./configure.gnu && make -j $NUM_CPU && make install \
    && /root/clean

# pyhton 3.6+ ssl module requires openssl 1.1.1+
# "OpenSSL 1.1.x is not fully source compatible with OpenSSL 1.0.2." refers to https://github.com/openssl/openssl/issues/9772.
# This means installing to /usr/local/lib may break app compilation.
COPY openssl-1.1.1m.tar.gz /tmp
RUN tar xzf openssl-1.1.1m.tar.gz \
    && cd openssl-1.1.1m \
    && ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl shared \
    && make -j $NUM_CPU && make install \
    && /root/clean

# packages need by python optional modules: _dbm _gdbm _lzma _sqlite3 _tkinter _uuid
# Too old: ncurses-devel sqlite-devel
# TODO: failed to build ncurses 5.4, 5.7, 5.9
RUN yum install -y gdbm-devel sqlite-devel xz-devel tk-devel libffi-devel libuuid-devel \
    && yum clean all

# sqlite
COPY sqlite-autoconf-3380000.tar.gz /tmp
RUN tar xzf sqlite-autoconf-3380000.tar.gz \
    && cd sqlite-autoconf-3380000 \
    && ./configure && make -j $NUM_CPU install \
    && /root/clean

# python 3.10
COPY Python-3.10.2.tgz /tmp
RUN tar xzf Python-3.10.2.tgz \
    && cd Python-3.10.2 && ./configure --with-openssl=/usr/local/openssl --with-openssl-rpath=auto --enable-shared && make -j $NUM_CPU \
    && make install && /root/clean

# SCons
RUN pip3 install scons -i https://pypi.tuna.tsinghua.edu.cn/simple

# autoconf
COPY autoconf-2.69.tar.gz /tmp
RUN tar xzf autoconf-2.69.tar.gz \
    && cd autoconf-2.69 \
    && ./configure && make -j $NUM_CPU install \
    && /root/clean

# automake
COPY automake-1.16.5.tar.gz /tmp
RUN tar xzf automake-1.16.5.tar.gz \
    && cd automake-1.16.5 \
    && ./configure && make -j $NUM_CPU install \
    && /root/clean

# go
COPY go1.17.8.linux-amd64.tar.gz /tmp
RUN cd /usr/local && tar xzf /tmp/go1.17.8.linux-amd64.tar.gz && /root/clean
ENV PATH=/usr/local/go/bin:$PATH


Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1339
  • Karma: +0/-0
Re: gcc11
« Reply #3 on: March 14, 2022, 10:47:07 AM »
Thanks for the extra info.

Guess first bootstrap is to build gcc5 using 4.7.4 (would have been nicer, so maybe I'll look at that) to bootstrap using xlc to build gcc-4.8.X (with experimental c++11 support).

However, as I'll need all the other things such as: mpfr, mpc, etc.. I can try and rebuild those using xlc - and with those built and installed try building gcc5, then gcc11.

Not in a day is my expectation. :)

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1339
  • Karma: +0/-0
Re: gcc11
« Reply #4 on: March 14, 2022, 02:17:56 PM »
update: built the libraries - and set dependencies: gmp, mpc, mpfr.

Further: no time to figure out a 'bug' in the gmp configure script. In any case, it _forces_ 64-bit ABI only. FYI.

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1339
  • Karma: +0/-0
Re: gcc11
« Reply #5 on: March 22, 2022, 07:35:17 AM »
update: I have been trying to rebuild the gcc I built years ago, still not successful.

Reason: I want to be sure the builds are clean - AND - I am going to follow a modified recommendation from gcc - to use static libraries for gmp, mpc, and mpfr. Will also look into the library PPL (iirc).

yuzhichang

  • Jr. Member
  • **
  • Posts: 9
  • Karma: +0/-0
Re: gcc11
« Reply #6 on: May 14, 2022, 07:21:40 AM »
bash-5.0# oslevel -s
6100-07-00-0000

I installed gcc-c++-6.3.0-1.aix6.1.ppc.rpm (from perzl.org), then following packages one by one:
https://ftp.gnu.org/gnu/texinfo/texinfo-6.8.tar.gz
https://ftp.gnu.org/gnu/binutils/binutils-2.34.tar.bz2
https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.bz2
https://ftp.gnu.org/gnu/mpfr/mpfr-4.1.0.tar.bz2
http://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz
https://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.gz

Building gcc failed with the error:
Code: [Select]
gcc -g -O2  -o fixincl fixincl.o fixtests.o fixfixes.o server.o procopen.o fixlib.o fixopts.o ../libiberty/libiberty.a
collect2: fatal error: ../libiberty/libiberty.a: not a COFF file
compilation terminated.


Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1339
  • Karma: +0/-0
Re: gcc11
« Reply #7 on: May 16, 2022, 11:18:07 AM »
bash-5.0# oslevel -s
6100-07-00-0000

I installed gcc-c++-6.3.0-1.aix6.1.ppc.rpm (from perzl.org), then following packages one by one:
https://ftp.gnu.org/gnu/texinfo/texinfo-6.8.tar.gz
https://ftp.gnu.org/gnu/binutils/binutils-2.34.tar.bz2
https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.bz2
https://ftp.gnu.org/gnu/mpfr/mpfr-4.1.0.tar.bz2
http://ftp.gnu.org/gnu/mpc/mpc-1.2.1.tar.gz
https://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.gz

Building gcc failed with the error:
Code: [Select]
gcc -g -O2  -o fixincl fixincl.o fixtests.o fixfixes.o server.o procopen.o fixlib.o fixopts.o ../libiberty/libiberty.a
collect2: fatal error: ../libiberty/libiberty.a: not a COFF file
compilation terminated.

Try both
Code: [Select]
ar -X32 tv ../libiberty/libiberty.a and
Code: [Select]
ar -X64 tv ../libiberty/libiberty.a. The message probaly means you have members in the archive - of the wrong ABI.

The default ABI is 32-bit.

yuzhichang

  • Jr. Member
  • **
  • Posts: 9
  • Karma: +0/-0
Re: gcc11
« Reply #8 on: May 17, 2022, 01:21:56 AM »
 The `/usr/local/bin/ar` and `/usr/local/bin/ranlib` introduced by binutils-2.34.tar.bz2 make the existing gcc-6.3 unable to link any executables.
Removing them recovers the gcc-6.3, but doesn't help to build gcc-11.2.
I'm blocked.

yuzhichang

  • Jr. Member
  • **
  • Posts: 9
  • Karma: +0/-0
Re: gcc11
« Reply #9 on: May 17, 2022, 06:46:21 AM »
Did you try building clang on AIX 6.1?

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1339
  • Karma: +0/-0
Re: gcc11
« Reply #10 on: May 17, 2022, 11:25:02 AM »
I have not been working on gcc. Was frustrated that I could not rebuild what I had built before.

Next week - I might have time to investigate again. Priority #1 is finish my presentation for COMMON Europe, next month.

yuzhichang

  • Jr. Member
  • **
  • Posts: 9
  • Karma: +0/-0
Re: gcc11
« Reply #11 on: June 22, 2022, 06:34:58 AM »
Did you have chance look into this issue?

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1339
  • Karma: +0/-0
Re: gcc11
« Reply #12 on: June 23, 2022, 07:23:08 AM »
I'll start again. First get rebuilt what I had first. As a test

yuzhichang

  • Jr. Member
  • **
  • Posts: 9
  • Karma: +0/-0
Re: gcc11
« Reply #13 on: August 09, 2022, 07:38:33 AM »
Any update on this?

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1339
  • Karma: +0/-0
Re: gcc11
« Reply #14 on: August 11, 2022, 03:27:13 PM »
Going to start all over again, with a more historical build system - and rebuild gcc 4.7.4 again.

If I can't recreate that - as I was doing in 2014 - I have little confidence going forward.

Testing...

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1339
  • Karma: +0/-0
Re: gcc11
« Reply #15 on: August 16, 2022, 07:08:22 AM »
Almost there. Seems I discovered something 8+ years ago - to get it to complete, but cannot recall what that was.

Sigh.

Michael

  • Administrator
  • Hero Member
  • *****
  • Posts: 1339
  • Karma: +0/-0
Re: gcc11
« Reply #16 on: August 25, 2022, 12:21:59 PM »
Sadly, keep running into barriers. Will continue next week.