From 696d0eec64fcd2da3f01b5e96e1439d6d45b94b7 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Fri, 6 Jan 2023 01:48:32 +0100 Subject: [PATCH] misc: update podman images --- Makefile | 6 +++++ .../10-create-image.sh | 4 +-- .../20-image-run-shell.sh | 14 +++++++--- misc/cross-compile-upx-with-podman/Dockerfile | 6 ++--- .../10-create-image.sh | 2 +- .../20-image-run-shell.sh | 26 +++++++++++++++---- misc/rebuild-stubs-with-podman/Dockerfile | 8 +++--- 7 files changed, 48 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 219838e9..0153f9ea 100644 --- a/Makefile +++ b/Makefile @@ -88,6 +88,12 @@ build/extra/gcc-m64/release: PHONY; $(call run_config_and_build,$@,Release) build/extra/gcc-m64/%: export CC = gcc -m64 build/extra/gcc-m64/%: export CXX = g++ -m64 +# force building with gcc/g++ -mx32 +build/extra/gcc-mx32/debug: PHONY; $(call run_config_and_build,$@,Debug) +build/extra/gcc-mx32/release: PHONY; $(call run_config_and_build,$@,Release) +build/extra/gcc-mx32/%: export CC = gcc -mx32 +build/extra/gcc-mx32/%: export CXX = g++ -mx32 + # cross compiler: Linux glibc aarch64-linux-gnu build/extra/cross-linux-aarch64/debug: PHONY; $(call run_config_and_build,$@,Debug) build/extra/cross-linux-aarch64/release: PHONY; $(call run_config_and_build,$@,Release) diff --git a/misc/cross-compile-upx-with-podman/10-create-image.sh b/misc/cross-compile-upx-with-podman/10-create-image.sh index 0e70a203..d4347908 100755 --- a/misc/cross-compile-upx-with-podman/10-create-image.sh +++ b/misc/cross-compile-upx-with-podman/10-create-image.sh @@ -6,10 +6,10 @@ argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")" # create the image from Dockerfile # using a rootless Podman container -# NOTE: this image is based on rebuild-stubs-with-upx/upx-stubtools-20221212-v1, +# NOTE: this image is based on rebuild-stubs-with-upx/upx-stubtools-20221212-v2, # so you have to create that image first # WARNING: we install many packages, so the resulting image needs A LOT of disk space! -image=upx-cross-compile-20221212-v1 +image=upx-cross-compile-20221212-v2 podman build -t "$image" -f "$argv0dir/Dockerfile" "$argv0dir" diff --git a/misc/cross-compile-upx-with-podman/20-image-run-shell.sh b/misc/cross-compile-upx-with-podman/20-image-run-shell.sh index f696f834..bf97caca 100755 --- a/misc/cross-compile-upx-with-podman/20-image-run-shell.sh +++ b/misc/cross-compile-upx-with-podman/20-image-run-shell.sh @@ -6,7 +6,7 @@ argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")" # run an interactive shell in the image # using a rootless Podman container -image=upx-cross-compile-20221212-v1 +image=upx-cross-compile-20221212-v2 flags=( -ti --read-only --rm ) flags+=( --cap-drop=all ) # drop all capabilities @@ -37,6 +37,12 @@ podman run "${flags[@]}" "$image" bash -l # rm -rf ./build/extra/cross-windows-mingw64/release # make build/extra/cross-windows-mingw64/release -# lots of other cross-compilers are installed: -# - see "ls /usr/bin/*g++*" -# - see misc/cross-compile-upx-with-podman/build-all-inside-container.sh +# lots of other cross-compilers are installed; see "ls /usr/bin/*g++*" + +# and see misc/cross-compile-upx-with-podman/build-all-inside-container.sh; after +# running that script you can do cool things like: +# cd /home/upx/src/upx/build/cross-compile-upx-with-podman/alpha-linux-gnu/debug +# qemu-alpha -L /usr/alpha-linux-gnu upx --version +# cd /home/upx/src/upx/build/cross-compile-upx-with-podman/hppa-linux-gnu/debug +# qemu-hppa -L /usr/hppa-linux-gnu upx --version +# (similar for many other archs) diff --git a/misc/cross-compile-upx-with-podman/Dockerfile b/misc/cross-compile-upx-with-podman/Dockerfile index c66d71dd..79b3ed58 100644 --- a/misc/cross-compile-upx-with-podman/Dockerfile +++ b/misc/cross-compile-upx-with-podman/Dockerfile @@ -1,8 +1,8 @@ -# NOTE: this image is based on rebuild-stubs-with-upx/upx-stubtools-20221212-v1, +# NOTE: this image is based on rebuild-stubs-with-upx/upx-stubtools-20221212-v2, # so you have to create that image first # WARNING: we install many packages, so the resulting image needs A LOT of disk space! -FROM localhost/upx-stubtools-20221212-v1 -ENV UPX_CONTAINER_IMAGE_NAME=upx-cross-compile-20221212-v1 +FROM localhost/upx-stubtools-20221212-v2 +ENV UPX_CONTAINER_IMAGE_NAME=upx-cross-compile-20221212-v2 ARG DEBIAN_FRONTEND=noninteractive USER root diff --git a/misc/rebuild-stubs-with-podman/10-create-image.sh b/misc/rebuild-stubs-with-podman/10-create-image.sh index b25bd932..ef61ce62 100755 --- a/misc/rebuild-stubs-with-podman/10-create-image.sh +++ b/misc/rebuild-stubs-with-podman/10-create-image.sh @@ -6,7 +6,7 @@ argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")" # create the image from Dockerfile # using a rootless Podman container -image=upx-stubtools-20221212-v1 +image=upx-stubtools-20221212-v2 podman build -t "$image" -f "$argv0dir/Dockerfile" "$argv0dir" diff --git a/misc/rebuild-stubs-with-podman/20-image-run-shell.sh b/misc/rebuild-stubs-with-podman/20-image-run-shell.sh index 12e8dd1d..1a0787e0 100755 --- a/misc/rebuild-stubs-with-podman/20-image-run-shell.sh +++ b/misc/rebuild-stubs-with-podman/20-image-run-shell.sh @@ -6,7 +6,7 @@ argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")" # run an interactive shell in the image # using a rootless Podman container -image=upx-stubtools-20221212-v1 +image=upx-stubtools-20221212-v2 flags=( -ti --read-only --rm ) flags+=( --cap-drop=all ) # drop all capabilities @@ -53,8 +53,24 @@ podman run "${flags[@]}" "$image" bash -l # ./build/extra/gcc/release/upx --version # make -C build/extra/gcc/release test -# and we can also rebuild the UPX docs the container: +# and we can also rebuild UPX with -m32: # cd /home/upx/src/upx -# make -C doc clean all -# git status doc -# git diff doc +# rm -rf ./build/extra/gcc-m32/release +# make build/extra/gcc-m32/release +# # run tests +# ./build/extra/gcc-m32/release/upx --version +# make -C build/extra/gcc-m32/release test + +# and we can also rebuild UPX with -mx32: (NOTE: needs CONFIG_X86_X32_ABI on host kernel!) +# cd /home/upx/src/upx +# rm -rf ./build/extra/gcc-mx32/release +# make build/extra/gcc-mx32/release +# # run tests (needs CONFIG_X86_X32_ABI on host kernel) +# ./build/extra/gcc-mx32/release/upx --version +# make -C build/extra/gcc-mx32/release test + +# and we can also rebuild the UPX docs the container: +# cd /home/upx/src/upx/doc +# make clean all +# git status . +# git diff . diff --git a/misc/rebuild-stubs-with-podman/Dockerfile b/misc/rebuild-stubs-with-podman/Dockerfile index 398b9bce..2dcd56cb 100644 --- a/misc/rebuild-stubs-with-podman/Dockerfile +++ b/misc/rebuild-stubs-with-podman/Dockerfile @@ -1,5 +1,5 @@ FROM docker.io/library/ubuntu:22.04 -ENV UPX_CONTAINER_IMAGE_NAME=upx-stubtools-20221212-v1 +ENV UPX_CONTAINER_IMAGE_NAME=upx-stubtools-20221212-v2 ARG DEBIAN_FRONTEND=noninteractive ENV LANG=C.UTF-8 @@ -13,8 +13,10 @@ RUN dpkg --add-architecture i386 \ # the following packages are not required for rebuilding the stubs, but # they do make the image much more convenient and also allow building # the full UPX binary inside the container via CMake: - 7zip bzip2 cmake elfutils file g++ htop libzstd-dev lzip lzop ninja-build p7zip \ - patch patchelf pax-utils rsync screen unzip vim zip zlib1g-dev zsh zstd \ + 7zip bzip2 cmake elfutils file g++ gdb htop libzstd-dev lzip lzop ninja-build \ + p7zip patch patchelf pax-utils rsync screen unzip vim zip zlib1g-dev zsh zstd \ + # extra packages for compiling with "gcc -m32" and and "gcc -mx32": + gcc-multilib g++-multilib \ && true # manually install compat libs from Ubuntu 16.04; REQUIRED