You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #207 from firebase/feature/js-switch-to-boringssl
Allow all dependencies (curl, websockets, grpc) to use boringssl instead of openssl when making packaged C++ SDK.
This PR gives you the option to switch all desktop platforms over to using boringssl rather than openssl, which does not like being embedded in our SDKs. If you are building a binary SDK, you may want to enable this option. If you are linking directly to our SDK from source via cmake, you probably don't need it (but you should ensure that OpenSSL is installed on your system.
It will be enabled if you turn on FIREBASE_USE_BORINGSSL at cmake configure time, e.g.:
cmake [source directory] -DFIREBASE_USE_BORINGSSL=ON
With this option enabled, it will build boringssl during the configure step by shelling out to another instance of cmake. Much work is done in build_external_dependencies to ensure that this (and future) sub-builds correctly match the main project's selection of:
- CPU architecture
- build type (debug/release)
- Windows MSVC runtime
- Linux legacy/c++11 ABI
A few notes on switching to boringSSL:
- We manually set all of the OPENSSL_* flags that CMake's find_package(OpenSSL) sets, so that any subprojects using openssl will get the include files and libraries of boringssl instead.
- We have updated to the latest libcurl which supports boringssl properly.
- OpenSSL has been removed from the vcpkg files.
- Golang has been added as a prerequisite as it's required for boringssl's build. Github runners already have it installed, but I've added it to the prereqs script anyway.
Additional changes in this PR:
- The Linux build has been switched to use the legacy ABI rather than the C++11 ABI. An upcoming PR will enable both ABIs.
- Binutils on Mac is restored to the latest version, as openssl was the cause of the library corruption we were seeing.
- Some missing Firestore core headers are now added to the final C++ SDK package.
- Integration test github action now builds and runs both openssl and boringssl versions.
You'll also see a few workaround at the end of the download_external_sources function, this is to work around a few issues in subprojects that expect openssl but are now getting boringssl. There are PRs to fix these in the upstream sources, but until we update to their latest version these will need to be there.
# Now if we do find_package(OpenSSL) it should give us BoringSSL.
250
+
find_package(OpenSSL)
251
+
252
+
if(NOT"${OPENSSL_INCLUDE_DIR}"MATCHESboringsslOR
253
+
NOT"${OPENSSL_SSL_LIBRARY}"MATCHESboringsslOR
254
+
NOT"${OPENSSL_CRYPTO_LIBRARY}"MATCHESboringssl)
255
+
message(FATAL_ERROR"BoringSSL was not configured correctly.\nINCLUDE_DIR=${OPENSSL_INCLUDE_DIR}\nSSL_LIBRARY=${OPENSSL_SSL_LIBRARY}\nCRYPTO_LIBRARY=${OPENSSL_CRYPTO_LIBRARY}")
256
+
endif()
257
+
else()
258
+
# Don't use BoringSSL, use OpenSSL. If you are linking against the libraries directly
259
+
# from source, you probably want this instead.
260
+
#
261
+
# If the find_package fails to find OpenSSL, set OPENSSL_ROOT_DIR to OpenSSL'S install
262
+
# location on your system.
263
+
find_package(OpenSSLREQUIRED)
264
+
endif()
265
+
endif()
266
+
177
267
# Include Firestore's external build early to resolve conflicts on packages.
0 commit comments