From 4b61d489dcb387a91202a015cb941233ac5a1537 Mon Sep 17 00:00:00 2001 From: Cullen Walsh Date: Tue, 1 Oct 2024 14:58:08 -0700 Subject: [PATCH] Make sure linker flags are exported by third party targets Summary: Tried to compile folly, got build failures. These were not caught in testing the previous round of changes because that testing focused on package install, and testing build targets were not broken. Reviewed By: bigfootjon Differential Revision: D63720428 fbshipit-source-id: d0b2b7b2031ae5e5a3195ddfc97fc789d4dd2938 --- shim/third-party/binutils/BUCK | 1 + shim/third-party/boost/boost.bzl | 4 ++-- shim/third-party/bzip2/BUCK | 2 +- shim/third-party/defs.bzl | 4 ++-- shim/third-party/double_conversion/BUCK | 2 +- shim/third-party/libaegis/BUCK | 8 +++----- shim/third-party/libaio/BUCK | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/shim/third-party/binutils/BUCK b/shim/third-party/binutils/BUCK index 84bdf5e5f..8f25070f8 100644 --- a/shim/third-party/binutils/BUCK +++ b/shim/third-party/binutils/BUCK @@ -11,6 +11,7 @@ oncall("open_source") system_library( name = "iberty", + exported_linker_flags = ["-liberty"], packages = { "//os:linux-fedora": ["binutils-devel"], "//os:linux-ubuntu": ["libiberty-dev"], diff --git a/shim/third-party/boost/boost.bzl b/shim/third-party/boost/boost.bzl index 5cfea253f..5fb6f3b64 100644 --- a/shim/third-party/boost/boost.bzl +++ b/shim/third-party/boost/boost.bzl @@ -26,7 +26,7 @@ def boost_libs(libraries, header_only): boost_library(library, True) def boost_library(library: str, header_only: bool): - linker_flags = [] if header_only else ["-lboost_{}".format(library)] + exported_linker_flags = [] if header_only else ["-lboost_{}".format(library)] system_library( name = "boost_{}".format(library), @@ -35,5 +35,5 @@ def boost_library(library: str, header_only: bool): "//os:linux-ubuntu": ["libboost-{}-dev".format(library)], "//os:macos-homebrew": ["boost"], }, - linker_flags = [] if header_only else ["-lboost_{}".format(library)], + exported_linker_flags = exported_linker_flags, ) diff --git a/shim/third-party/bzip2/BUCK b/shim/third-party/bzip2/BUCK index 275a34a14..1ee23b853 100644 --- a/shim/third-party/bzip2/BUCK +++ b/shim/third-party/bzip2/BUCK @@ -11,7 +11,7 @@ oncall("open_source") prebuilt_cxx_library( name = "pkgconfig_unsupported", - linker_flags = select({ + exported_linker_flags = select({ "//os:linux-ubuntu": ["-lbz2"], "DEFAULT": [], }), diff --git a/shim/third-party/defs.bzl b/shim/third-party/defs.bzl index a621bc254..b35a0b368 100644 --- a/shim/third-party/defs.bzl +++ b/shim/third-party/defs.bzl @@ -123,7 +123,7 @@ def homebrew_library( brew: str, homebrew_header_path = "include", exported_preprocessor_flags = [], - linker_flags = [], + exported_linker_flags = [], target_compatible_with = ["//os:macos-homebrew"], **kwargs): preproc_flags_rule_name = "__{}__{}__preproc_flags".format(name, brew) @@ -149,7 +149,7 @@ def homebrew_library( exported_preprocessor_flags = exported_preprocessor_flags + [ "@$(location :{})/preproc_flags.txt".format(preproc_flags_rule_name), ], - linker_flags = linker_flags + [ + exported_linker_flags = exported_linker_flags + [ "@$(location :{})/linker_flags.txt".format(linker_flags_rule_name), ], target_compatible_with = target_compatible_with, diff --git a/shim/third-party/double_conversion/BUCK b/shim/third-party/double_conversion/BUCK index b56c445a0..750949b1c 100644 --- a/shim/third-party/double_conversion/BUCK +++ b/shim/third-party/double_conversion/BUCK @@ -11,7 +11,7 @@ oncall("open_source") system_library( name = "double_conversion", - linker_flags = ["-ldouble-conversion"], + exported_linker_flags = ["-ldouble-conversion"], packages = { "//os:linux-fedora": ["double-conversion-devel"], "//os:linux-ubuntu": ["libdouble-conversion-dev"], diff --git a/shim/third-party/libaegis/BUCK b/shim/third-party/libaegis/BUCK index 8fb5b00e9..4d49fa66e 100644 --- a/shim/third-party/libaegis/BUCK +++ b/shim/third-party/libaegis/BUCK @@ -5,8 +5,6 @@ # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. -load("@shim//build_defs:prebuilt_cpp_library.bzl", "prebuilt_cpp_library") - oncall("open_source") git_fetch( @@ -21,12 +19,12 @@ genrule( cmd = "cmake -DCMAKE_INSTALL_PREFIX=$OUT $(location :libaegis.git) && make install", ) -prebuilt_cpp_library( +prebuilt_cxx_library( name = "aegis", - exported_preprocessor_flags = ["-I$(location :libaegis-cmake)/include"], - linker_flags = [ + exported_linker_flags = [ "-L$(location :libaegis-cmake)/lib64", "-laegis", ], + exported_preprocessor_flags = ["-I$(location :libaegis-cmake)/include"], visibility = ["PUBLIC"], ) diff --git a/shim/third-party/libaio/BUCK b/shim/third-party/libaio/BUCK index 477687d82..65aef8962 100644 --- a/shim/third-party/libaio/BUCK +++ b/shim/third-party/libaio/BUCK @@ -11,7 +11,7 @@ oncall("open_source") system_library( name = "aio", - linker_flags = ["-laio"], + exported_linker_flags = ["-laio"], packages = { "//os:linux-fedora": ["libaio-devel"], "//os:linux-ubuntu": ["libaio-dev"],