Skip to content

Drop Linux legacy ABI (_GLIBCXX_USE_CXX11_ABI=0) and standardize on C++17 - #1999

Open
AustinBenoit wants to merge 1 commit into
mainfrom
ab-drop-linux-legacy-abi
Open

AustinBenoit wants to merge 1 commit into
mainfrom
ab-drop-linux-legacy-abi

Conversation

@AustinBenoit

Copy link
Copy Markdown
Contributor

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:

  • CMake build (CMakeLists.txt, cmake/external_rules.cmake): Removed the mismatched FIREBASE_USE_LINUX_CXX11_ABI option (CMakeLists.txt declared FIREBASE_USE_LINUX_CXX11_ABI while checking FIREBASE_LINUX_USE_CXX11_ABI) and removed all -D_GLIBCXX_USE_CXX11_ABI flag forcing so Linux desktop builds inherit GCC 5+'s default ABI.
  • Packaging & CI (.github/workflows/cpp-packaging.yml, scripts/gha/build_desktop.py, build_scripts/desktop/get_variant.sh, release_build_files/CMakeLists.txt): Dropped the linux_abi matrix dimension (legacy/c++11) and --linux_abi CLI flag, simplified get_variant.sh to output ${arch}/cxx11 directly, and simplified release_build_files/CMakeLists.txt to always resolve libs/linux/${LINUX_CPU}/cxx11.
  • Integration tests (*/integration_test*/CMakeLists.txt): Removed hardcoded add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) from all 13 desktop integration test CMake files.
  • C++17 test script & docs (scripts/merge_libraries_test.py, AGENTS.md): Updated the remaining -std=c++11 invocation in scripts/merge_libraries_test.py to -std=c++17 and removed the stale -D_GLIBCXX_USE_CXX11_ABI=0 note from AGENTS.md.

Testing

  • Built firebase_app, firebase_database, firebase_auth, and desktop unit tests on Linux (GCC 15.2.0) and verified libfirebase_app.a exports std::__cxx11::basic_string symbols.
  • Ran firebase_app_rest_tls_policy_test and firebase_rtdb_util_desktop_test via ctest (2/2 passed).
  • Ran python3 scripts/merge_libraries_test.py --platform=linux (8/8 passed).
  • Verified build_scripts/desktop/get_variant.sh output for Linux x64/x86 (x86_64/cxx11, i386/cxx11), Windows, and macOS artifact filenames, and validated .github/workflows/cpp-packaging.yml YAML syntax.
  • Ran scripts/gha/check_copyright.sh -g.
  • Relying on CI for cross-platform (Windows/macOS/Android/iOS) and packaging matrix verification.

Type of Change

Place an x in the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

…++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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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)

Comment on lines +255 to 257
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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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  )

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

Successfully merging this pull request may close these issues.

1 participant