Skip to content

Commit

Permalink
bazel: a couple c-deps-related fixes
Browse files Browse the repository at this point in the history
1. Use a different `lg-page` size for `jemalloc` on M1 Macs. The older
   value resulted in sporadic runtime issues (see cockroachdb#81581).
2. Update linked libraries when building `gssapiccl` for `dev`
   scenarios. On Ubuntu the `res_nsearch` function is found in
   `lresolv_wrapper` and the linker can't find it unless we add it to
   the list here.

Closes cockroachdb#80389.
Closes cockroachdb#81581.

Release note: None
  • Loading branch information
rickystewart committed May 20, 2022
1 parent 85d99af commit cc2efeb
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 42 deletions.
2 changes: 1 addition & 1 deletion build/bazelutil/bazel-generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fi

bazel run //:gazelle

if files_unchanged_from_upstream DEPS.bzl WORKSPACE $(find_relevant ./pkg/cmd/generate-distdir -name BUILD.bazel -or -name '*.go') $(find_relevant ./pkg/build/bazel -name BUILD.bazel -or -name '*.go') $(find_relevant pkg/build/starlarkutil -name BUILD.bazel -or -name '*.go'); then
if files_unchanged_from_upstream c-deps/archived.bzl c-deps/REPOSITORIES.bzl DEPS.bzl WORKSPACE $(find_relevant ./pkg/cmd/generate-distdir -name BUILD.bazel -or -name '*.go') $(find_relevant ./pkg/build/bazel -name BUILD.bazel -or -name '*.go') $(find_relevant pkg/build/starlarkutil -name BUILD.bazel -or -name '*.go'); then
echo "Skipping //pkg/cmd/generate-distdir (relevant files are unchanged from upstream)."
else
CONTENTS=$(bazel run //pkg/cmd/generate-distdir)
Expand Down
34 changes: 17 additions & 17 deletions build/bazelutil/distdir_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -953,23 +953,23 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/public-bazel-artifacts/bazel/rules_proto-b0cc14be5da05168b01db282fe93bdf17aa2b9f4.tar.gz": "88b0a90433866b44bb4450d4c30bc5738b8c4f9c9ba14e9661deb123f56a833d",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/rules_python-0.1.0.tar.gz": "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/sqllogictest-96138842571462ed9a697bff590828d8f6356a2f.tar.gz": "f7e0d659fbefb65f32d4c5d146cba4c73c43e0e96f9b217a756c82be17451f97",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libgeos_foreign.linux.20220502-162142.tar.gz": "7dceeeb85cb9c09c30dc667a89c6cb81bbc5fd4f748aa32e2a28860b1ea481be",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libgeos_foreign.linuxarm.20220502-162142.tar.gz": "3de84b39c79ac4a9ed3ff5003ac68518a451378f191c4f9e744d1250ea47fc00",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libgeos_foreign.macos.20220502-162142.tar.gz": "4f9c8a26e13999268f5a0205941cd9a515b53aef2373b502a8af085aa35d1889",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libgeos_foreign.macosarm.20220502-162142.tar.gz": "6d31a2b1b19037bd0c97a2a133967ce97ae559a0cc3437f14643f92e21e34baa",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libgeos_foreign.windows.20220502-162142.tar.gz": "08964b7ff8cb147675e836a6efae3a989f77d22ca5400893d4316c875537e561",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libjemalloc_foreign.linux.20220502-162142.tar.gz": "b49b6d82fb07f888e910530156f679cf565a7680e169d3eebde239a1eb301845",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libjemalloc_foreign.linuxarm.20220502-162142.tar.gz": "574347682ce737dff07419e943b016d07f00215b2572ce9b9fc65461e887afe2",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libjemalloc_foreign.macos.20220502-162142.tar.gz": "9e5b33d9b230e8d4ae1f6b8f120081717a3f41d01c210694781fe34726543a97",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libjemalloc_foreign.macosarm.20220502-162142.tar.gz": "9f102e1d94272121c371037ab57f23140fcb26a74396564f86e9c44941e8e0ac",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libjemalloc_foreign.windows.20220502-162142.tar.gz": "bc6e767c4e9e558fb3b54aabc7b5807058939f8b29c264fb8d80abcdfb39db27",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libkrb5_foreign.linux.20220502-162142.tar.gz": "01df3e15015d6c9833ed8e3c768a4d743a09d647ee78276f84b4887d2cee6ba2",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libkrb5_foreign.linuxarm.20220502-162142.tar.gz": "17fc28ae89e25c8246c94e96f7de0d2f0dfc119e0fe783f78e6fbcac578f3608",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libproj_foreign.linux.20220502-162142.tar.gz": "12975a9824cbe84181e4992fc14e467c555c3fe53fc8408c7e300dbe966df6cd",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libproj_foreign.linuxarm.20220502-162142.tar.gz": "91a1490ee7ef9f90b4900b13dd735dc86f4759fba737593155c8efc720a67dc5",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libproj_foreign.macos.20220502-162142.tar.gz": "48cee3a1c10a428022512afadc5fd2ba0b9d2e9809705352fcbcce7889b1d9ba",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libproj_foreign.macosarm.20220502-162142.tar.gz": "60ee8073733db22817426adb37dad05c8463b0d03bf1c5e83b9fa39fd2756f05",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220502-162142/libproj_foreign.windows.20220502-162142.tar.gz": "561c09be157a75ff618f6c067d7afed55f0f6d56d493a0a930525e4e97e14cfa",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libgeos_foreign.linux.20220520-181309.tar.gz": "755a734ed4f44328377f04ffe7e2a53f6552aee6de5f448ae34ade5bdf0047b3",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libgeos_foreign.linuxarm.20220520-181309.tar.gz": "10e55138113fb43ad4d4c4a38ae77b34d9d74b0d54c46f0bfa9ae6cf6551db46",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libgeos_foreign.macos.20220520-181309.tar.gz": "bcf05b88b102628ec878a91086d0039fd9460d17b6431e1322310b3820103f23",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libgeos_foreign.macosarm.20220520-181309.tar.gz": "bba59eb60c31c34bde10ac4a34d2210d201dc9d8e188be0aeb2d3038d148f63c",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libgeos_foreign.windows.20220520-181309.tar.gz": "27aea836a821920c8b444f9ec251c32af3842d6a2a084f286632e819b8c03d71",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libjemalloc_foreign.linux.20220520-181309.tar.gz": "d6e222cf1f09834216af546775b23a8a13bdb5b49cfe45741e1aff5c2a739ee9",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libjemalloc_foreign.linuxarm.20220520-181309.tar.gz": "10e34f6c314558b2ae092a55685eecad0767b161c7aa14e7fd5b87d9e7b450a1",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libjemalloc_foreign.macos.20220520-181309.tar.gz": "44dd0f9b296f5885f0bf5936ebbe0d6f574b4c067330d66b1f55b7fd15e33066",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libjemalloc_foreign.macosarm.20220520-181309.tar.gz": "e444612cba97d31ae8ce23534e2e0416c2ebf79bb505e38882cec5d8dd7b60dd",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libjemalloc_foreign.windows.20220520-181309.tar.gz": "3db4fe746a7591a87b94bbbfb35d727a51506775ea36b9f634eb770b486e9c7b",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libkrb5_foreign.linux.20220520-181309.tar.gz": "f1fe740b931f29289fd9cad7f877705072678c83bd5c9ef899cdbf3373985d2e",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libkrb5_foreign.linuxarm.20220520-181309.tar.gz": "6fe0ddee54c71f5afd71effb728a1227beb43ca6977205e56ee9eaf5b6f15422",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libproj_foreign.linux.20220520-181309.tar.gz": "4bcd7ed82d8487370cad34f68096e160e768630f579fc2e9d09c72b0ebf3f741",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libproj_foreign.linuxarm.20220520-181309.tar.gz": "dbbcf9a633d251530ad7b698934b6752eca347f34985060700d3ec187b1f3498",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libproj_foreign.macos.20220520-181309.tar.gz": "aa618a6525c0df669ce1231c837dc46a1a789d54231ae3dcfcada599d0845b22",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libproj_foreign.macosarm.20220520-181309.tar.gz": "e3206fa7c2544d1817103c3c61f132d342b5d4a07404d1de4582da968b622749",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libproj_foreign.windows.20220520-181309.tar.gz": "4d935601d1b989ff020c66011355a0e2985abacf36f9d952f7f1ce34d54684ad",
"https://storage.googleapis.com/public-bazel-artifacts/go/go1.17.6.darwin-amd64.tar.gz": "874bc6f95e07697380069a394a21e05576a18d60f4ba178646e1ebed8f8b1f89",
"https://storage.googleapis.com/public-bazel-artifacts/go/go1.17.6.darwin-arm64.tar.gz": "dc54f3f4099e2be9e9c33bf926a7dc3ad64f34717142f7abcaff9ae44bc03d0c",
"https://storage.googleapis.com/public-bazel-artifacts/go/go1.17.6.freebsd-386.tar.gz": "d5fbe0292fc0ae734041d54a5614712fa50337c76927df7bc749c27a543ed6a2",
Expand Down
10 changes: 10 additions & 0 deletions build/toolchains/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,16 @@ config_setting(
},
)

config_setting(
name = "is_dev_linux",
constraint_values = [
"@io_bazel_rules_go//go/toolchain:linux",
],
flag_values = {
":dev_flag": "true",
},
)

config_setting(
name = "is_dev_macos_arm64",
constraint_values = [
Expand Down
2 changes: 1 addition & 1 deletion c-deps/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ configure_make(
"@io_bazel_rules_go//go/platform:darwin_amd64": ["--host=x86_64-apple-darwin21.2"],
"@io_bazel_rules_go//go/platform:darwin_arm64": [
"--host=aarch64-apple-darwin21.2",
"--with-lg-page=16",
"--with-lg-page=14",
],
"@io_bazel_rules_go//go/platform:linux_amd64": ["--host=x86_64-unknown-linux-gnu"],
"@io_bazel_rules_go//go/platform:linux_arm64": ["--host=aarch64-unknown-linux-gnu"],
Expand Down
34 changes: 17 additions & 17 deletions c-deps/REPOSITORIES.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,85 +39,85 @@ def c_deps():
archived_cdep_repository(
lib = "libgeos",
config = "linux",
sha256 = "7dceeeb85cb9c09c30dc667a89c6cb81bbc5fd4f748aa32e2a28860b1ea481be",
sha256 = "755a734ed4f44328377f04ffe7e2a53f6552aee6de5f448ae34ade5bdf0047b3",
)
archived_cdep_repository(
lib = "libjemalloc",
config = "linux",
sha256 = "b49b6d82fb07f888e910530156f679cf565a7680e169d3eebde239a1eb301845",
sha256 = "d6e222cf1f09834216af546775b23a8a13bdb5b49cfe45741e1aff5c2a739ee9",
)
archived_cdep_repository(
lib = "libkrb5",
config = "linux",
sha256 = "01df3e15015d6c9833ed8e3c768a4d743a09d647ee78276f84b4887d2cee6ba2",
sha256 = "f1fe740b931f29289fd9cad7f877705072678c83bd5c9ef899cdbf3373985d2e",
)
archived_cdep_repository(
lib = "libproj",
config = "linux",
sha256 = "12975a9824cbe84181e4992fc14e467c555c3fe53fc8408c7e300dbe966df6cd",
sha256 = "4bcd7ed82d8487370cad34f68096e160e768630f579fc2e9d09c72b0ebf3f741",
)
archived_cdep_repository(
lib = "libgeos",
config = "linuxarm",
sha256 = "3de84b39c79ac4a9ed3ff5003ac68518a451378f191c4f9e744d1250ea47fc00",
sha256 = "10e55138113fb43ad4d4c4a38ae77b34d9d74b0d54c46f0bfa9ae6cf6551db46",
)
archived_cdep_repository(
lib = "libjemalloc",
config = "linuxarm",
sha256 = "574347682ce737dff07419e943b016d07f00215b2572ce9b9fc65461e887afe2",
sha256 = "10e34f6c314558b2ae092a55685eecad0767b161c7aa14e7fd5b87d9e7b450a1",
)
archived_cdep_repository(
lib = "libkrb5",
config = "linuxarm",
sha256 = "17fc28ae89e25c8246c94e96f7de0d2f0dfc119e0fe783f78e6fbcac578f3608",
sha256 = "6fe0ddee54c71f5afd71effb728a1227beb43ca6977205e56ee9eaf5b6f15422",
)
archived_cdep_repository(
lib = "libproj",
config = "linuxarm",
sha256 = "91a1490ee7ef9f90b4900b13dd735dc86f4759fba737593155c8efc720a67dc5",
sha256 = "dbbcf9a633d251530ad7b698934b6752eca347f34985060700d3ec187b1f3498",
)
archived_cdep_repository(
lib = "libgeos",
config = "macos",
sha256 = "4f9c8a26e13999268f5a0205941cd9a515b53aef2373b502a8af085aa35d1889",
sha256 = "bcf05b88b102628ec878a91086d0039fd9460d17b6431e1322310b3820103f23",
)
archived_cdep_repository(
lib = "libjemalloc",
config = "macos",
sha256 = "9e5b33d9b230e8d4ae1f6b8f120081717a3f41d01c210694781fe34726543a97",
sha256 = "44dd0f9b296f5885f0bf5936ebbe0d6f574b4c067330d66b1f55b7fd15e33066",
)
archived_cdep_repository(
lib = "libproj",
config = "macos",
sha256 = "48cee3a1c10a428022512afadc5fd2ba0b9d2e9809705352fcbcce7889b1d9ba",
sha256 = "aa618a6525c0df669ce1231c837dc46a1a789d54231ae3dcfcada599d0845b22",
)
archived_cdep_repository(
lib = "libgeos",
config = "macosarm",
sha256 = "6d31a2b1b19037bd0c97a2a133967ce97ae559a0cc3437f14643f92e21e34baa",
sha256 = "bba59eb60c31c34bde10ac4a34d2210d201dc9d8e188be0aeb2d3038d148f63c",
)
archived_cdep_repository(
lib = "libjemalloc",
config = "macosarm",
sha256 = "9f102e1d94272121c371037ab57f23140fcb26a74396564f86e9c44941e8e0ac",
sha256 = "e444612cba97d31ae8ce23534e2e0416c2ebf79bb505e38882cec5d8dd7b60dd",
)
archived_cdep_repository(
lib = "libproj",
config = "macosarm",
sha256 = "60ee8073733db22817426adb37dad05c8463b0d03bf1c5e83b9fa39fd2756f05",
sha256 = "e3206fa7c2544d1817103c3c61f132d342b5d4a07404d1de4582da968b622749",
)
archived_cdep_repository(
lib = "libgeos",
config = "windows",
sha256 = "08964b7ff8cb147675e836a6efae3a989f77d22ca5400893d4316c875537e561",
sha256 = "27aea836a821920c8b444f9ec251c32af3842d6a2a084f286632e819b8c03d71",
)
archived_cdep_repository(
lib = "libjemalloc",
config = "windows",
sha256 = "bc6e767c4e9e558fb3b54aabc7b5807058939f8b29c264fb8d80abcdfb39db27",
sha256 = "3db4fe746a7591a87b94bbbfb35d727a51506775ea36b9f634eb770b486e9c7b",
)
archived_cdep_repository(
lib = "libproj",
config = "windows",
sha256 = "561c09be157a75ff618f6c067d7afed55f0f6d56d493a0a930525e4e97e14cfa",
sha256 = "4d935601d1b989ff020c66011355a0e2985abacf36f9d952f7f1ce34d54684ad",
)
2 changes: 1 addition & 1 deletion c-deps/archived.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain")

# NB: URL_TMPL and LOC are used by generate-distdir. Don't change the format or
# name of these definitions unless you update generate-distdir accordingly.
LOC = "20220502-162142"
LOC = "20220520-181309"
URL_TMPL = "https://storage.googleapis.com/public-bazel-artifacts/c-deps/{loc}/{lib}_foreign.{config}.{loc}.tar.gz"

# NB: When we link with the krb5 libraries, we want the linker to see them in
Expand Down
2 changes: 1 addition & 1 deletion c-deps/buildcdeps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ for CONFIG in $CONFIGS; do
done
done

for FILE in $(find /artifacts -name '*.tar.gz'); do
for FILE in $(find /artifacts -name '*.tar.gz' | sort); do
shasum -a 256 $FILE
done
10 changes: 6 additions & 4 deletions pkg/ccl/gssapiccl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,24 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "gssapiccl",
srcs = select({
"@io_bazel_rules_go//go/platform:linux_amd64": ["gssapi.go", "get_user.go"],
"@io_bazel_rules_go//go/platform:linux": ["gssapi.go", "get_user.go"],
"//conditions:default": ["empty.go"],
}),
cdeps = select({
"@io_bazel_rules_go//go/platform:linux_amd64": ["//c-deps:libkrb5"],
"@io_bazel_rules_go//go/platform:linux": ["//c-deps:libkrb5"],
"//conditions:default": [],
}),
cgo = True,
clinkopts = select({
"@io_bazel_rules_go//go/platform:linux_amd64": ["-ldl -lresolv"],
# NB: On Ubuntu, res_nsearch is found in resolv_wrapper library.
"//build/toolchains:is_dev_linux": ["-ldl -lresolv -lresolv_wrapper"],
"@io_bazel_rules_go//go/platform:linux": ["-ldl -lresolv"],
"//conditions:default": [],
}),
importpath = "github.com/cockroachdb/cockroach/pkg/ccl/gssapiccl",
visibility = ["//visibility:public"],
deps = select({
"@io_bazel_rules_go//go/platform:linux_amd64": [
"@io_bazel_rules_go//go/platform:linux": [
"//pkg/ccl/utilccl",
"//pkg/security/username",
"//pkg/settings",
Expand Down

0 comments on commit cc2efeb

Please sign in to comment.