Skip to content

ensure to #include our own pcre2.h #9892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: maint-28
Choose a base branch
from

Conversation

mikpe
Copy link
Contributor

@mikpe mikpe commented May 30, 2025

Otherwise the build may pick up a different one which won't work since BEAM depends on its own modifications to pcre2.h.

Fixes:

beam/erl_bif_re.c:747:2: error: call to undeclared function 'pcre2_free_restart_data'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  747 |         pcre2_free_restart_data(rc->match_data);
      |         ^

(and several more) when building OTP-28.0 on a mac with pcre2.h installed in /opt/homebrew/include/.

The issue can occur on any system where CFLAGS has -I addons set to pick up additional headers not installed in the traditional locations known natively by the compiler, i.e. outside of /usr/include/. The end result is a compile command where those -I addons precede the -Ipcre that BEAM adds, and the wrong pcre2.h is selected.

Since BEAM has to use its own pcre2.h, the fix is to use an absolute path relative the source file when including it.

Otherwise the build may pick up a different one which won't work
since BEAM depends on its own modifications to the pcre2 API.
Copy link
Contributor

github-actions bot commented May 30, 2025

CT Test Results

    3 files    142 suites   50m 5s ⏱️
1 649 tests 1 592 ✅ 57 💤 0 ❌
2 372 runs  2 295 ✅ 77 💤 0 ❌

Results for commit aa76920.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@rickard-green rickard-green added the team:VM Assigned to OTP team VM label Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants