mirror of
https://github.com/gravitational/teleport.git
synced 2026-10-12 02:15:01 +00:00
* Add ninja-build setup to Dockerfile-centos7 The Dockerfile-centos7 has been updated to include the setup and installation of ninja-build. The version of ninja-build included in CentOS 7 AMR64 was too old for building boringssl, hence it needs to be built from source. Both additional dependencies and the source build steps have been added as part of this update. * Add CMake to the ninja build * Update Dockerfile to fix ARM64 build issue The Dockerfile for Centos7 was updated to better support ARM64 architectures. Instead of fetching a precompiled binary of CMake, we now clone CMake v3.28.1 and compile it specifically for the target. This change includes the addition of the `-mno-outline-atomics` flag, which resolves ARM64-specific issues with compilation. * Update Dockerfile to conditionally set CFLAGS for arm64 architecture The Dockerfile for CentOS7 now includes a condition that sets the CFLAGS environment for arm64 architecture. This change was made during the process of enabling CMake to bootstrap itself and ensures that correct flags are set for specific architectures during the build process. * Update Clang from 12 to 14 to match BoringSSL `fips-20220613` tag Matches what upstream Go is using for BoringCrypto build: https://github.com/golang/go/commit/7383b2a4db5dc93c9b875b42d5add73d27cc4b9f Also set `CMAKE=cmake3`, as `boring-rs` (by way of `cmake-rs`) calls `cmake`. Additionally, make `build-centos7-assets` a dependency. * Removes build-centos7-assets as a dependency for the build-centos7 target. Adds a comment to the Makefile to explain why. * Updated Clang build configuration in Dockerfile Updates clang to be built with the inclusion of the header files necessary for building boring. Also changes the build to use Ninja. * moves the ninja copy closer to the clang copy * Swap to fork of `boring-rs` for build fixes (#36720) BoringSSL does not build properly on CentOS 7 without some build fixes. As these fixes are not yet upstreamed, a separate fork is being used -- https://github.com/gravitational/boring. Co-authored-by: Isaiah Becker-Mayer <[email protected]> * Ninja build snuck back into Dockerfile-centos7, but we don't need it since it's in Dockerfile-centos7-assets now. Removing it. * Prevent docker buildkit from caching Use docker build to build fips image to prevent docker from fetching the base centos image from the registry. * Add 'nolint' comment in boringtest.go A 'nolint' comment was added in the boringtest go file to ignore linting this file * Rename test Go file --------- Co-authored-by: Jakub Nyckowski <[email protected]> Co-authored-by: Isaiah Becker-Mayer <[email protected]>
51 lines
2.4 KiB
Makefile
51 lines
2.4 KiB
Makefile
# Common makefile shared between Teleport OSS and Ent.
|
|
|
|
# libbpf version required by the build.
|
|
LIBBPF_VER := 1.2.2
|
|
|
|
# Is this build targeting the same OS & architecture it is being compiled on, or
|
|
# will it require cross-compilation? We need to know this (especially for ARM) so we
|
|
# can set the cross-compiler path (and possibly feature flags) correctly.
|
|
IS_NATIVE_BUILD ?= $(if $(filter $(ARCH), $(shell go env GOARCH)),"yes","no")
|
|
|
|
# BPF support will only be built into Teleport if headers exist at build time.
|
|
BPF_MESSAGE := without-BPF-support
|
|
|
|
# We don't compile BPF for anything except linux/amd64 and linux/arm64 for now,
|
|
# as other builds have compilation issues that require fixing.
|
|
with_bpf := no
|
|
ifeq ("$(OS)","linux")
|
|
# True if $ARCH == amd64 || $ARCH == arm64
|
|
ifneq (,$(filter "$(ARCH)","amd64" "arm64"))
|
|
# We only support BPF in native builds
|
|
ifeq ($(IS_NATIVE_BUILD),"yes")
|
|
ifneq ("$(wildcard /usr/libbpf-${LIBBPF_VER}/include/bpf/bpf.h)","")
|
|
with_bpf := yes
|
|
BPF_TAG := bpf
|
|
BPF_MESSAGE := with-BPF-support
|
|
CLANG ?= $(shell which clang || which clang-14)
|
|
LLVM_STRIP ?= $(shell which llvm-strip || which llvm-strip-14)
|
|
KERNEL_ARCH := $(shell uname -m | sed 's/x86_64/x86/g; s/aarch64/arm64/g')
|
|
INCLUDES :=
|
|
ER_BPF_BUILDDIR := lib/bpf/bytecode
|
|
|
|
# Get Clang's default includes on this system. We'll explicitly add these dirs
|
|
# to the includes list when compiling with `-target bpf` because otherwise some
|
|
# architecture-specific dirs will be "missing" on some architectures/distros -
|
|
# headers such as asm/types.h, asm/byteorder.h, asm/socket.h, asm/sockios.h,
|
|
# sys/cdefs.h etc. might be missing.
|
|
#
|
|
# Use '-idirafter': Don't interfere with include mechanics except where the
|
|
# build would have failed anyways.
|
|
CLANG_BPF_SYS_INCLUDES = $(shell $(CLANG) -v -E - </dev/null 2>&1 \
|
|
| sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }')
|
|
|
|
STATIC_LIBS += -L/usr/libbpf-${LIBBPF_VER}/lib64/ -lbpf -lelf -lz
|
|
# Link static version of libraries required by Teleport (bpf, pcsc) to reduce system dependencies. Avoid dependencies on dynamic libraries if we already link the static version using --as-needed.
|
|
CGOFLAG = CGO_ENABLED=1 CGO_CFLAGS="-I/usr/libbpf-${LIBBPF_VER}/include" CGO_LDFLAGS="-Wl,-Bstatic $(STATIC_LIBS) -Wl,-Bdynamic -Wl,--as-needed"
|
|
CGOFLAG_TSH = CGO_ENABLED=1 CGO_LDFLAGS="-Wl,-Bstatic $(STATIC_LIBS_TSH) -Wl,-Bdynamic -Wl,--as-needed"
|
|
endif # bpf/bpf.h found
|
|
endif # IS_NATIVE_BUILD == yes
|
|
endif # ARCH == amd64 OR arm64
|
|
endif # OS == linux
|