Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions .github/workflows/cpp-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ jobs:
path: firebase-cpp-sdk-android-package.tgz

build_desktop:
name: build-${{ matrix.sdk_platform }}-${{ matrix.architecture }}-${{ matrix.build_type }}-${{ matrix.msvc_runtime }}-${{ matrix.linux_abi }}
name: build-${{ matrix.sdk_platform }}-${{ matrix.architecture }}-${{ matrix.build_type }}-${{ matrix.msvc_runtime }}
runs-on: ${{ matrix.os }}
if: ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
strategy:
Expand All @@ -346,7 +346,6 @@ jobs:
build_type: ["Release", "Debug"]
architecture: ["x64", "x86", "arm64"]
msvc_runtime: ["static", "dynamic"]
linux_abi: ["legacy", "c++11"]
python_version: [3.9]
include:
- os: windows-2022
Expand All @@ -366,14 +365,10 @@ jobs:
sdk_platform: "darwin"

exclude:
- os: windows-2022
linux_abi: "c++11"
- os: macos-26
architecture: "x86"
- os: macos-26
msvc_runtime: "dynamic"
- os: macos-26
linux_abi: "c++11"
- os: macos-26
build_type: "Debug"
- os: ubuntu-22.04
Expand Down Expand Up @@ -409,8 +404,8 @@ jobs:
shell: bash
run: |
echo "VCPKG_RESPONSE_FILE=external/vcpkg_${{ matrix.vcpkg_triplet }}_response_file.txt" >> $GITHUB_ENV
echo "MATRIX_UNIQUE_NAME=${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}-${{ matrix.msvc_runtime }}-${{ matrix.linux_abi }}" >> $GITHUB_ENV
echo "SDK_NAME=${{ matrix.sdk_platform }}-${{ matrix.architecture }}-${{ matrix.build_type }}-${{ matrix.msvc_runtime }}-${{ matrix.linux_abi }}" >> $GITHUB_ENV
echo "MATRIX_UNIQUE_NAME=${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.architecture }}-${{ matrix.python_version }}-${{ matrix.msvc_runtime }}" >> $GITHUB_ENV
echo "SDK_NAME=${{ matrix.sdk_platform }}-${{ matrix.architecture }}-${{ matrix.build_type }}-${{ matrix.msvc_runtime }}" >> $GITHUB_ENV
if [[ '${{ matrix.sdk_platform }}' == 'darwin' ]]; then
# If Mac, also hash vcpkg cache on Xcode version.
echo "VCPKG_EXTRA_HASH=-xcode${{env.xcodeVersion}}" >> $GITHUB_ENV
Expand All @@ -425,7 +420,7 @@ jobs:
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # ratchet:actions/cache@v6
with:
path: external/vcpkg/installed
key: dev-vcpkg-${{ matrix.architecture }}-${{ matrix.vcpkg_triplet_suffix }}-${{ matrix.msvc_runtime }}-${{ matrix.linux_abi }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }}${{env.VCPKG_EXTRA_HASH}}
key: dev-vcpkg-${{ matrix.architecture }}-${{ matrix.vcpkg_triplet_suffix }}-${{ matrix.msvc_runtime }}-${{ hashFiles(format('{0}', env.VCPKG_RESPONSE_FILE)) }}-${{ hashFiles('.git/modules/external/vcpkg/HEAD') }}${{env.VCPKG_EXTRA_HASH}}

- name: Cache ccache files
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
Expand Down Expand Up @@ -461,7 +456,7 @@ jobs:
# Run the build in the host OS default shell since Windows can't handle long path names in bash.
- name: Build desktop SDK
run: |
python scripts/gha/build_desktop.py --arch "${{ matrix.architecture }}" --config "${{ matrix.build_type }}" --msvc_runtime_library "${{ matrix.msvc_runtime }}" --linux_abi "${{ matrix.linux_abi }}" --build_dir out-sdk ${VERBOSE_FLAG} ${{ matrix.additional_build_flags }} --gha_build
python scripts/gha/build_desktop.py --arch "${{ matrix.architecture }}" --config "${{ matrix.build_type }}" --msvc_runtime_library "${{ matrix.msvc_runtime }}" --build_dir out-sdk ${VERBOSE_FLAG} ${{ matrix.additional_build_flags }} --gha_build

- name: Archive SDK
shell: bash
Expand Down
3 changes: 1 addition & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ Common system library dependencies for desktop:
* **macOS**: Common dependencies include `pthread` (system library) and
frameworks like `CoreFoundation`, `Foundation`, `Security`, and
`SystemConfiguration`.
* **Linux**: Common dependencies include `pthread` (system library). When
using GCC 5+, define `-D_GLIBCXX_USE_CXX11_ABI=0`.
* **Linux**: Common dependencies include `pthread` (system library).

On all desktop platforms, building with -DFIREBASE_USE_BORINGSSL=YES can help
bypass any OpenSSL dependency issues.
Expand Down
11 changes: 0 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ option(FIREBASE_CPP_USE_PRIOR_GRADLE_BUILD
"When building with Gradle, use the previously built libraries." OFF)
option(FIREBASE_USE_BORINGSSL
"Build against BoringSSL instead of using your system's OpenSSL." OFF)
option(FIREBASE_USE_LINUX_CXX11_ABI
"Build Linux SDK using the C++11 ABI instead of the legacy ABI." OFF)

# This should only be enabled by the GitHub Action build script.
option(FIREBASE_GITHUB_ACTION_BUILD
Expand Down Expand Up @@ -179,15 +177,6 @@ if(DESKTOP AND NOT MSVC AND NOT APPLE)
# Linux-specific option.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-maybe-uninitialized")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized")
if (FIREBASE_LINUX_USE_CXX11_ABI)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=1")
else()
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
endif()

if(FIREBASE_GITHUB_ACTION_BUILD)
Expand Down
1 change: 0 additions & 1 deletion analytics/integration_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ if(ANDROID)
set(ADDITIONAL_LIBS log android atomic native_app_glue)
else()
# Build a desktop application.
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

# Prevent overriding the parent project's compiler/linker
# settings on Windows
Expand Down
1 change: 0 additions & 1 deletion app/integration_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ if(ANDROID)
set(ADDITIONAL_LIBS log android atomic native_app_glue)
else()
# Build a desktop application.
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

# Prevent overriding the parent project's compiler/linker
# settings on Windows
Expand Down
1 change: 0 additions & 1 deletion app_check/integration_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ if(ANDROID)
set(ADDITIONAL_LIBS log android atomic native_app_glue)
else()
# Build a desktop application.
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

# Prevent overriding the parent project's compiler/linker
# settings on Windows
Expand Down
1 change: 0 additions & 1 deletion auth/integration_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ if(ANDROID)
set(ADDITIONAL_LIBS log android atomic native_app_glue)
else()
# Build a desktop application.
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

# Prevent overriding the parent project's compiler/linker
# settings on Windows
Expand Down
12 changes: 1 addition & 11 deletions build_scripts/desktop/get_variant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ arch_win=
debugmode=Release
msvc_runtime_library=MD
vs=VS2019
linux_abi=legacy

for c in $(echo "${filename}" | tr "[:upper:]" "[:lower:]" | tr "_.-" "\n\n\n"); do
case $c in
Expand Down Expand Up @@ -119,15 +118,6 @@ for c in $(echo "${filename}" | tr "[:upper:]" "[:lower:]" | tr "_.-" "\n\n\n");
debug)
debugmode=Debug
;;
cxx11)
linux_abi=cxx11
;;
c++11)
linux_abi=cxx11
;;
legacy)
linux_abi=legacy
;;
vs2019)
vs=VS2019
;;
Expand Down Expand Up @@ -158,7 +148,7 @@ case ${os} in
echo "Couldn't determine architecture" 1>&2
exit 1
fi
echo -n "${arch}/${linux_abi}"
echo -n "${arch}/cxx11"
;;
windows)
if [[ -z "${arch_win}" ]]; then
Expand Down
10 changes: 0 additions & 10 deletions cmake/external_rules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,6 @@ function(build_external_dependencies)
endif()
else()
# Propagate Linux build flags.
get_directory_property(CURR_DIRECTORY_DEFS COMPILE_DEFINITIONS)
if("${CURR_DIRECTORY_DEFS}" MATCHES "_GLIBCXX_USE_CXX11_ABI=0" OR
"${CMAKE_CXX_FLAGS}" MATCHES "-D_GLIBCXX_USE_CXX11_ABI=0")
set(SUBBUILD_USE_CXX11_ABI 0)
else()
set(SUBBUILD_USE_CXX11_ABI 1)
endif()
set(CMAKE_SUB_CONFIGURE_OPTIONS ${CMAKE_SUB_CONFIGURE_OPTIONS}
-DCMAKE_C_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=${SUBBUILD_USE_CXX11_ABI}"
-DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=${SUBBUILD_USE_CXX11_ABI}")
if(CMAKE_TOOLCHAIN_FILE)
set(CMAKE_SUB_CONFIGURE_OPTIONS ${CMAKE_SUB_CONFIGURE_OPTIONS}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
Expand Down
1 change: 0 additions & 1 deletion database/integration_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ if(ANDROID)
set(ADDITIONAL_LIBS log android atomic native_app_glue)
else()
# Build a desktop application.
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

# Prevent overriding the parent project's compiler/linker
# settings on Windows
Expand Down
1 change: 0 additions & 1 deletion firestore/integration_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ if(ANDROID)
set(ADDITIONAL_LIBS log android atomic native_app_glue)
else()
# Build a desktop application.
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

# Prevent overriding the parent project's compiler/linker
# settings on Windows
Expand Down
1 change: 0 additions & 1 deletion firestore/integration_test_internal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ else()
set(ABSEIL_CPP_ROOT ${CMAKE_CURRENT_LIST_DIR}/external/abseil-cpp/src/abseil-cpp)

# Build a desktop application.
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

# Prevent overriding the parent project's compiler/linker
# settings on Windows
Expand Down
1 change: 0 additions & 1 deletion functions/integration_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ if(ANDROID)
set(ADDITIONAL_LIBS log android atomic native_app_glue)
else()
# Build a desktop application.
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

# Prevent overriding the parent project's compiler/linker
# settings on Windows
Expand Down
1 change: 0 additions & 1 deletion installations/integration_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ if(ANDROID)
set(ADDITIONAL_LIBS log android atomic native_app_glue)
else()
# Build a desktop application.
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

# Prevent overriding the parent project's compiler/linker
# settings on Windows
Expand Down
1 change: 0 additions & 1 deletion messaging/integration_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ if(ANDROID)
set(ADDITIONAL_LIBS log android atomic native_app_glue)
else()
# Build a desktop application.
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

# Prevent overriding the parent project's compiler/linker
# settings on Windows
Expand Down
17 changes: 1 addition & 16 deletions release_build_files/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,13 @@ elseif(MSVC)
set(FIREBASE_SDK_LIBDIR
${FIREBASE_CPP_SDK_DIR}/libs/windows/${MSVC_VS_VERSION}/${MSVC_RUNTIME_MODE}/${MSVC_CPU}/${MSVC_CONFIG})
else() # LINUX
# Check whether we are building with CXX11 ABI.
get_directory_property(CURR_DIRECTORY_DEFS COMPILE_DEFINITIONS)
if ("${CURR_DIRECTORY_DEFS}" MATCHES "_GLIBCXX_USE_CXX11_ABI=0" OR
"${CMAKE_CXX_FLAGS}" MATCHES "-D_GLIBCXX_USE_CXX11_ABI=0")
set(DISABLE_CXX11 TRUE)
set(LINUX_ABI legacy)
else()
set(DISABLE_CXX11 FALSE)
set(LINUX_ABI cxx11)
endif()
# Check if we are building for x86
if (" ${CMAKE_CXX_FLAGS} " MATCHES " -m32 ")
set(LINUX_CPU i386)
else()
set(LINUX_CPU x86_64)
endif()
set(FIREBASE_SDK_LIBDIR ${FIREBASE_CPP_SDK_DIR}/libs/linux/${LINUX_CPU}/${LINUX_ABI})
set(FIREBASE_SDK_LIBDIR ${FIREBASE_CPP_SDK_DIR}/libs/linux/${LINUX_CPU}/cxx11)
endif()

# Defines a Firebase target, linking it with the correct prebuilt library.
Expand All @@ -81,11 +71,6 @@ function(add_firebase_target TARGET_NAME)
IMPORTED_LOCATION "${FIREBASE_SDK_LIBDIR}/${LIBRARY_NAME}"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/include"
)
if(${DISABLE_CXX11})
set_target_properties(${TARGET_NAME} PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "_GLIBCXX_USE_CXX11_ABI=0"
)
endif()
endif()
endfunction()

Expand Down
1 change: 0 additions & 1 deletion remote_config/integration_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ if(ANDROID)
set(ADDITIONAL_LIBS log android atomic native_app_glue)
else()
# Build a desktop application.
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

# Prevent overriding the parent project's compiler/linker
# settings on Windows
Expand Down
10 changes: 2 additions & 8 deletions scripts/gha/build_desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def install_cpp_dependencies_with_vcpkg(arch, msvc_runtime_library, cleanup=True
# could be several GBs and cause github runners to run out of space
utils.clean_vcpkg_temp_data()

def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='legacy',
def cmake_configure(build_dir, arch, msvc_runtime_library='static',
build_tests=True, config=None, target_format=None,
use_openssl=False, disable_vcpkg=False, firestore_dep_source=None,
gha_build=False, verbose=False):
Expand All @@ -145,7 +145,6 @@ def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='l
build_dir (str): Output build directory.
arch (str): Platform Architecture (example: 'x64', 'x86', 'arm64').
msvc_runtime_library (str): Runtime library for MSVC (eg: 'static', 'dynamic').
linux_abi (str): Linux ABI (eg: 'legacy', 'c++11').
build_tests (bool): Build cpp unit tests.
config (str): Release/Debug config.
If its not specified, cmake's default is used (most likely Debug).
Expand Down Expand Up @@ -210,9 +209,6 @@ def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='l
else:
cmd.append('-DCMAKE_OSX_ARCHITECTURES=x86_64')

if utils.is_linux_os() and linux_abi == 'c++11':
cmd.append('-DFIREBASE_LINUX_USE_CXX11_ABI=TRUE')

if (target_format):
cmd.append('-DFIREBASE_XCODE_TARGET_FORMAT={0}'.format(target_format))

Expand Down Expand Up @@ -256,7 +252,7 @@ def main():
return

# CMake configure
cmake_configure(args.build_dir, args.arch, args.msvc_runtime_library, args.linux_abi,
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)
Comment on lines +255 to 257

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  )


Expand All @@ -277,8 +273,6 @@ def parse_cmdline_args():
parser.add_argument('-a', '--arch', default='x64', help='Platform architecture (x64, x86, arm64)')
parser.add_argument('--msvc_runtime_library', default='static',
help='Runtime library for MSVC (static(/MT) or dynamic(/MD)')
parser.add_argument('--linux_abi', default='legacy',
help='C++ ABI for Linux (legacy or c++11)')
parser.add_argument('--build_dir', default='build', help='Output build directory')
parser.add_argument('--build_tests', action='store_true', help='Build unit tests too')
parser.add_argument('--verbose', action='store_true', help='Enable verbose CMake builds.')
Expand Down
2 changes: 1 addition & 1 deletion scripts/merge_libraries_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class MergeLibrariesTest(absltest.TestCase):
def setUp(self):
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)

subprocess.run([FLAGS.binutils_ar_cmd, 'rcs', _TEST_FILE, 'test_file.o'])
warnings.filterwarnings("ignore", category=ResourceWarning)

Expand Down
1 change: 0 additions & 1 deletion storage/integration_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ if(ANDROID)
set(ADDITIONAL_LIBS log android atomic native_app_glue)
else()
# Build a desktop application.
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

# Prevent overriding the parent project's compiler/linker
# settings on Windows
Expand Down
1 change: 0 additions & 1 deletion ump/integration_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ if(ANDROID)
set(ADDITIONAL_LIBS log android atomic native_app_glue)
else()
# Build a desktop application.
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

# Prevent overriding the parent project's compiler/linker
# settings on Windows
Expand Down
Loading