Skip to content

ci: reinstall libbrotli-dev on Linux test runners#2391

Merged
dunglas merged 4 commits intomainfrom
ci/install-libbrotli-dev
May 4, 2026
Merged

ci: reinstall libbrotli-dev on Linux test runners#2391
dunglas merged 4 commits intomainfrom
ci/install-libbrotli-dev

Conversation

@dunglas
Copy link
Copy Markdown
Member

@dunglas dunglas commented May 4, 2026

The Linux Caddy module tests fail at compile time:

../../../../go/pkg/mod/github.com/google/brotli/go/cbrotli@v1.1.0/reader.go:13:10: fatal error: brotli/decode.h: No such file or directory

caddy/ pulls in github.com/dunglas/caddy-cbrotli, which depends on github.com/google/brotli/go/cbrotli and uses // #cgo pkg-config: libbrotlicommon libbrotlidec libbrotlienc.

Root cause

The ubuntu-latest runner (noble, image ubuntu24/2026..*) lists libbrotli-dev 1.1.0-2build2 as installed in dpkg, but the package's files are missing on disk. Diagnostics from a CI run on this branch:

$ dpkg -l | grep brotli
ii  brotli                  1.1.0-2build2  amd64  ...
ii  libbrotli-dev:amd64     1.1.0-2build2  amd64  ...
ii  libbrotli1:amd64        1.1.0-2build2  amd64  ...

$ ls /usr/include/brotli/
ls: cannot access '/usr/include/brotli/': No such file or directory

$ find /usr -name 'libbrotli*.pc'
/usr/share/miniconda/lib/pkgconfig/libbrotli{common,dec,enc}.pc
# system /usr/lib/x86_64-linux-gnu/pkgconfig/libbrotli*.pc absent

$ pkg-config --cflags libbrotlicommon libbrotlidec libbrotlienc
Package libbrotlicommon was not found in the pkg-config search path.
Package 'libbrotlicommon', required by 'virtual:world', not found

A plain apt-get install -y libbrotli-dev is a no-op because dpkg believes the package is current. --reinstall forces apt to re-extract the files so cgo's pkg-config invocation succeeds and gcc can resolve <brotli/decode.h>.

Reproduces on PR-2365 https://github.com/php/frankenphp/actions/runs/25315574252/job/74212221237 and on every recent main run, e.g. https://github.com/php/frankenphp/actions/runs/25286789334.

The Caddy module tests pull in github.com/dunglas/caddy-cbrotli, which
depends on github.com/google/brotli/go/cbrotli and needs the brotli C
headers (brotli/encode.h) at build time. The ubuntu-latest image no
longer ships them, so the build fails with:

  fatal error: brotli/encode.h: No such file or directory

Install libbrotli-dev before the test step. macOS already has the
headers via homebrew, so it does not need a change.
Copilot AI review requested due to automatic review settings May 4, 2026 11:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes CI build failures for the Linux Caddy module test job by ensuring the Brotli C development headers are present on ubuntu-latest, which is required by github.com/google/brotli/go/cbrotli (pulled in via the caddy/ module dependencies).

Changes:

  • Add an apt-get install step for libbrotli-dev in the Linux test workflow before building/testing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

dunglas added 2 commits May 4, 2026 14:04
The apt-get step was a no-op (libbrotli-dev already installed on the
runner: 1.1.0-2build2), yet the cgo build still fails to find
brotli/decode.h. Swap in a diagnostic step that prints what the runner
actually has: dpkg state, header files on disk, .pc files, pkg-config
output, and gcc default include search path. The next CI run will tell
us why the headers aren't reachable.
The Caddy module tests fail at compile time:

  fatal error: brotli/decode.h: No such file or directory

Diagnostics on the ubuntu-latest runner show libbrotli-dev (1.1.0-2build2)
listed as installed by dpkg, but its files are missing from disk:

  ls /usr/include/brotli/
  ls: cannot access '/usr/include/brotli/': No such file or directory

  find /usr -name 'libbrotli*.pc'
  /usr/share/miniconda/lib/pkgconfig/libbrotli{common,dec,enc}.pc
  (system /usr/lib/x86_64-linux-gnu/pkgconfig/libbrotli*.pc absent)

  pkg-config --cflags libbrotlicommon libbrotlidec libbrotlienc
  Package libbrotlicommon was not found in the pkg-config search path.

A plain 'apt-get install libbrotli-dev' is a no-op because dpkg believes
the package is current. --reinstall forces apt to re-extract the files
so cgo can resolve the cbrotli pkg-config dependency.
@dunglas dunglas changed the title ci: install libbrotli-dev on Linux test runners ci: reinstall libbrotli-dev on Linux test runners May 4, 2026
@dunglas dunglas requested a review from Copilot May 4, 2026 12:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@henderkes henderkes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely forgot to create an individual PR after fixing it in the fork one.

Comment thread .github/workflows/tests.yaml
Removed comments explaining the workaround for libbrotli-dev installation.

Signed-off-by: Kévin Dunglas <kevin@dunglas.fr>
@dunglas dunglas merged commit 09bf047 into main May 4, 2026
12 checks passed
@dunglas dunglas deleted the ci/install-libbrotli-dev branch May 4, 2026 12:36
@dunglas dunglas requested review from Copilot and henderkes May 4, 2026 12:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/tests.yaml
Comment thread .github/workflows/tests.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants