Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fbthrift, fizz, folly, mvfst] Fix dependency resolution. #23124

Merged
merged 8 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
28 changes: 28 additions & 0 deletions ports/fbthrift/add-missing-algorithm-include.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From f2151fa730058a1baf23ed3dc082c91df6351da1 Mon Sep 17 00:00:00 2001
From: "Zeyi (Rice) Fan" <[email protected]>
Date: Fri, 4 Feb 2022 15:17:53 -0800
Subject: [PATCH] fix build failure on Windows

Summary: Fix a build error on Windows where `std::mismatch` is not found.

Reviewed By: xavierd

Differential Revision: D34012963

fbshipit-source-id: 9f5aa21d03a92fdadf5bc83943a159a2f7872144
---
thrift/compiler/generate/build_templates.cc | 1 +
1 file changed, 1 insertion(+)

diff --git a/thrift/compiler/generate/build_templates.cc b/thrift/compiler/generate/build_templates.cc
index 56f13e8dde8..acd9dd30a75 100644
--- a/thrift/compiler/generate/build_templates.cc
+++ b/thrift/compiler/generate/build_templates.cc
@@ -14,6 +14,7 @@
* limitations under the License.
*/

+#include <algorithm>
#include <fstream>
#include <iostream>
#include <iterator>
12 changes: 9 additions & 3 deletions ports/fbthrift/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
if (VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()

vcpkg_find_acquire_program(FLEX)
vcpkg_find_acquire_program(BISON)

Expand All @@ -7,13 +11,15 @@ vcpkg_from_github(
REF v2022.01.31.00
SHA512 159457398fdc0c89c34364b8a89068127c3519ce35af349776016e0ae37ae9508689853e0e371c2065fd715451f466e37c7e3799e054eca02cbc4717809150ab
HEAD_REF master
PATCHES
add-missing-algorithm-include.patch # https://github.com/facebook/fbthrift/commit/f2151fa730058a1baf23ed3dc082c91df6351da1
)

vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBISON_EXECUTABLE=${BISON}
-DFLEX_EXECUTABLE=${FLEX}
"-DBISON_EXECUTABLE=${BISON}"
"-DFLEX_EXECUTABLE=${FLEX}"
)

vcpkg_cmake_install()
Expand Down
1 change: 1 addition & 0 deletions ports/fbthrift/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "fbthrift",
"version-string": "2022.01.31.00",
"port-version": 1,
"description": "Facebook's branch of Apache Thrift, including a new C++ server.",
"homepage": "https://github.com/facebook/fbthrift",
"supports": "x64",
Expand Down
35 changes: 0 additions & 35 deletions ports/fizz/0001-fix-libsodium.patch

This file was deleted.

106 changes: 106 additions & 0 deletions ports/fizz/fix-dependencies.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
diff --git a/fizz/CMakeLists.txt b/fizz/CMakeLists.txt
index bb3e15e..2547114 100644
--- a/fizz/CMakeLists.txt
+++ b/fizz/CMakeLists.txt
@@ -54,23 +54,23 @@ find_package(folly CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)

find_package(OpenSSL REQUIRED)
-find_package(Glog REQUIRED)
-find_package(DoubleConversion REQUIRED)
+find_package(Glog CONFIG REQUIRED)
BillyONeal marked this conversation as resolved.
Show resolved Hide resolved
+find_package(double-conversion CONFIG REQUIRED)
find_package(Threads REQUIRED)
-find_package(Zstd REQUIRED)
+find_package(Zstd CONFIG REQUIRED)
if (UNIX AND NOT APPLE)
find_package(Librt)
endif()

include(CheckAtomic)

-find_package(Sodium REQUIRED)
+find_package(unofficial-sodium CONFIG REQUIRED)

SET(FIZZ_SHINY_DEPENDENCIES "")
SET(FIZZ_LINK_LIBRARIES "")
SET(FIZZ_INCLUDE_DIRECTORIES "")

-find_package(gflags CONFIG QUIET)
+find_package(gflags CONFIG REQUIRED)
if (gflags_FOUND)
message(STATUS "Found gflags from package config")
if (TARGET gflags-shared)
@@ -92,7 +92,7 @@ endif()

find_package(ZLIB REQUIRED)

-find_package(Libevent CONFIG QUIET)
+find_package(Libevent CONFIG REQUIRED)
if(TARGET event)
message(STATUS "Found libevent from package config")
list(APPEND FIZZ_SHINY_DEPENDENCIES event)
@@ -240,30 +240,24 @@ target_include_directories(
PUBLIC
$<BUILD_INTERFACE:${FIZZ_BASE_DIR}>
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
- ${FOLLY_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
- ${sodium_INCLUDE_DIR}
- ${ZSTD_INCLUDE_DIR}
PRIVATE
- ${GLOG_INCLUDE_DIRS}
${FIZZ_INCLUDE_DIRECTORIES}
- ${DOUBLE_CONVERSION_INCLUDE_DIRS}
)


target_link_libraries(fizz
PUBLIC
- ${FOLLY_LIBRARIES}
+ Folly::folly Folly::folly_deps Folly::follybenchmark Folly::folly_test_util
${OPENSSL_LIBRARIES}
- sodium
+ unofficial-sodium::sodium
Threads::Threads
ZLIB::ZLIB
- ${ZSTD_LIBRARY}
+ $<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>
PRIVATE
- ${GLOG_LIBRARIES}
- ${GFLAGS_LIBRARIES}
+ glog::glog
${FIZZ_LINK_LIBRARIES}
- ${DOUBLE_CONVERSION_LIBRARIES}
+ double-conversion::double-conversion
${CMAKE_DL_LIBS}
${LIBRT_LIBRARIES})

diff --git a/fizz/cmake/fizz-config.cmake.in b/fizz/cmake/fizz-config.cmake.in
index 679b0e6..c129ab9 100644
--- a/fizz/cmake/fizz-config.cmake.in
+++ b/fizz/cmake/fizz-config.cmake.in
@@ -26,10 +26,22 @@ endif()
set(FIZZ_LIBRARIES fizz::fizz)

include(CMakeFindDependencyMacro)
-find_dependency(Sodium)
find_dependency(folly CONFIG)
+find_dependency(fmt CONFIG)
+find_dependency(OpenSSL)
+find_dependency(Glog CONFIG)
+find_dependency(double-conversion CONFIG)
+find_dependency(Threads)
+find_dependency(Zstd CONFIG)
+
+find_dependency(unofficial-sodium CONFIG)
+
+find_dependency(gflags CONFIG)
+
find_dependency(ZLIB)

+find_dependency(Libevent CONFIG)
+
if (NOT fizz_FIND_QUIETLY)
message(STATUS "Found fizz: ${PACKAGE_PREFIX_DIR}")
endif()
5 changes: 4 additions & 1 deletion ports/fizz/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ vcpkg_from_github(
SHA512 544f843f47cb6113d0ad804079e6d767f33723d9d529c2751c5c6317d65c35bd327b43852904b2a37c2af615276176fe2de667907a9a460c0dfc7593eca46459
HEAD_REF master
PATCHES
0001-fix-libsodium.patch
fix-dependencies.patch
)

# Prefer installed config files
file(REMOVE
${SOURCE_PATH}/fizz/cmake/FindDoubleConversion.cmake
${SOURCE_PATH}/fizz/cmake/FindGMock.cmake
${SOURCE_PATH}/fizz/cmake/FindGflags.cmake
${SOURCE_PATH}/fizz/cmake/FindGlog.cmake
${SOURCE_PATH}/fizz/cmake/FindLibevent.cmake
)

vcpkg_cmake_configure(
Expand Down
3 changes: 3 additions & 0 deletions ports/fizz/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{
"name": "fizz",
"version-string": "2022.01.31.00",
"port-version": 1,
"description": "a TLS 1.3 implementation by Facebook",
"homepage": "https://github.com/facebookincubator/fizz",
"dependencies": [
"fmt",
"folly",
"libevent",
"libsodium",
"openssl",
"double-conversion",
{
"name": "vcpkg-cmake",
"host": true
Expand Down
6 changes: 3 additions & 3 deletions ports/folly/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ vcpkg_cmake_config_fixup()
# We substitute with generator expressions so that the right libraries are linked for debug and release.
set(FOLLY_TARGETS_CMAKE "${CURRENT_PACKAGES_DIR}/share/folly/folly-targets.cmake")
FILE(READ ${FOLLY_TARGETS_CMAKE} _contents)
string(REPLACE "\${_IMPORT_PREFIX}/lib/zlib.lib" "ZLIB::ZLIB" _contents "${_contents}")
STRING(REPLACE "\${_IMPORT_PREFIX}/lib/" "\${_IMPORT_PREFIX}/\$<\$<CONFIG:DEBUG>:debug/>lib/" _contents "${_contents}")
STRING(REPLACE "\${_IMPORT_PREFIX}/debug/lib/" "\${_IMPORT_PREFIX}/\$<\$<CONFIG:DEBUG>:debug/>lib/" _contents "${_contents}")
string(REPLACE "\${VCPKG_IMPORT_PREFIX}/lib/zlib.lib" "ZLIB::ZLIB" _contents "${_contents}")
STRING(REPLACE "\${VCPKG_IMPORT_PREFIX}/lib/" "\${VCPKG_IMPORT_PREFIX}/\$<\$<CONFIG:DEBUG>:debug/>lib/" _contents "${_contents}")
STRING(REPLACE "\${VCPKG_IMPORT_PREFIX}/debug/lib/" "\${VCPKG_IMPORT_PREFIX}/\$<\$<CONFIG:DEBUG>:debug/>lib/" _contents "${_contents}")
string(REPLACE "-vc140-mt.lib" "-vc140-mt\$<\$<CONFIG:DEBUG>:-gd>.lib" _contents "${_contents}")
FILE(WRITE ${FOLLY_TARGETS_CMAKE} "${_contents}")
FILE(READ "${CURRENT_PACKAGES_DIR}/share/folly/folly-config.cmake" _contents)
Expand Down
1 change: 1 addition & 0 deletions ports/folly/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "folly",
"version-string": "2022.01.31.00",
"port-version": 1,
"description": "An open-source C++ library developed and used at Facebook. The library is UNSTABLE on Windows",
"homepage": "https://github.com/facebook/folly",
"license": "Apache-2.0",
Expand Down
6 changes: 0 additions & 6 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1432,12 +1432,6 @@ usbmuxd:x64-windows-static-md=fail
workflow:x64-uwp=fail
workflow:arm-uwp=fail

# wangle triggers an internal compiler error
# https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems/edit/1269468
wangle:x64-windows=fail
wangle:x64-windows-static=fail
wangle:x64-windows-static-md=fail

# VS2019 version 16.9.4's project system changes where PDBs are placed in a way that breaks the
# upstream build script of this port.
# See https://developercommunity.visualstudio.com/t/Toolset-169-regression-vcxproj-producin/1356639
Expand Down