Skip to content

Commit 35e514f

Browse files
authored
Merge pull request #52 from guyush1/use-musl-finally
Use musl finally
2 parents 7c10ee9 + b59e10d commit 35e514f

File tree

12 files changed

+206
-63
lines changed

12 files changed

+206
-63
lines changed

.github/workflows/pr-pipeline.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77

88
jobs:
99
build:
10+
env:
11+
TTY_ARG: "" # Disable interactive build mode in cicd since it does not contain a tty device.
12+
1013
strategy:
1114
matrix:
1215
build_type: ["build", "build-with-python"]

.github/workflows/release-pipeline.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
# simply build the files in the same job they are released.
1010
jobs:
1111
build_and_publish:
12+
env:
13+
TTY_ARG: "" # Disable interactive build mode in cicd since it does not contain a tty device.
14+
1215
runs-on: ubuntu-latest
1316
steps:
1417
- uses: actions/checkout@v4
@@ -27,4 +30,4 @@ jobs:
2730
- name: Publish release
2831
uses: softprops/action-gh-release@v2
2932
with:
30-
files: build/artifacts/gdb-static*.tar.gz
33+
files: build/artifacts/gdb-static*.tar.gz

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@
1212
[submodule "src/submodule_packages/libexpat"]
1313
path = src/submodule_packages/libexpat
1414
url = git@github.com:guyush1/libexpat.git
15+
[submodule "xz"]
16+
path = src/submodule_packages/xz
17+
url = https://github.com/tukaani-project/xz.git

Dockerfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
FROM ubuntu:24.04
22

3-
# Install dependencies
43
RUN apt update && apt install -y \
4+
autopoint \
5+
binutils-multiarch \
56
bison \
67
file \
78
flex \
@@ -18,16 +19,22 @@ RUN apt update && apt install -y \
1819
gcc-mipsel-linux-gnu \
1920
gcc-powerpc-linux-gnu \
2021
git \
21-
libncurses-dev \
2222
libtool \
2323
m4 \
2424
make \
2525
patch \
2626
pkg-config \
2727
python3.12 \
28+
python3-requests \
2829
libpython3-dev \
2930
texinfo \
3031
wget \
3132
xz-utils
3233

34+
COPY src/docker_utils/download_musl_toolchains.py .
35+
RUN python3.12 -u download_musl_toolchains.py
36+
3337
WORKDIR /app/gdb
38+
39+
ENTRYPOINT ["/entrypoint.sh"]
40+
CMD ["bash"]

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ ALL_PACK_TARGETS := $(PACK_TARGETS) $(PYTHON_PACK_TARGETS)
1111
SUBMODULE_PACKAGES := $(wildcard src/submodule_packages/*)
1212
BUILD_PACKAGES_DIR := "build/packages"
1313

14+
# We would like to run in interactive mode when avaliable (non-ci usually).
15+
# This is disabled by the ci automation manually.
16+
TTY_ARG ?= -it
17+
1418
.PHONY: clean help download_packages build build-docker-image $(ALL_TARGETS) $(ALL_PACK_TARGETS)
1519

1620
.NOTPARALLEL: build pack
@@ -27,7 +31,7 @@ help:
2731
@echo ""
2832
@echo " make clean"
2933

30-
build/build-docker-image.stamp: Dockerfile
34+
build/build-docker-image.stamp: Dockerfile src/docker_utils/download_musl_toolchains.py
3135
mkdir -p build
3236
docker buildx build --tag gdb-static .
3337
touch build/build-docker-image.stamp
@@ -36,7 +40,7 @@ build-docker-image: build/build-docker-image.stamp
3640

3741
build/download-packages.stamp: build/build-docker-image.stamp src/compilation/download_packages.sh
3842
mkdir -p $(BUILD_PACKAGES_DIR)
39-
docker run --user $(shell id -u):$(shell id -g) \
43+
docker run $(TTY_ARG) --user $(shell id -u):$(shell id -g) \
4044
--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
4145
/app/gdb/src/compilation/download_packages.sh /app/gdb/$(BUILD_PACKAGES_DIR)/
4246
touch build/download-packages.stamp
@@ -59,7 +63,7 @@ $(PYTHON_TARGETS): build-with-python-%:
5963

6064
_build-%: symlink-git-packages download-packages build-docker-image
6165
mkdir -p build
62-
docker run --user $(shell id -u):$(shell id -g) \
66+
docker run $(TTY_ARG) --user $(shell id -u):$(shell id -g) \
6367
--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
6468
/app/gdb/src/compilation/build.sh $* /app/gdb/build/ /app/gdb/src $(WITH_PYTHON)
6569

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ This is where `gdb-static` comes in! We provide static builds of `gdb` (and `gdb
4444
</summary> <br />
4545

4646
- **Static Builds**: No dependencies, no installation, just download and run!
47+
- **Musl Based**: We use Musl in order to create distribution-independant binaries that can work anywhere.
4748
- **Latest Versions**: We keep our builds up-to-date with the latest versions of GDB.
4849
- **Builtin Python (Optional)**: We provide builds with Python support built-in.
4950
- **XML Support**: Our builds come with XML support built-in, which is useful for some GDB commands.

compilation.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ Please note that when specifying a compilation dir throughout the compilation pr
1414
Instead, always use absolute paths.
1515

1616
Examples to the <VARIABLES> throughout the script:
17-
- <CROSS_COMPILER_C> - arm-linux-gnueabi-gcc
18-
- <CROSS_COMPILER_CPP> - arm-linux-gnueabi-g++
19-
- <HOST_NAME> - arm-linux-gnueabi
17+
- <CROSS_COMPILER_C> - arm-linux-musleabi-gcc
18+
- <CROSS_COMPILER_CPP> - arm-linux-musleabi-g++
19+
- <HOST_NAME> - arm-linux-musleabi
2020
- <COMPILATION_DIR_PATH> - /home/username/projects/libgmp-x.y.z/build-arm/
2121

22-
Environment info:
23-
- 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!).
22+
## Choosing the right compiler
23+
24+
It is recommended to use a musl-based compiler. Unlike glibc, musl is not dependant on your distribution.
25+
Using regular gcc that is glibc based should work most of the time, but we had some people reporting crashes mainly in gdbserver, so we switched to musl-based toolchains.
2426

2527
# Compiling gdb statically to the host platform
2628

0 commit comments

Comments
 (0)