Compare commits
9 Commits
fix-python
...
use-musl
Author | SHA1 | Date | |
---|---|---|---|
ecd1367c6d | |||
e899d51568 | |||
01e60acff0 | |||
24491576ef | |||
56eef2a483 | |||
fb1c8c064b | |||
0aef35466f | |||
a67de84e98 | |||
6332ea0b03 |
@ -30,4 +30,9 @@ RUN apt update && apt install -y \
|
|||||||
wget \
|
wget \
|
||||||
xz-utils
|
xz-utils
|
||||||
|
|
||||||
|
# Install musl-based toolchains.
|
||||||
|
ENV MUSL_INSTALL_DIR="/usr/"
|
||||||
|
COPY src/compilation/install_musl_toolchains.sh .
|
||||||
|
RUN ./install_musl_toolchains.sh
|
||||||
|
|
||||||
WORKDIR /app/gdb
|
WORKDIR /app/gdb
|
||||||
|
2
Makefile
2
Makefile
@ -59,7 +59,7 @@ $(PYTHON_TARGETS): build-with-python-%:
|
|||||||
|
|
||||||
_build-%: symlink-git-packages download-packages build-docker-image
|
_build-%: symlink-git-packages download-packages build-docker-image
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
docker run --user $(shell id -u):$(shell id -g) \
|
docker run -it --user $(shell id -u):$(shell id -g) \
|
||||||
--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
|
--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
|
||||||
/app/gdb/src/compilation/build.sh $* /app/gdb/build/ /app/gdb/src $(WITH_PYTHON)
|
/app/gdb/src/compilation/build.sh $* /app/gdb/build/ /app/gdb/src $(WITH_PYTHON)
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<img src="https://img.shields.io/github/contributors-anon/guyush1/gdb-static?color=yellow&style=flat-square" alt="contributors" style="height: 20px;">
|
<img src="https://img.shields.io/github/contributors-anon/guyush1/gdb-static?color=yellow&style=flat-square" alt="contributors" style="height: 20px;">
|
||||||
</a>
|
</a>
|
||||||
<br>
|
<br>
|
||||||
<img src="https://img.shields.io/badge/GDB-v15.2-orange?logo=gnu&logoColor=white&style=flat-square" alt="gdb" style="height: 20px;">
|
<img src="https://img.shields.io/badge/GDB-v16.2-orange?logo=gnu&logoColor=white&style=flat-square" alt="gdb" style="height: 20px;">
|
||||||
<img src="https://img.shields.io/badge/Python-built--in-blue?logo=python&logoColor=white&style=flat-square" alt="python" style="height: 20px;">
|
<img src="https://img.shields.io/badge/Python-built--in-blue?logo=python&logoColor=white&style=flat-square" alt="python" style="height: 20px;">
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Notes about this file - read before proceeding!
|
# Notes about this file - read before proceeding!
|
||||||
|
|
||||||
While we have already provided the gdb/gdbserver-15 statically compiled binaries for you, some people might want to compile it without our build scripts, or compile a newer version of gdb in the future :).
|
While we have already provided the gdb/gdbserver statically compiled binaries for you, some people might want to compile it without our build scripts, or compile a newer version of gdb in the future :).
|
||||||
This rest of the file contains a documentation of the compilation process, in order to help you out.
|
The rest of the file contains a documentation of the compilation process, in order to help you out.
|
||||||
|
|
||||||
NOTE: The compilation guide describes the compilation process in order to create a minimal-working version of gdb. Our build-scripts also provides further capabilites to gdb, such as python and xml support, which are not documented in this file.
|
NOTE: The compilation guide describes the compilation process in order to create a minimal-working version of gdb. Our build-scripts also provides further capabilites to gdb, such as python and xml support, which are not documented in this file.
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ Examples to the <VARIABLES> throughout the script:
|
|||||||
- <COMPILATION_DIR_PATH> - /home/username/projects/libgmp-x.y.z/build-arm/
|
- <COMPILATION_DIR_PATH> - /home/username/projects/libgmp-x.y.z/build-arm/
|
||||||
|
|
||||||
Environment info:
|
Environment info:
|
||||||
- glibc version: 2.39-0ubuntu8.3 (NOTE: When i compiled gdb-15 using an older glibc, such as the one i had in my ubuntu-20.04 machine, i received a segfault in gdb, so the libc version is important!).
|
- glibc version: 2.39-0ubuntu8.3 (NOTE: When i compiled gdb using an older glibc, such as the one i had in my ubuntu-20.04 machine, i received a segfault in gdb, so the libc version is important!).
|
||||||
|
|
||||||
# Compiling gdb statically to the host platform
|
# Compiling gdb statically to the host platform
|
||||||
|
|
||||||
|
@ -28,23 +28,23 @@ function set_compliation_variables() {
|
|||||||
>&2 fancy_title "Setting compilation variables for $target_arch"
|
>&2 fancy_title "Setting compilation variables for $target_arch"
|
||||||
|
|
||||||
if [[ "$target_arch" == "arm" ]]; then
|
if [[ "$target_arch" == "arm" ]]; then
|
||||||
CROSS=arm-linux-gnueabi-
|
CROSS=arm-linux-musleabi-
|
||||||
export HOST=arm-linux-gnueabi
|
export HOST=arm-linux-musleabi
|
||||||
elif [[ "$target_arch" == "aarch64" ]]; then
|
elif [[ "$target_arch" == "aarch64" ]]; then
|
||||||
CROSS=aarch64-linux-gnu-
|
CROSS=aarch64-linux-musl-
|
||||||
export HOST=aarch64-linux-gnu
|
export HOST=aarch64-linux-musl
|
||||||
elif [[ "$target_arch" == "powerpc" ]]; then
|
elif [[ "$target_arch" == "powerpc" ]]; then
|
||||||
CROSS=powerpc-linux-gnu-
|
CROSS=powerpc-linux-musl-
|
||||||
export HOST=powerpc-linux-gnu
|
export HOST=powerpc-linux-musl
|
||||||
elif [[ "$target_arch" == "mips" ]]; then
|
elif [[ "$target_arch" == "mips" ]]; then
|
||||||
CROSS=mips-linux-gnu-
|
CROSS=mips-linux-musl-
|
||||||
export HOST=mips-linux-gnu
|
export HOST=mips-linux-musl
|
||||||
elif [[ "$target_arch" == "mipsel" ]]; then
|
elif [[ "$target_arch" == "mipsel" ]]; then
|
||||||
CROSS=mipsel-linux-gnu-
|
CROSS=mipsel-linux-musl-
|
||||||
export HOST=mipsel-linux-gnu
|
export HOST=mipsel-linux-musl
|
||||||
elif [[ "$target_arch" == "x86_64" ]]; then
|
elif [[ "$target_arch" == "x86_64" ]]; then
|
||||||
CROSS=x86_64-linux-gnu-
|
CROSS=x86_64-linux-musl-
|
||||||
export HOST=x86_64-linux-gnu
|
export HOST=x86_64-linux-musl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export CC="${CROSS}gcc"
|
export CC="${CROSS}gcc"
|
||||||
@ -442,6 +442,9 @@ function build_gdb() {
|
|||||||
../configure -C --enable-static --with-static-standard-libraries --disable-inprocess-agent \
|
../configure -C --enable-static --with-static-standard-libraries --disable-inprocess-agent \
|
||||||
--enable-tui "$python_flag" \
|
--enable-tui "$python_flag" \
|
||||||
--with-expat --with-libexpat-type="static" \
|
--with-expat --with-libexpat-type="static" \
|
||||||
|
--with-gdb-datadir="/usr/share/gdb" --with-separate-debug-dir="/usr/lib/debug" \
|
||||||
|
--with-system-gdbinit="/etc/gdb/gdbinit" --with-system-gdbinit-dir="/etc/gdb/gdbinit.d" \
|
||||||
|
--with-jit-reader-dir="/usr/lib/gdb" \
|
||||||
"--with-libiconv-prefix=$libiconv_prefix" --with-libiconv-type=static \
|
"--with-libiconv-prefix=$libiconv_prefix" --with-libiconv-type=static \
|
||||||
"--with-gmp=$libgmp_prefix" \
|
"--with-gmp=$libgmp_prefix" \
|
||||||
"--with-mpfr=$libmpfr_prefix" \
|
"--with-mpfr=$libmpfr_prefix" \
|
||||||
@ -494,7 +497,7 @@ function install_gdb() {
|
|||||||
|
|
||||||
mkdir -p "$artifacts_location"
|
mkdir -p "$artifacts_location"
|
||||||
|
|
||||||
make -C "$gdb_build_dir" install "DESTDIR=$temp_artifacts_dir" 1>&2
|
make -j$(nproc) -C "$gdb_build_dir" install "DESTDIR=$temp_artifacts_dir" 1>&2
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
rm -rf "$temp_artifacts_dir"
|
rm -rf "$temp_artifacts_dir"
|
||||||
return 1
|
return 1
|
||||||
|
34
src/compilation/install_musl_toolchains.sh
Executable file
34
src/compilation/install_musl_toolchains.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Define architectures and their respective musl toolchain URLs.
|
||||||
|
ARCHS=("x86_64" "arm" "aarch64" "powerpc" "mips" "mipsel")
|
||||||
|
BASE_URL="https://musl.cc"
|
||||||
|
|
||||||
|
if [[ -z "$MUSL_INSTALL_DIR" ]]; then
|
||||||
|
echo "MUSL_INSTALL_DIR variable has not been set!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create install directory.
|
||||||
|
mkdir -p "$MUSL_INSTALL_DIR"
|
||||||
|
cd "$MUSL_INSTALL_DIR"
|
||||||
|
|
||||||
|
# Download and extract each toolchain.
|
||||||
|
for ARCH in "${ARCHS[@]}"; do
|
||||||
|
TOOLCHAIN_TAR="${ARCH}-linux-musl-cross.tgz"
|
||||||
|
|
||||||
|
# Arm has a non-generic special toolchain name :(.
|
||||||
|
if [[ "$ARCH" == "arm" ]]; then
|
||||||
|
TOOLCHAIN_TAR="arm-linux-musleabi-cross.tgz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
URL="$BASE_URL/$TOOLCHAIN_TAR"
|
||||||
|
|
||||||
|
echo "Downloading $URL..."
|
||||||
|
wget -q --show-progress "$URL"
|
||||||
|
|
||||||
|
echo "Extracting $TOOLCHAIN_TAR..."
|
||||||
|
tar -xzf "$TOOLCHAIN_TAR" --strip-components=1
|
||||||
|
rm "$TOOLCHAIN_TAR"
|
||||||
|
done
|
Reference in New Issue
Block a user