Skip to content

Build and configure with a C++ compiler - #1317

Open
ejohnstown wants to merge 3 commits into
wolfSSL:masterfrom
ejohnstown:configure-cxx-probes
Open

ejohnstown wants to merge 3 commits into
wolfSSL:masterfrom
ejohnstown:configure-cxx-probes

Conversation

@ejohnstown

@ejohnstown ejohnstown commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

configure and the sources now work with a C++ compiler as CC. Autoconf's AC_CHECK_LIB and AC_CHECK_FUNCS declare the probed symbol without extern "C", so under CC=g++ every library check failed to link.

  • configure: probe wolfSSL, forkpty, crypt and wolfTPM with AC_LINK_IFELSE through the headers the sources use
  • sources: cast the integer arm of two mixed conditionals, and clear structs with WMEMSET instead of {0}

AC_CHECK_LIB and AC_CHECK_FUNCS declare the probed symbol themselves,
without extern "C", so under CC=g++ the link looks for a mangled name
and the check fails. Probe each library with AC_LINK_IFELSE through
the header the sources use, so the checks work under C and C++.

- wolfssl: wolfCrypt_Init and wc_ecc_set_rng, after options.h
- util: forkpty through pty.h or util.h; glibc before 2.34 needs -lutil
- crypt: crypt through unistd.h, with the XSI feature-test macros
- wolftpm: wolfTPM2_Init through wolftpm/tpm2_wrap.h
C++ rejects three C idioms the tree uses: a conditional mixing an enum
constant with a byte, one mixing INADDR_ANY with a pointer, and a {0}
initializer for a struct. Cast the integer arms of the conditionals,
and clear the structs with WMEMSET instead.

- internal.c, regress.c: cast the ID_UNKNOWN arm to byte
- test.h: cast INADDR_ANY through size_t to const char*
- keygen.c, certman.c, echoserver.c, auth.c: replace {0} with WMEMSET
Copilot AI balanced review requested due to automatic review settings October 12, 2026 23:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #1317

Scan targets checked: wolfssh-src, wolfssh-bugs
Coverage: 0 of 7 in-scope changed file(s) opened by the reviewer; not opened: examples/echoserver/echoserver.c, src/certman.c, src/internal.c, src/keygen.c, tests/auth.c, tests/regress.c, wolfssh/test.h

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Lite

Run the wolfSSL link probe under AC_CACHE_CHECK with AC_CHECK_LIB's
cache name, so a preset ac_cv_lib_wolfssl_wolfCrypt_Init=yes skips the
link test. The mingw cert-store CI job relies on this, as it has no
cross-built wolfSSL to link against.
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.

4 participants