Skip to content

Commit

Permalink
update gcc to v11 to fix build errors for Centos-8.1 and Ubuntu-18
Browse files Browse the repository at this point in the history
Summary:
The Ubuntu-18 build has been broken for long time and the similar issue has also been reported for
Centos-8.1 (#282).

c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [allocator/CMakeFiles/cachelib_allocator.dir/build.make:397:
allocator/CMakeFiles/cachelib_allocator.dir/CacheAllocator.cpp.o] Error 1

It seems that those issues can be fixed by using upper version of gcc (e.g., gcc-11). Both of those
platforms had been EOL-ed already, so this change fixes the builds for both Ubuntu-18 and Centos-8.1
by installing custom gcc packages and creating symbolic links manually (i.e., update-alternatives)
for github workflows.

Reviewed By: therealgymmy

Differential Revision: D52449219

fbshipit-source-id: 03c59216d7d6609882169e0eef208899be20473a
  • Loading branch information
Jaesoo Lee authored and facebook-github-bot committed Jan 12, 2024
1 parent d44f508 commit f404572
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build-cachelib-centos-8-1.yml
Expand Up @@ -53,8 +53,10 @@ jobs:
cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
- name: "install sudo,git"
run: dnf install -y sudo git cmake gcc
- name: "install sudo,git,gcc-11"
run: |
dnf install -y sudo git cmake gcc-toolset-11-gcc gcc-toolset-11-gcc-c++
update-alternatives --install /usr/bin/gcc gcc /opt/rh/gcc-toolset-11/root/usr/bin/gcc 110 --slave /usr/bin/g++ g++ /opt/rh/gcc-toolset-11/root/usr/bin/g++ --slave /usr/bin/gcov gcov /opt/rh/gcc-toolset-11/root/usr/bin/gcov --slave /usr/bin/gcc-ar gcc-ar /opt/rh/gcc-toolset-11/root/usr/bin/gcc-ar --slave /usr/bin/gcc-ranlib gcc-ranlib /opt/rh/gcc-toolset-11/root/usr/bin/gcc-ranlib --slave /usr/bin/cpp cpp /opt/rh/gcc-toolset-11/root/usr/bin/cpp
- name: "System Information"
run: |
echo === uname ===
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/build-cachelib-ubuntu-18.yml
Expand Up @@ -53,6 +53,13 @@ jobs:
apt-get update
apt-get install -y kitware-archive-keyring
apt-get install -y cmake
- name: "update gcc"
run: |
add-apt-repository ppa:ubuntu-toolchain-r/test -y
apt-get update
apt-get install -y gcc-11 g++-11
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7 --slave /usr/bin/gcov gcov /usr/bin/gcov-7 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-7 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-7
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-11 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-11
- name: "System Information"
run: |
echo === uname ===
Expand Down

0 comments on commit f404572

Please sign in to comment.