What is the proper way to compile and install Firefox with GDB support on Alpine linux?
The end goal is to have Firefox with GDB support to be able to debug Firefox crashes on Alpine.
My Dockerfile looks like:
FROM alpine:3.13.0
# download/patch Firefox
RUN apk add alpine-sdk sudo
RUN git clone https://gitlab.alpinelinux.org/alpine/aports.git && cd aports && git reset --hard v3.13.0
COPY ff_for_gdb.patch aports/
RUN cd aports && git apply ff_for_gdb.patch
WORKDIR aports/community/firefox
# build and install Firefox
# based on https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package
RUN adduser bb -G abuild -D -s /bin/sh && echo "bb ALL=(ALL) ALL" >> /etc/sudoers
RUN chmod -R a+w ./ && mkdir -p /var/cache/distfiles && chmod a+w /var/cache/distfiles
RUN abuild-keygen -a -i && chmod 0755 /root /root/.abuild && chmod 0444 /root/.abuild/*.rsa && echo "PACKAGER_PRIVKEY=$(ls /root/.abuild/*.rsa | head -n1)" >> /etc/abuild.conf
RUN su bb -c 'abuild checksum && abuild -r'
# install Firefox
RUN cd /home/bb/packages/community/x86_64 && apk add --allow-untrusted firefox-esr-dbg*.apk
where the ff_for_gdb.patch
contains:
diff --git a/community/firefox/APKBUILD b/community/firefox/APKBUILD
index d473981f57..9ff7e4a39c 100644
--- a/community/firefox/APKBUILD
+++ b/community/firefox/APKBUILD
@@ -83,7 +83,7 @@ source="https://ftp.mozilla.org/pub/firefox/releases/$pkgver/source/firefox-$pkg
avoid-redefinition.patch
"
-subpackages="$pkgname-npapi"
+subpackages="$pkgname-npapi $pkgname-dbg"
_mozappdir=/usr/lib/firefox
@@ -301,6 +301,8 @@ build() {
;;
*) _rust_simd="--enable-rust-simd" ;;
esac
+
+ export RUSTFLAGS="$RUSTFLAGS -C debuginfo=2"
../mach configure
--prefix=/usr
@@ -343,7 +345,9 @@ build() {
--with-system-webp
--with-system-zlib
--with-clang-path=/usr/bin/clang
- --with-libclang-path=/usr/lib
+ --with-libclang-path=/usr/lib
+ --enable-debug
+ --enable-debug-symbols
../mach build
}
The compilation finishes without an error, but the resulting package can not be installed, apk add --allow-untrusted firefox-esr-dbg*.apk
ends up with the following error:
#18 19.49 (1/1) Installing firefox-dbg (84.0.2-r0)
#18 41.04 ERROR: Failed to create usr/lib/debug/usr/lib/firefox/libxul.so.debug: No error information
#18 41.18 1 error; 3418 MiB in 98 packages
Is the patch correct way to add GDB support and how to fix the install?
question from:
https://stackoverflow.com/questions/65858128/how-to-compile-firefox-on-alpine-with-gdb-support 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…