Skip to content

Commit

Permalink
Make sure linker flags are exported by third party targets
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Cullen Walsh authored and facebook-github-bot committed Oct 1, 2024
1 parent ea782ec commit 27124d8
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
1 change: 1 addition & 0 deletions shim/third-party/binutils/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
4 changes: 2 additions & 2 deletions shim/third-party/boost/boost.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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,
)
2 changes: 1 addition & 1 deletion shim/third-party/bzip2/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
}),
Expand Down
4 changes: 2 additions & 2 deletions shim/third-party/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion shim/third-party/double_conversion/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
8 changes: 3 additions & 5 deletions shim/third-party/libaegis/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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"],
)
2 changes: 1 addition & 1 deletion shim/third-party/libaio/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down

0 comments on commit 27124d8

Please sign in to comment.