Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,66 @@ on:
pull_request:

jobs:
build-netbsd:
runs-on: ubuntu-latest
name: build • netbsd ${{ matrix.release }}
defaults:
run:
shell: netbsd {0}
strategy:
fail-fast: false
matrix:
# Test all supported releases.
# See https://www.netbsd.org/releases/.
include:
- release: 9.4
capnproto-cppflags: 'CPPFLAGS="-DKJ_NO_EXCEPTIONS=0 -DKJ_USE_KQUEUE=0"'
- release: 10.1
capnproto-cppflags: 'CPPFLAGS="-DKJ_NO_EXCEPTIONS=0"'
steps:
- uses: actions/checkout@v6

- name: Start NetBSD VM
uses: vmactions/netbsd-vm@v1
with:
release: ${{ matrix.release }}
# The installed compiler version must match the CXX variable
# defined in `ci/configs/netbsd.bash`.
prepare: |
pkg_add cmake ninja-build gcc14
# capnproto prerequisites.
# See the following "Install capnproto" step.
run: |
set -e
pkg_add digest libtool-base mktools pkgconf cwrappers
pkg_admin -K /usr/pkg/pkgdb fetch-pkg-vulnerabilities
cd /usr
cvs [email protected]:/cvsroot checkout -P \
pkgsrc/devel/capnproto \
pkgsrc/devel/libtool-base \
pkgsrc/devel/pkgconf \
pkgsrc/devel/zlib \
`# gcc15 is referenced here because the pkgsrc framework requires lang/gcc15/version.mk to exist` \
Copy link
Collaborator

Choose a reason for hiding this comment

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

In commit "ci: Add NetBSD job" (861da39)

Interesting, have not seen `# comment` used before in bash, but makes sense here

`# during the "make install" step below, even though we compile our project with gcc14.` \
pkgsrc/lang/gcc15 \
pkgsrc/mk \
pkgsrc/pkgtools \
pkgsrc/security/openssl \
pkgsrc/sysutils/install-sh/files
sync: 'rsync'
copyback: false

- name: Install capnproto
run: |
cd /usr/pkgsrc/devel/capnproto/
unset PKG_PATH
make ${{ matrix.capnproto-cppflags }} install

- name: Run CI script
run: |
cd ${{ github.workspace }}
CI_CONFIG="ci/configs/netbsd.bash" bash ci/scripts/ci.sh

build-openbsd:
runs-on: ubuntu-latest
name: build • openbsd
Expand Down
11 changes: 11 additions & 0 deletions ci/configs/netbsd.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CI_DESC="CI config for NetBSD"
CI_DIR=build-netbsd
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-unused-parameter"
# Hardcode GCC 14, since default GCC versions installed by NetBSD are older
# and may not be compatible with libmultiprocess. GCC 14 was chosen because
# it's the latest compiler available on all versions of NetBSD that we test.
# Note that the GCC version specified here must match the version specified
# in pkg_add in ci.yml.
export CXX="/usr/pkg/gcc14/bin/g++"
Copy link
Collaborator

Choose a reason for hiding this comment

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

In commit "ci: Add NetBSD job" (d6f80ca)

Is it necessary to hardcode gcc 14 here? If the gcc version in this file needs to be kept in sync with the gcc version ci.yml it would be helpful to have a comment both places stating this. Or if there is a way to use a default system compiler or a default gcc version and not hardcode any version that would seem even nicer.

Copy link
Member Author

@hebasto hebasto Jan 9, 2026

Choose a reason for hiding this comment

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

Is it necessary to hardcode gcc 14 here? ... if there is a way to use a default system compiler or a default gcc version and not hardcode any version that would seem even nicer.

On NetBSD 9.4, the default compiler is GCC 7.5.0, and the build fails at the configuration stage.

On NetBSD 10.1, the default compiler is GCC 10.5.0, and the build fails as well:

 [6/7] Building CXX object CMakeFiles/multiprocess.dir/src/mp/proxy.cpp.o
FAILED: [code=1] CMakeFiles/multiprocess.dir/src/mp/proxy.cpp.o 
/usr/bin/c++  -I/home/runner/work/libmultiprocess/libmultiprocess/build-netbsd/include -I/home/runner/work/libmultiprocess/libmultiprocess/include -isystem /usr/pkg/include -Werror -Wall -Wextra -Wpedantic -Wno-unused-parameter -std=gnu++2a -pthread -MD -MT CMakeFiles/multiprocess.dir/src/mp/proxy.cpp.o -MF CMakeFiles/multiprocess.dir/src/mp/proxy.cpp.o.d -o CMakeFiles/multiprocess.dir/src/mp/proxy.cpp.o -c /home/runner/work/libmultiprocess/libmultiprocess/src/mp/proxy.cpp
In file included from /home/runner/work/libmultiprocess/libmultiprocess/src/mp/proxy.cpp:8:
/home/runner/work/libmultiprocess/libmultiprocess/include/mp/proxy-types.h:527:2: error: extra ‘;’ [-Werror=pedantic]
  527 | };
      |  ^
cc1plus: all warnings being treated as errors
ninja: build stopped: cannot make progress due to previous errors.

Copy link
Member Author

Choose a reason for hiding this comment

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

If the gcc version in this file needs to be kept in sync with the gcc version ci.yml it would be helpful to have a comment both places stating this.

Thanks! Updated.

Copy link
Collaborator

Choose a reason for hiding this comment

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

re: #196 (comment)

Thanks for providing the errors. It appears the reason for hardcoding gcc14 is that if you don't hardcode it, netbsd uses much older versions of gcc that don't recognize c++20 or fail with -Werror=pedantic due to a trailing semicolon.

I guess my next question would be why use gcc14 instead of another version of GCC? Was the choice based on trial and error, or any particular reasoning?

I think my suggestion would be to add a comment to netbsd.bash explaining the need for hardcoding and the choice of hardcoded version. For example, "Hardcode GCC 14, since default GCC versions installed by netbsd are older and may not be compatible with libmultiprocess. GCC 14 was chosen because it's the latest compiler available on all versions of netbsd that we test. Note that the GCC version specified here must match the version specified in pkg_add in ci.yml." I don't know if this comment is accurate, but whatever version of this comment that would be accurate would be helpful so we know how this needs to be maintained going forward.

CMAKE_ARGS=(-G Ninja)
BUILD_ARGS=(-k 0)
Loading