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

"ada_language_server: /lib64/libc.so.6: version `GLIBC_2.28' not found" on CentOS 7 #1176

Open
rustyx opened this issue Dec 14, 2023 · 6 comments

Comments

@rustyx
Copy link

rustyx commented Dec 14, 2023

Extension isn't starting on CentOS 7:

ada_language_server: /lib64/libc.so.6: version `GLIBC_2.28' not found

Any way to work around this issue?

I have to build my project for CentOS 7

Note: CentOS 7 has glibc 2.17

@reznikmm
Copy link
Contributor

we build extension and ada_language_server on ubuntu 20.04 (the oldest provided by github action) that has glibc 2.31. That's why it doesn't work on glibc 2.17.

As a workaround, I can suggest you to build ALS from sources, if you has gcc 13.2 for your OS.

@rustyx
Copy link
Author

rustyx commented Dec 21, 2023

Compiling from source seems non-trivial as it requires quite a few dependencies and there is no automated way to get them (or I missed it).

Previous version of the VSCode Ada extension, v23.0.3 worked on CentOS 7.
It stopped working after an upgrade to v24.0.3.
Would it be possible to make it work as before?

It seems that only this one function from glibc is breaking it

$ objdump -T .vscode-server/extensions/adacore.ada-24.0.3/x64/linux/ada_language_server|grep -P "GLIBC_\d\.\d\d\)"|grep -vP "GLIBC_2.1[0-7]"
0000000000000000      DF *UND*  0000000000000000 (GLIBC_2.28) fcntl64

@reznikmm
Copy link
Contributor

Building from sources is not so hard, if you use my custom alire index. With the community alire index you can build ada_language_server 23.0.0 which is more than a year old.

What Ada compiler do you have on CentOS 7? I've found gcc-gnat-4.8.5 which too old. GNAT 13.2 from Alire doesn't work on CentOS 7.

We use GitHub Action runners to build vscode extension releases. We switched to ubuntu-20.024 in Nov 2022, as GitHub deprecated ubuntu-18.04.

@rustyx
Copy link
Author

rustyx commented Dec 21, 2023

We are a paid customer, we use GNAT PRO 24.0 (GCC 12.3.0).

For now rolling back to Ada extension version 23.0.21 "solved" the issue.

Just as a suggestion... GitHub Actions supports building in Docker and there is a centos:7 Docker image, so perhaps it's possible to build it that way? Then it would be compatible with almost any Linux version.

@reznikmm
Copy link
Contributor

GNAT Pro 24.0 should build ALS. Please open an issue at AdaCore customer support, if you are interested in further investigation.

GitHub Actions doesn't have access to GNAT Pro compiler. Without working compiler I can't build ALS even in Docker. I've tried to build GCC 13, GCC 12 with the Alire provided script, but it fails.

@rustyx
Copy link
Author

rustyx commented Jan 22, 2024

I tried the Alire way with both GNAT Pro 24.0 and a manually-built GNAT/GCC 12.3.0 and in both cases I run into all kinds of issues.

The farthest I got was with this Dockerfile:

FROM centos:7

RUN sed -i 's/^tsflags=/#tsflags=/' /etc/yum.conf

RUN yum install -y epel-release && yum install -y man-db && yum update -y && yum install -y \
    apr-devel \
    autoconf \
    autogen \
    automake \
    bison \
    bzip2-devel \
    doxygen \
    expat-devel \
    flex \
    getopt \
    gettext-devel \
    git \
    glibc-devel \
    gmp-devel \
    help2man \
    libcurl-devel \
    libffi-devel \
    libmpc-devel \
    libnl3-devel \
    libnsl \
    libnsl2-devel \
    libpcap-devel \
    libtool \
    libusb-devel \
    libxml2-devel \
    libzstd-devel \
    lz4-devel \
    make \
    minizip-devel \
    mpfr-devel \
    ncurses-devel \
    openssl-devel \
    patch \
    pcre2-devel \
    perl-CPAN \
    perl-IPC-Cmd \
    pkgconfig \
    python2 \
    python3-devel \
    qt5-qtbase-devel \
    qt5-qtmultimedia-devel \
    qt5-qttools-devel \
    readline-devel \
    sqlite-devel \
    texinfo \
    tigervnc \
    tigervnc-server \
    transfig \
    unzip \
    wget \
    which

ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/sbin:/usr/bin:/sbin:/bin

RUN wget -O gnat-bin --progress=dot:mega "https://community.download.adacore.com/v1/f3a99d283f7b3d07293b2e1d07de00e31e332325?filename=gnat-2021-20210519-x86_64-linux-bin"
RUN wget "https://raw.githubusercontent.com/AdaCore/gnat_community_install_script/master/install_script.qs"
RUN vncserver :9 -SecurityTypes None -autokill
RUN chmod +x gnat-bin && DISPLAY=:9 ./gnat-bin --script install_script.qs --platform minimal InstallPrefix="/opt/gnat"

RUN wget -O- --progress=dot:mega "https://ftp.gnu.org/gnu/gcc/gcc-12.3.0/gcc-12.3.0.tar.gz" | tar xz
RUN export PATH=/opt/gnat/bin:$PATH && \
    cd gcc-* && mkdir build && cd build && \
    ../configure --enable-languages=c,c++,ada,lto --disable-multilib && \
    make -j$(nproc) && make install

RUN rm -rf /opt/gnat && echo -e "/usr/local/lib64\n/usr/local/lib" >/etc/ld.so.conf.d/local.conf && ldconfig

RUN wget -O- --progress=dot:mega "https://github.com/AdaCore/gprbuild/archive/refs/tags/v24.0.0.tar.gz" | tar xz
RUN wget -O- --progress=dot:mega "https://github.com/AdaCore/xmlada/archive/refs/tags/v24.0.0.tar.gz" | tar xz
RUN wget -O- --progress=dot:mega "https://github.com/AdaCore/gprconfig_kb/archive/refs/tags/v24.0.0.tar.gz" | tar xz
RUN mv gprbuild-* gprbuild && mv xmlada-* xmlada && mv gprconfig_kb-* gprconfig_kb && \
    cd gprbuild && ./bootstrap.sh --with-xmlada=../xmlada --with-kb=../gprconfig_kb --prefix=./bootstrap && \
    export PATH=$PWD/bootstrap/bin:$PATH && \
    cd ../xmlada && ./configure && make -j$(nproc) && make install && \
    cd ../gprbuild && make prefix=/usr/local setup && make -j$(nproc) && make install

RUN wget -O- --progress=dot:mega "https://ftp.gnu.org/gnu/binutils/binutils-2.41.tar.gz" | tar xz
RUN cd /binutils-* && ./configure && make -j$(nproc) && make install

RUN wget -O- --progress=dot:mega "https://ftp.gnu.org/gnu/gdb/gdb-14.1.tar.gz" | tar xz
RUN cd /gdb-* && ./configure && make -j$(nproc) && make install

RUN wget -O- "https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz" | tar xJ
RUN cd /gmp-* && ./configure --prefix=/usr --libdir=/usr/lib64 && make -j$(nproc) && make install

RUN echo $'prefix=/usr\n\
exec_prefix=${prefix}\n\
libdir=${prefix}/lib64\n\
includedir=${prefix}/include\n\
Name: gmp \n\
Description: gmp\n\
Version: 6.3.0\n\
Libs: -L${libdir} -lgmp\n\
Cflags: -I${includedir}\n\
' > /usr/share/pkgconfig/gmp.pc

RUN wget -O- --progress=dot:mega "https://github.com/openssl/openssl/archive/refs/tags/openssl-3.1.4.tar.gz" | tar xz
RUN cd openssl-openssl-* && ./config shared --prefix=/usr/local/ && make -j$(nproc) && make install_sw

RUN echo -e "/usr/local/lib64\n/usr/local/lib\n" >/etc/ld.so.conf.d/local.conf && ldconfig
ENV LIBRARY_PATH=/usr/local/lib:/usr/local/lib64

RUN wget -O- --progress=dot:mega "https://github.com/python/cpython/archive/refs/tags/v3.11.7.tar.gz"| tar xz
RUN cd cpython-* && ./configure && make -j$(nproc) && make install && pip3 install --upgrade pip virtualenv

RUN wget -Oalr.zip "https://github.com/alire-project/alire/releases/download/v1.2.2/alr-1.2.2-bin-x86_64-linux.zip" && \
    unzip -d /usr/local/ alr.zip && rm -f alr.zip

RUN alr index --reset-community

RUN alr index --add git+https://github.com/reznikmm/als-alire-index.git --name als

RUN alr toolchain --select gnat_external gprbuild

RUN LIBRARY_TYPE=static STANDALONE=no alr -f -n get --build ada_language_server

It fails on the last line:

   [Ada]          tgen.ads
   [Ada]          tgen-types-record_types.adb
   [Ada]          tgen-numerics.ads
   [Ada]          tgen-json.adb
   [Ada]          tgen-big_reals_aux.adb
   [Ada]          tgen-types-real_types.adb
tgen-types-array_types.adb:828:31: warning: redundant conversion, expression is of type "Enum_Strategy_Type'Class" [-gnatwr]
tgen-types-record_types.adb:180:32: warning: redundant conversion, expression is of type "Strategy_Type'Class" [-gnatwr]
tgen-types-record_types.adb:345:37: warning: redundant conversion, expression is of type "Enum_Strategy_Type'Class" [-gnatwr]

   compilation of tgen-types-record_types.adb failed
   compilation of tgen-types-array_types.adb failed

gprbuild: *** compilation phase failed
error: Command ["gprbuild", "-s", "-j0", "-p", "-P", "/root/ada_language_server_24.0.3_d16dc8b2/alire/cache/dependencies/libadalang_tools_25.0.0_2a8f13e4/src/lal_tools.gpr"] exited with code 4

Also, running alr with BUILD_MODE=prod results in other errors (even after removing -flto flags from a couple of .gpr files like is done here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants