Skip to content

Commit

Permalink
abseil-cpp: Add GCC spec file to workaround GCC bug
Browse files Browse the repository at this point in the history
abseil-cpp and packages that use it began to FTBFS after the introduction of
openssf-compiler-options, specifically its addition of the
-fno-delete-null-pointer-checks flag. This is believed to be a GCC bug:
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71962

Unfortunately it isn't possible to "undo" this flag by appending the
inverse flag (-fdelete-null-pointer-checks). So here we introduce a
new spec file for abseil-cpp builds that will filter out the
problematic flag from the openssf spec file. Fixes wolfi-dev#34075.

This commit uses the spec file to build abseil-cpp itself, and
ships it in the abseil-cpp-dev apk so abseil-cpp's reverse
dependencies can be updated to use it.

Signed-off-by: dann frazier <[email protected]>
  • Loading branch information
dannf committed Nov 15, 2024
1 parent 1f83a9a commit aaa02a0
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 1 deletion.
15 changes: 14 additions & 1 deletion abseil-cpp.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package:
name: abseil-cpp
version: "20240722.0"
epoch: 0
epoch: 1
description: Abseil Common Libraries (C++)
copyright:
- license: Apache-2.0
Expand All @@ -26,7 +26,16 @@ pipeline:
expected-commit: 4447c7562e3bc702ade25105912dce503f0c4010

- runs: |
mkdir -p "${{targets.destdir}}"
# https://github.com/wolfi-dev/os/issues/34075
cp -r usr "${{targets.destdir}}"
- environment:
CMAKE_CXX_FLAGS: "-B ${{targets.destdir}}/usr/lib/gcc -specs abseil-cpp.spec"
runs: |
# https://github.com/wolfi-dev/os/issues/34075
cmake -B build -G Ninja \
-DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_INSTALL_PREFIX=/usr \
Expand Down Expand Up @@ -164,6 +173,10 @@ subpackages:
- name: abseil-cpp-dev
pipeline:
- uses: split/dev
- name: "Install GCC spec files for https://github.com/wolfi-dev/os/issues/34075"
runs: |
mkdir -p ${{targets.subpkgdir}}/usr/lib
mv ${{targets.destdir}}/usr/lib/gcc ${{targets.subpkgdir}}/usr/lib
dependencies:
runtime:
- abseil-cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://github.com/wolfi-dev/os/issues/34075
*self_spec:
%<fno-delete-null-pointer-checks
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://github.com/wolfi-dev/os/issues/34075
*self_spec:
%<fno-delete-null-pointer-checks
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://github.com/wolfi-dev/os/issues/34075
*self_spec:
%<fno-delete-null-pointer-checks
3 changes: 3 additions & 0 deletions abseil-cpp/usr/lib/gcc/x86_64-pc-linux-gnu/12/abseil-cpp.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://github.com/wolfi-dev/os/issues/34075
*self_spec:
%<fno-delete-null-pointer-checks
3 changes: 3 additions & 0 deletions abseil-cpp/usr/lib/gcc/x86_64-pc-linux-gnu/13/abseil-cpp.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://github.com/wolfi-dev/os/issues/34075
*self_spec:
%<fno-delete-null-pointer-checks
3 changes: 3 additions & 0 deletions abseil-cpp/usr/lib/gcc/x86_64-pc-linux-gnu/14/abseil-cpp.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://github.com/wolfi-dev/os/issues/34075
*self_spec:
%<fno-delete-null-pointer-checks

0 comments on commit aaa02a0

Please sign in to comment.