Skip to content

Explicitly set curl to build statically - #1907

Merged
a-maurice merged 2 commits into
mainfrom
am-static_curl
Aug 11, 2026
Merged

Explicitly set curl to build statically#1907
a-maurice merged 2 commits into
mainfrom
am-static_curl

Conversation

@a-maurice

Copy link
Copy Markdown
Contributor

Description

Provide details of the change, and generalize the change in the PR title above.

Explicitly set CMake flags to make curl build as a static library. Note that this should effectively be a no-op, since these flags are set by the underlying iOS Firestore CMake logic, the problem only occurs when building without enabling Firestore.


Testing

Describe how you've tested these changes. Link any manually triggered Integration tests or CPP binary SDK Packaging Github Action workflows, if applicable.

Building locally, and checking the resulting bundle symbols.


Type of Change

Place an x 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.

Notes

  • Bug fixes and feature changes require an update to the Release Notes section of release_build_files/readme.md.
  • Read the contribution guidelines CONTRIBUTING.md.
  • Changes to the public API require an internal API review. If you'd like to help us make Firebase APIs better, please propose your change in a feature request so that we can discuss it together.

@a-maurice a-maurice added the skip-release-notes Skip release notes check label Aug 10, 2026

@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 configures curl to build as a static library by setting BUILD_SHARED_LIBS and BUILD_CURL_EXE to OFF in CMakeLists.txt. The reviewer suggested defining these as local variables instead of cache variables to prevent polluting the global cache and to ensure they take effect properly when the project is included as a subdirectory.

Comment thread CMakeLists.txt Outdated
@a-maurice

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 modifies the CMake configuration for desktop builds to build curl as a static library and disable building the curl executable. The review feedback points out that setting BUILD_SHARED_LIBS globally to OFF can leak to other subdirectories and external libraries, and recommends saving and restoring its original value to prevent unintended side effects.

Comment thread CMakeLists.txt
Comment on lines +429 to +431
set(BUILD_SHARED_LIBS OFF)
set(BUILD_CURL_EXE OFF)
set(CURL_STATICLIB ON)

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.

high

Setting BUILD_SHARED_LIBS globally to OFF will leak to all subsequent subdirectories and external libraries (such as libuv, zlib, and the Firebase SDK components themselves like app, analytics, etc.). This overrides any user-specified BUILD_SHARED_LIBS setting for the rest of the build.\n\nTo prevent this side effect, you should save the original value of BUILD_SHARED_LIBS before modifying it, and restore it immediately after add_external_library(curl) (around line 450).\n\nSince add_external_library(curl) is outside of this diff hunk, please apply the following pattern:\n\n1. Save the variable state here (using the code suggestion below).\n2. Restore it after add_external_library(curl):\ncmake\nif(DEFINED OLD_BUILD_SHARED_LIBS)\n set(BUILD_SHARED_LIBS ${OLD_BUILD_SHARED_LIBS})\nelse()\n unset(BUILD_SHARED_LIBS)\nendif()\n

  set(OLD_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})\n  set(BUILD_SHARED_LIBS OFF)\n  set(BUILD_CURL_EXE OFF)\n  set(CURL_STATICLIB ON)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Firebase C++ expects the dependencies to be static, so this should have no issue.

@a-maurice
a-maurice requested a review from AustinBenoit August 10, 2026 23:15
@a-maurice
a-maurice merged commit 8715933 into main Aug 11, 2026
39 checks passed
@a-maurice
a-maurice deleted the am-static_curl branch August 11, 2026 17:25
@github-actions github-actions Bot added the tests: in-progress This PR's integration tests are in progress. label Aug 11, 2026
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

❌  Integration test FAILED

Requested by @a-maurice on commit 8715933
Last updated: Tue Aug 11 15:38 PDT 2026
View integration test log & download artifacts

Failures Configs
missing_log [BUILD] [ERROR] [iOS] [macos]
[TEST] [ERROR] [Android] [All 3 os] [1/2 android_device: android_target]
messaging [TEST] [FAILURE] [Linux] [x64] [openssl]
(1 failed tests)  FirebaseMessagingTest.TestRegistrationOnInitEnabled
[TEST] [FAILURE] [Windows] [x64] [openssl]
(1 failed tests)  FirebaseMessagingTest.TestRegistrationOnInitEnabled

Add flaky tests to go/fpl-cpp-flake-tracker

@github-actions github-actions Bot added the tests: failed This PR's integration tests failed. label Aug 11, 2026
@firebase-workflow-trigger firebase-workflow-trigger Bot removed the tests: in-progress This PR's integration tests are in progress. label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-release-notes Skip release notes check tests: failed This PR's integration tests failed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants