Repository navigation
Drop Linux legacy ABI (_GLIBCXX_USE_CXX11_ABI=0) and standardize on C++17 - #1999
AustinBenoit wants to merge 2 commits into
Conversation
…++17 Remove the legacy pre-GCC-5 Linux ABI (_GLIBCXX_USE_CXX11_ABI=0) option and build/package variants so Linux builds use GCC's default ABI and C++17: - Remove FIREBASE_USE_LINUX_CXX11_ABI / _GLIBCXX_USE_CXX11_ABI flag forcing from CMakeLists.txt and cmake/external_rules.cmake. - Drop the linux_abi matrix axis and legacy variant handling from cpp-packaging.yml, scripts/gha/build_desktop.py, build_scripts/desktop/get_variant.sh, and release_build_files/CMakeLists.txt. - Remove hardcoded -D_GLIBCXX_USE_CXX11_ABI=0 from integration test CMakeLists. - Update scripts/merge_libraries_test.py from -std=c++11 to -std=c++17 and remove stale _GLIBCXX_USE_CXX11_ABI=0 guidance from AGENTS.md.
There was a problem hiding this comment.
Code Review
This pull request standardizes Linux builds on the modern C++11 ABI by removing legacy ABI configurations (-D_GLIBCXX_USE_CXX11_ABI=0) across CMake files, integration tests, and build scripts. It also updates the compilation standard in scripts/merge_libraries_test.py to C++17. The review feedback recommends adding check=True to the subprocess.run call in the test script to ensure compilation errors are caught, and using keyword arguments for the cmake_configure call in scripts/gha/build_desktop.py to improve readability.
| if not os.path.exists(_TEST_FILE): | ||
| logging.info("Compiling merge_libraries_test_file.cc") | ||
| subprocess.run(['g++', '-O2', '-std=c++11', '-c', 'scripts/merge_libraries_test_file.cc', '-o', 'test_file.o']) | ||
| subprocess.run(['g++', '-O2', '-std=c++17', '-c', 'scripts/merge_libraries_test_file.cc', '-o', 'test_file.o']) |
There was a problem hiding this comment.
When compiling the test file with g++, it is highly recommended to pass check=True to subprocess.run. Without check=True, if the compilation fails (e.g., due to a missing compiler or syntax error), the script will continue silently and fail later with a less clear error when attempting to archive the non-existent object file.
| subprocess.run(['g++', '-O2', '-std=c++17', '-c', 'scripts/merge_libraries_test_file.cc', '-o', 'test_file.o']) | |
| subprocess.run(['g++', '-O2', '-std=c++17', '-c', 'scripts/merge_libraries_test_file.cc', '-o', 'test_file.o'], check=True) |
| cmake_configure(args.build_dir, args.arch, args.msvc_runtime_library, | ||
| args.build_tests, args.config, args.target_format, | ||
| args.use_openssl, args.disable_vcpkg, args.firestore_dep_source, args.gha_build, args.verbose) |
There was a problem hiding this comment.
To improve readability and prevent errors when passing a large number of arguments, consider using keyword arguments when calling cmake_configure.
cmake_configure(\n build_dir=args.build_dir,\n arch=args.arch,\n msvc_runtime_library=args.msvc_runtime_library,\n build_tests=args.build_tests,\n config=args.config,\n target_format=args.target_format,\n use_openssl=args.use_openssl,\n disable_vcpkg=args.disable_vcpkg,\n firestore_dep_source=args.firestore_dep_source,\n gha_build=args.gha_build,\n verbose=args.verbose,\n )
Description
Removes the legacy pre-GCC-5 Linux libstdc++ ABI (
_GLIBCXX_USE_CXX11_ABI=0) option, build variants, and hardcoded test overrides so all Linux desktop builds use GCC's default modern C++11+ ABI (_GLIBCXX_USE_CXX11_ABI=1) and C++17.Key changes:
CMakeLists.txt,cmake/external_rules.cmake): Removed the mismatchedFIREBASE_USE_LINUX_CXX11_ABIoption (CMakeLists.txtdeclaredFIREBASE_USE_LINUX_CXX11_ABIwhile checkingFIREBASE_LINUX_USE_CXX11_ABI) and removed all-D_GLIBCXX_USE_CXX11_ABIflag forcing so Linux desktop builds inherit GCC 5+'s default ABI..github/workflows/cpp-packaging.yml,scripts/gha/build_desktop.py,build_scripts/desktop/get_variant.sh,release_build_files/CMakeLists.txt): Dropped thelinux_abimatrix dimension (legacy/c++11) and--linux_abiCLI flag, simplifiedget_variant.shto output${arch}/cxx11directly, and simplifiedrelease_build_files/CMakeLists.txtto always resolvelibs/linux/${LINUX_CPU}/cxx11.*/integration_test*/CMakeLists.txt): Removed hardcodedadd_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)from all 13 desktop integration test CMake files.scripts/merge_libraries_test.py,AGENTS.md): Updated the remaining-std=c++11invocation inscripts/merge_libraries_test.pyto-std=c++17and removed the stale-D_GLIBCXX_USE_CXX11_ABI=0note fromAGENTS.md.Testing
firebase_app,firebase_database,firebase_auth, and desktop unit tests on Linux (GCC 15.2.0) and verifiedlibfirebase_app.aexportsstd::__cxx11::basic_stringsymbols.firebase_app_rest_tls_policy_testandfirebase_rtdb_util_desktop_testviactest(2/2 passed).python3 scripts/merge_libraries_test.py --platform=linux(8/8 passed).build_scripts/desktop/get_variant.shoutput for Linuxx64/x86(x86_64/cxx11,i386/cxx11), Windows, and macOS artifact filenames, and validated.github/workflows/cpp-packaging.ymlYAML syntax.scripts/gha/check_copyright.sh -g.Type of Change
Place an
xin the applicable box: