Skip to content

build: compile C++ Boost benchmarks with C++14 - #16556

Merged
kgryte merged 1 commit into
stdlib-js:developfrom
batpigandme:build/benchmarks-cxx14
Nov 10, 2026
Merged

kgryte merged 1 commit into
stdlib-js:developfrom
batpigandme:build/benchmarks-cxx14

Conversation

@batpigandme

@batpigandme batpigandme commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:

  • task: lint_filenames status: passed
  • task: lint_editorconfig status: passed
  • task: lint_markdown_pkg_readmes status: na
  • task: lint_markdown_docs status: na
  • task: lint_markdown status: na
  • task: lint_package_json status: na
  • task: lint_repl_help status: na
  • task: lint_javascript_src status: na
  • task: lint_javascript_cli status: na
  • task: lint_javascript_examples status: na
  • task: lint_javascript_tests status: na
  • task: lint_javascript_benchmarks status: na
  • task: lint_python status: na
  • task: lint_r status: na
  • task: lint_c_src status: na
  • task: lint_c_examples status: na
  • task: lint_c_benchmarks status: na
  • task: lint_c_tests_fixtures status: na
  • task: lint_shell status: na
  • task: lint_typescript_declarations status: passed
  • task: lint_typescript_tests status: na
  • task: lint_license_headers status: passed ---

Description

What is the purpose of this pull request?

This pull request:

  • Updates the C++ benchmark Makefiles that build against Boost (benchmark/cpp/boost/Makefile, 42 packages) and their snippet template (tools/snippets/benchmark/cpp/boost/Makefile) from -std=c++11 to -std=c++14.
  • Updates COMMON_CXXFLAGS in tools/make/common.mk to match.

Follow up to #16545 where we moved stdlib's Boost pin to 1.92.0, these benchmarks otherwise wouldn't build as Boost.Math requires C++14, and under C++11 each one warns "Boost.Math requires C++14" and then fails to compile.

Related Issues

Does this pull request have any related issues?

No.

Reference Packages

Did the content of this pull request follow one or more existing packages? Answering is optional.

This pull request followed these packages:

What carried over from the reference(s)?

  • The change itself, in the package Makefiles and their snippet template.

What differed, or what did you have to work out yourself?

  • Which Makefiles build against Boost: the 42 under benchmark/cpp/boost/. ldexp's C++ benchmark, the only other one, uses no Boost and is left at C++11 (LMK if you want that updated to C++14, too, but it doesn't need to be strictly).

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

⚠️ Watch outs

  • gamma1pm1's benchmark doesn't build at any Boost version—it calls boost::math::gamma1pm1, and Boost's function is tgamma1pm1. I have a separate PR for that, to keep this one focused, and I'll file after this one.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

Claude (Opus 5.5) found the Makefiles, made the changes, and checked the builds on macOS. I reviewed the changes and the PR description.


@stdlib-js/reviewers

Boost.Math, at the 1.92.0 that stdlib now pins, requires C++14, so the
C++ benchmarks against Boost no longer build at C++11. This follows
the same change to the C++ test fixture runners, and moves the
benchmark snippet template and `COMMON_CXXFLAGS` with them.

Ref: stdlib-js#16545
Assisted-by: Claude Opus 5.5

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@batpigandme
batpigandme requested a review from a team November 9, 2026 15:15
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Nov 9, 2026
@batpigandme

Copy link
Copy Markdown
Member Author
  • The Lint Changed Files failure is the same package.json one as in build: upgrade Boost & compile C++ test fixture runners w C++14 #16545.
  • Run affected tests timed out after 30 minutes, with no failing tests before it stopped. Because the Makefiles changed, it runs the tests for every package that requires one of the 42, which is a few hundred packages. Neither job builds the C++ benchmarks this PR changes.

@batpigandme

Copy link
Copy Markdown
Member Author

Run affected benchmarks failed compiling besselj0's C benchmark, which this PR doesn't touch: with -std=c99, glibc doesn't declare the POSIX function j0, so the call is an implicit declaration. besselj1, bessely0, and bessely1 make the same kind of call, but the run stopped before reaching them.

@batpigandme

Copy link
Copy Markdown
Member Author

Run affected benchmarks failed compiling besselj0's C benchmark, which this PR doesn't touch: with -std=c99, glibc doesn't declare the POSIX function j0, so the call is an implicit declaration. besselj1, bessely0, and bessely1 make the same kind of call, but the run stopped before reaching them.

Looked into the bessel failures. The four C benchmarks call the POSIX functions j0, j1, y0, and y1, and compile with -std=c99, under which glibc doesn't declare them. Possibly started failing because the runner moved to ubuntu-26.04, whose GCC 15 treats a call to an undeclared function as an error (GCC 14+); before that it was a warning. macOS declares them either way, which is why they build locally on a Mac.

Defining _DEFAULT_SOURCE or _XOPEN_SOURCE=600 fixes all four on Linux (tested on Docker image) and changes nothing on macOS. It's a one-line change per package, so it could be its own small PR. Happy to put one up once we've settled on which macro, and whether it goes in the Makefile or the source file.

@kgryte kgryte added Benchmarks Pull requests adding or improving benchmarks for measuring performance. and removed Needs Review A pull request which needs code review. labels Nov 10, 2026
@kgryte

kgryte commented Nov 10, 2026

Copy link
Copy Markdown
Member

I have a separate PR for that, to keep this one focused, and I'll file after this one.

Sounds good. Thank you!

@kgryte kgryte left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@kgryte

kgryte commented Nov 10, 2026

Copy link
Copy Markdown
Member

The four C benchmarks call the POSIX functions j0, j1, y0, and y1, and compile with -std=c99, under which glibc doesn't declare them. Possibly started failing because the runner moved to ubuntu-26.04, whose GCC 15 treats a call to an undeclared function as an error (GCC 14+); before that it was a warning. macOS declares them either way, which is why they build locally on a Mac.

Indeed. See the notes in the benchmark source file. They state that we assume the existence of a C compiler which includes special function extensions, such as the Bessel functions. Ref: https://github.com/stdlib-js/stdlib/blob/648ec0ffd38c2dd003f58355f328f9a189cf6646/lib/node_modules/%40stdlib/math/base/special/besselj0/benchmark/c/benchmark.c#L27C8-L27C81

@kgryte

kgryte commented Nov 10, 2026

Copy link
Copy Markdown
Member

As the CI failure is not due to changes introduced in this PR, I'll go ahead and merge.

@kgryte
kgryte merged commit 2b568bd into stdlib-js:develop Nov 10, 2026
51 of 54 checks passed
kgryte pushed a commit that referenced this pull request Nov 10, 2026
PR-URL: #16557
Reviewed-by: Athan Reines <kgryte@gmail.com>
Ref: #16556
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Benchmarks Pull requests adding or improving benchmarks for measuring performance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants