mirror of
https://github.com/facebook/proxygen.git
synced 2026-10-24 01:33:54 +03:00
getdeps: Fix shared libfolly link in no-system-packages builds
Summary: Fix the `oss-metaroce-linux-getdeps` continuous job, which fails when linking shared `libfolly.so` because source-built `libevent`, `zlib`, and `libaio` produce only static archives without position-independent code. Enable PIC for `zlib` and `libevent` (consistent with other manifests), and switch `libaio` to produce shared libraries so folly can link against them. Add a regression test that guards against these link inputs silently reverting. Re-enabling shared `libaio` was previously reverted (D93644345) but verified safe via a no-system-packages moxygen build. Blast radius is narrow: only `folly` and `cachelib` consume source-built libaio, and only `metaroce`/`rebalancer(-explorer)` request shared folly. Reviewed By: bigfootjon Differential Revision: D126978432 fbshipit-source-id: 56c67f890e2f99ecd3ae800f82adba71e475bcf9
This commit is contained in:
committed by
meta-codesync[bot]
parent
e80cd91c19
commit
1cc8ee8465
@@ -5,7 +5,9 @@
|
||||
|
||||
|
||||
import unittest
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from ..buildopts import BuildOptions
|
||||
from ..load import load_all_manifests, patch_loader
|
||||
from ..manifest import ManifestParser
|
||||
|
||||
@@ -223,6 +225,35 @@ foo = bar
|
||||
manifests = load_all_manifests(None)
|
||||
self.assertNotEqual(0, len(manifests), msg="parsed some number of manifests")
|
||||
|
||||
def test_shared_folly_link_inputs(self) -> None:
|
||||
# Shared libfolly.so links third-party static archives. Those archives
|
||||
# must be position-independent, and libaio must install a shared
|
||||
# library, or the no-system-packages builds fail in the folly link.
|
||||
patch_loader(__name__)
|
||||
# The resource loader ignores build options; a mock only satisfies
|
||||
# the type signature.
|
||||
manifests = load_all_manifests(MagicMock(spec=BuildOptions))
|
||||
for name in ("zlib", "libevent", "libaio"):
|
||||
self.assertIn(name, manifests, msg="manifest still exists")
|
||||
for name in ("zlib", "libevent"):
|
||||
defines = manifests[name].get_section_as_dict("cmake.defines", {})
|
||||
self.assertEqual(
|
||||
defines.get("CMAKE_POSITION_INDEPENDENT_CODE"),
|
||||
"ON",
|
||||
msg=name + " archives stay linkable into shared libfolly.so",
|
||||
)
|
||||
libaio = manifests["libaio"]
|
||||
self.assertIn(
|
||||
"ENABLE_SHARED=1",
|
||||
libaio.get_section_as_args("make.build_args", {}),
|
||||
msg="source-built libaio provides libaio.so with version nodes",
|
||||
)
|
||||
self.assertIn(
|
||||
"ENABLE_SHARED=1",
|
||||
libaio.get_section_as_args("make.install_args", {}),
|
||||
msg="source-built libaio installs libaio.so with version nodes",
|
||||
)
|
||||
|
||||
def test_mismatch_name(self) -> None:
|
||||
with self.assertRaisesRegex(
|
||||
Exception,
|
||||
|
||||
@@ -17,8 +17,8 @@ builder = make
|
||||
subdir = libaio-0.3.113
|
||||
|
||||
[make.build_args]
|
||||
ENABLE_SHARED=0
|
||||
ENABLE_SHARED=1
|
||||
|
||||
[make.install_args]
|
||||
install
|
||||
ENABLE_SHARED=0
|
||||
ENABLE_SHARED=1
|
||||
|
||||
@@ -30,6 +30,7 @@ EVENT__DISABLE_BENCHMARK = ON
|
||||
EVENT__DISABLE_SAMPLES = ON
|
||||
EVENT__DISABLE_REGRESS = ON
|
||||
EVENT__LIBRARY_TYPE = STATIC
|
||||
CMAKE_POSITION_INDEPENDENT_CODE = ON
|
||||
|
||||
[dependencies.not(any(os=linux, os=freebsd))]
|
||||
openssl
|
||||
|
||||
@@ -27,3 +27,6 @@ sha256 = 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23
|
||||
builder = cmake
|
||||
subdir = zlib-1.3.1
|
||||
patchfile = zlib_dont_build_more_than_needed.patch
|
||||
|
||||
[cmake.defines]
|
||||
CMAKE_POSITION_INDEPENDENT_CODE = ON
|
||||
|
||||
Reference in New Issue
Block a user