-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[antlir][vm] make swtpm dependency fully static
Summary: - the last dynamic dependency for swtpm was on libcrypto.so.1.1 - remove this by compiling openssl from source; this previously used a platform derived .so but that breaks on centos9 since the version is different - swtpm binary is now fully static Test Plan: - build and show it's statically compiled ``` > buck2 build -c antlir.rc_targets=//antlir/vm/runtime/facebook:qemu-tools //antlir/vm/runtime:swtpm --show-full-output Buck UI: https://www.internalfb.com/buck2/2ab02348-1fd1-469f-843c-fc38589328b0 BUILD SUCCEEDED fbcode//antlir/vm/runtime:swtpm /data/users/aeh/fbsource/buck-out/v2/gen/fbcode/513e0f216bd9b87a/antlir/vm/runtime/__swtpm__/out/swtpm > ls -lh /data/users/aeh/fbsource/buck-out/v2/gen/fbcode/513e0f216bd9b87a/antlir/vm/runtime/__swtpm__/out/swtpm -rwxr-xr-x 1 aeh users 4.4M Jul 11 16:49 /data/users/aeh/fbsource/buck-out/v2/gen/fbcode/513e0f216bd9b87a/antlir/vm/runtime/__swtpm__/out/swtpm > ldd /data/users/aeh/fbsource/buck-out/v2/gen/fbcode/513e0f216bd9b87a/antlir/vm/runtime/__swtpm__/out/swtpm not a dynamic executable > /data/users/aeh/fbsource/buck-out/v2/gen/fbcode/513e0f216bd9b87a/antlir/vm/runtime/__swtpm__/out/swtpm --help TPM emulator with choice of interface. [...] ``` Reviewed By: vjt Differential Revision: D47386310 fbshipit-source-id: 5c46a33f95f00917bce088ba2d361ca053387349
- Loading branch information
1 parent
9615692
commit 29d0fe8
Showing
5 changed files
with
82 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# since we're trying to build a static swtpm, the check for libtpms version needs | ||
# to use the static libcrypto.a otherwise compile fails and configure will complain | ||
# that the version is wrong | ||
--- configure.ac 2023-07-11 15:46:24.557440526 -0700 | ||
+++ configure.ac 2023-07-11 15:47:14.603685386 -0700 | ||
@@ -172,7 +172,8 @@ | ||
CFLAGS="$CFLAGS $LIBTPMS_CFLAGS" | ||
AC_CHECK_LIB(tpms, | ||
TPMLIB_ChooseTPMVersion,[true], | ||
- AC_MSG_ERROR("libtpms 0.6 or later is required") | ||
+ AC_MSG_ERROR("libtpms 0.6 or later is required"), | ||
+ -lcrypto | ||
) | ||
AC_SUBST([LIBTPMS_LIBS]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
load("//antlir/bzl:third_party.bzl", "third_party") | ||
load("//antlir/bzl/image/feature:defs.bzl", "feature") | ||
|
||
oncall("twimage") | ||
|
||
third_party.build( | ||
name = "libcrypto", | ||
src = third_party.source("openssl_1.1.1k"), | ||
features = [ | ||
feature.rpms_install([ | ||
# build deps | ||
"gcc", | ||
"autoconf", | ||
"autoconf-archive", | ||
"libtool", | ||
"make", | ||
]), | ||
], | ||
script = third_party.script( | ||
build = "make", | ||
install = "make install", | ||
prepare = """ | ||
export CFLAGS="-fPIC -fno-omit-frame-pointer" | ||
./config --prefix="${OUTPUT}" \ | ||
enable-camellia enable-seed enable-rfc3779 enable-cms enable-md2 \ | ||
no-mdc2 no-ec2m no-sm2 no-sm4 \ | ||
no-zlib \ | ||
no-rc5 no-ec2m no-gost no-sm3 no-idea no-whirlpool \ | ||
no-shared | ||
""", | ||
), | ||
visibility = ["//antlir/third-party/..."], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters