All Products
Search
Document Center

Alibaba Cloud Linux:Compatibility between the GCC or Glibc versions on Alibaba Cloud Linux 3 and CentOS 8

Last Updated:Apr 02, 2026

Alibaba Cloud Linux 3 ships with GCC 10 and Glibc 2.32, while CentOS 8 ships with GCC 8 and Glibc 2.28. This version gap introduces both forward and backward compatibility constraints that affect how your binaries and source code behave after migration.

This topic explains Application Binary Interface (ABI) and Application Programming Interface (API) compatibility between the two distributions, lists the specific changes in GCC 10 and Glibc 2.32 that can break existing code, and describes how to fix each issue.

Background

GCC and Glibc compatibility falls into two categories:

  • ABI compatibility: Compiled binaries run without recompilation.

  • API compatibility: Source code compiles without modification.

Forward compatibility (CentOS 8 to Alibaba Cloud Linux 3): libstdc++ and Glibc are highly forward-compatible. Binaries compiled against GCC 8 and Glibc 2.28 on CentOS 8 can run on Alibaba Cloud Linux 3 (GCC 10, Glibc 2.32) without recompilation in most cases.

Backward compatibility (Alibaba Cloud Linux 3 to CentOS 8): libstdc++ and Glibc are not backward-compatible. Binaries compiled against GCC 10 and Glibc 2.32 on Alibaba Cloud Linux 3 cannot run on CentOS 8 without recompilation.

GCC itself does not have ABI compatibility implications. The ABI compatibility impact attributed to GCC comes from the libstdc++ library, which is distributed as part of the GCC package.

Changes in Glibc 2.32 and their impacts

The following tables describe breaking changes between Glibc 2.28 (CentOS 8) and Glibc 2.32 (Alibaba Cloud Linux 3).

time

Change Compatibility type Impact Fix
stime is no longer declared in <time.h>. API Compilation error if stime is used in source code. Use clock_settime instead.
ftime is deprecated. API Compilation error if ftime is used in source code. Use clock_gettime instead.
gettimeofday no longer reports timezone information. API gettimeofday cannot retrieve timezone information. Use clock_gettime instead.
settimeofday is labeled obsolete by POSIX. API settimeofday cannot configure the time and time drift simultaneously. Use clock_settime and adjtime instead.
nanosleep now uses the clock_nanosleep system call internally instead of the nanosleep system call. API In seccomp mode, applications cannot call nanosleep if clock_nanosleep is not on the seccomp whitelist. Add clock_nanosleep to the seccomp whitelist.

sysctl

Change Compatibility type Impact Fix
The <sys/sysctl.h> header file is removed. API Code that includes <sys/sysctl.h> fails to compile. Remove the #include <sys/sysctl.h> line from your code.
The sysctl function is removed. It remains as a compatibility symbol, but the underlying system call always fails with ENOSYS. API Calls to sysctl always fail at runtime. Access /proc/sys directly instead. To get random bytes, use getentropy.

sstk

Change Compatibility type Impact Fix
sstk is no longer declared in header files. ABI Binaries compiled on Glibc 2.28 remain ABI-compatible with Glibc 2.32. However, any program that calls sstk at runtime receives a failure return value, which may cause unexpected behavior. Remove all calls to sstk. Neither the kernel nor Glibc supports this function.
sstk is no longer declared in header files. API Compilation error if source code uses sstk. Remove all calls to sstk.

signal

Change Compatibility type Impact Fix
The sigmask macro and the following signal handling functions are deprecated: siginterrupt, sigpause, sighold, sigrelse, sigignore, sigset. ABI Binaries compiled on Glibc 2.28 remain ABI-compatible with libc.so. No action required for existing binaries.
The sigmask macro and the following signal handling functions are deprecated: siginterrupt, sigpause, sighold, sigrelse, sigignore, sigset. API Compilation produces a warning or error when using these functions or the macro. Replace them with sigsuspend, sigprocmask, and sigaction.
sys_siglist, _sys_siglist, and sys_sigabbrev are no longer declared in <string.h>. ABI Binaries compiled on Glibc 2.28 remain ABI-compatible with libc.so. No action required for existing binaries.
sys_siglist, _sys_siglist, and sys_sigabbrev are no longer declared in <string.h>. API Compilation produces a warning or error when using these names. Use strsignal instead.

sys_errlist and related symbols

Change Compatibility type Impact Fix
sys_errlist, _sys_errlist, sys_nerr, and _sys_nerr are no longer declared in <stdio.h>. ABI Binaries compiled on Glibc 2.28 remain ABI-compatible with libc.so. No action required for existing binaries.
sys_errlist, _sys_errlist, sys_nerr, and _sys_nerr are no longer declared in <stdio.h>. API Compilation produces a warning or error when using these names. Use strerror or strerror_r instead.

copy_file_range

Change Compatibility type Impact Fix
The simulated implementation of copy_file_range is removed. API If the kernel does not support copy_file_range, calling the function returns ENOSYS. Provide a fallback implementation of copy_file_range in your application for kernels that lack support. The default kernel for Alibaba Cloud Linux 3 is 5.10, which supports copy_file_range natively.

thread

Change Compatibility type Impact Fix
<sys/single_threaded.h> is added, which declares _libc_single_threaded. API Using weak references to pthread_create or pthread_key_create to detect whether an application is single-threaded is an obsolete pattern. Future Glibc versions will define pthread_create in libc.so.6, causing such detection to always report multi-threaded. Use the _libc_single_threaded variable to check single-threaded status.

Sun RPC

Change Compatibility type Impact Fix
Sun RPC is no longer supported. API All code that references Sun RPC header files fails to compile. Replace Sun RPC dependencies. See the fix details below.

To replace Sun RPC dependencies:

  • Use rpc/rpc.h from the libtorpc-devel package.

  • Use rpcsvc/*.h from the rpcsvc-proto-devel package.

  • Use the rpcgen program from the rpcgen package.

Changes in GCC 10 and their impacts

The following tables describe breaking changes between GCC 8 (CentOS 8) and GCC 10 (Alibaba Cloud Linux 3).

C language

Change Compatibility type Impact Fix
GCC 10 defaults to -fno-common. In GCC 8, multiple uninitialized global variables with the same name in different source files were silently merged into one (common block). GCC 10 treats this as a linker error. API Linker error: multiple definition of 'variable_name'. See fix details below.

Correct fix: Define the global variable in exactly one source file. Add extern to the declaration in all other files.

// header.h — incorrect: tentative definition in a header
int counter;   // This causes "multiple definition" with -fno-common

// header.h — correct: declaration only
extern int counter;   // Declare here

// counter.c — correct: define in exactly one source file
int counter = 0;

Workaround for legacy code: Compile with -fcommon to restore the previous behavior. This is a temporary measure; the correct fix is to remove duplicate definitions.

Fortran

Change Compatibility type Impact Fix
GCC 10 Fortran reports a compilation error when a call argument type does not match the declared parameter type. GCC 8 allowed this silently. API Compilation error for argument/parameter type mismatches. Correct fix: Match argument types to parameter declarations. Workaround: Use -fallow-argument-mismatch to downgrade the error to a warning.

C++ headers

Change Compatibility type Impact Fix
<stdexcept> and <string> are no longer transitively included by certain standard C++ headers. API Compilation error when types from <stdexcept> or <string> are used without an explicit include. Add the missing header files explicitly based on the error message.

Enumeration check

Change Compatibility type Impact Fix
GCC 10 enforces stricter checks on enumerations. Assigning a value from one enumeration type to a different enumeration type is now an error. API Compilation error for cross-enumeration assignments. Use enumerations correctly: do not assign values across different enumeration types.

Large System Extensions (LSE) — AArch64 only

Change Compatibility type Impact Fix
The -moutline-atomics option is added and is automatically enabled for -march=armv8-a. API At runtime, GCC-compiled code detects whether the AArch64 machine supports LSE (Large System Extensions) instructions and uses them for standard atomic operations, improving atomic concurrency. No action required in most cases. For details on AArch64 instruction set options in GCC 10, see AArch64 options.

Changes to GCC 10 warning options

The following table describes new and enhanced warning options in GCC 10 compared with GCC 8.

Compilation warnings do not directly affect API compatibility. If you see new warnings after migrating to Alibaba Cloud Linux 3, modify your source code to suppress them.
Option Change type Description
-Waddress-of-packed-member Added Warns when the address of a packed struct or union member is taken, resulting in an unaligned pointer. Enabled by default.
-Wzero-length-bounds Added Warns about accesses to zero-length array members that may overlap other members of the same object. Enabled by -Warray-bounds.
-Warray-bounds Enhanced Now also warns about out-of-bounds accesses to member arrays and zero-length array elements.
-Wattribute-alias Enhanced Now warns about alias attribute declarations whose target type is incompatible with the alias type.
-Wformat-overflow Enhanced Warns about formatted output function calls that may overflow the destination buffer.
-Wmissing-attributes Added Warns when function attributes are present on a target but missing from its aliases.
-Wformat-truncation Enhanced Warns about formatted output calls (such as snprintf) that may truncate output. Works together with -Wformat-overflow.
-Wstringop-overflow Enhanced Warns about out-of-bounds stores to arrays and reads of unterminated character arrays by built-in string functions. Also warns about out-of-bounds accesses by user-defined functions declared with the access attribute.
-Wreturn-local-addr Enhanced Warns about return statements that return the address of an automatic (stack) variable.
-Wrestrict Enhanced Warns about overlapping memory accesses to dynamically allocated objects.
-Warith-conversion Enhanced Re-enables warnings from -Wconversion, -Wfloat-conversion, and -Wsign-conversion that were previously suppressed.

References

For a complete list of changes in each Glibc and GCC release, see the official release notes.

Glibc:

GCC: