Bug 294287 - security/wolfssl: bad math long / long long settings on armv7 building ftp/curl
Summary: security/wolfssl: bad math long / long long settings on armv7 building ftp/curl
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-04-06 20:21 UTC by Robert Clausecker
Modified: 2026-04-09 12:43 UTC (History)
6 users (show)

See Also:
fox: maintainer-feedback+
fox: merge-quarterly+


Attachments
PR 10097 patch (1.67 KB, patch)
2026-04-08 13:30 UTC, Santhosh Raju
no flags Details | Diff
options.h.in.patch (538 bytes, patch)
2026-04-08 14:07 UTC, Santhosh Raju
no flags Details | Diff
wolfssl.patch (3.05 KB, patch)
2026-04-08 14:43 UTC, Santhosh Raju
no flags Details | Diff
wolfssl.patch (2.94 KB, patch)
2026-04-09 05:49 UTC, Santhosh Raju
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Clausecker freebsd_committer freebsd_triage 2026-04-06 20:21:44 UTC
ftp/curl depends on WolfSSL as of recently.  Attempting to build ftp/curl on armv7 FreeBSD 13 causes the following error:

In file included from md5.c:76:
In file included from /usr/local/include/wolfssl/openssl/md5.h:32:
In file included from /usr/local/include/wolfssl/wolfcrypt/hash.h:29:
/usr/local/include/wolfssl/wolfcrypt/types.h:1636:6: error: "bad math long / long long settings"
 1636 |     #error "bad math long / long long settings"
      |      ^
/usr/local/include/wolfssl/wolfcrypt/types.h:1638:1: error: use of empty enum
 1638 | };
      | ^


Please check and fix security/wolfssl.  FreeBSD 14 seems not to be affected.
Comment 1 Daniel Engberg freebsd_committer freebsd_triage 2026-04-06 23:53:32 UTC
It broken on all 32-bit platforms

Reported almost two weeks ago,
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293734#c52
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293734#c73
Comment 2 Santhosh Raju freebsd_committer freebsd_triage 2026-04-08 12:09:37 UTC
(In reply to Robert Clausecker from comment #0)
I was going through the WolfSSL issues in github and found the report and the suggested patch to try
- https://github.com/wolfSSL/wolfssl/issues/9936
- https://github.com/wolfSSL/wolfssl/pull/10097/changes

I can commit the patches into the ports tree, would you be able to test it out once I patch?
Comment 3 Robert Clausecker freebsd_committer freebsd_triage 2026-04-08 13:03:13 UTC
(In reply to Santhosh Raju from comment #2)

Sure thing!  I can even test the patch before you land it, just post it here.
Comment 4 Santhosh Raju freebsd_committer freebsd_triage 2026-04-08 13:28:43 UTC
(In reply to Robert Clausecker from comment #3)
Looks like applying the patch did not help with the FreeBSD 14 (i386) build.

I shall post the patch from github shortly.
Comment 5 Santhosh Raju freebsd_committer freebsd_triage 2026-04-08 13:30:23 UTC
Created attachment 269500 [details]
PR 10097 patch

This is the patch from https://github.com/wolfSSL/wolfssl/pull/10097
Comment 6 Santhosh Raju freebsd_committer freebsd_triage 2026-04-08 14:07:37 UTC
Created attachment 269503 [details]
options.h.in.patch

This patch adds the HAVE_LIMITS_H directly in options.h.in.

The github patch does not work, since we do not invoke autoreconf to regenerate the configuration files, we just call configure directly.

So we patch the generated options.h.in file to contain the fix.
Comment 7 Santhosh Raju freebsd_committer freebsd_triage 2026-04-08 14:09:30 UTC
(In reply to Robert Clausecker from comment #3)
I have directly patched the options.h.in for the fix, can you help test this one out?

This patch seems to work in FreeBSD 14 (i386). I was able to build ftp/curl without issues.

Thank you!
Comment 8 Robert Clausecker freebsd_committer freebsd_triage 2026-04-08 14:10:47 UTC
(In reply to Santhosh Raju from comment #6)

Please use the patch from github and add USES=autoreconf to regenerate the build scripts as per policy (Porter's Handbook ยง 4.4.2).
Comment 9 Santhosh Raju freebsd_committer freebsd_triage 2026-04-08 14:20:22 UTC
(In reply to Robert Clausecker from comment #8)
I guess we remove USES=autoreconf when we remove the patch (after upstream fix / release), would that be correct?
Comment 10 Santhosh Raju freebsd_committer freebsd_triage 2026-04-08 14:43:27 UTC
Created attachment 269504 [details]
wolfssl.patch

I have applied the upstream github patch and also added autoreconf into the Makefile.

Can you test this out and let me know if it works for you?
Comment 11 Robert Clausecker freebsd_committer freebsd_triage 2026-04-08 16:35:23 UTC
(In reply to Santhosh Raju from comment #10)

Your patch is defective.  Did you edit it by chance?

I recommend you use "git format-patch" and upload the output of that as is, without any changes (do not copy-paste through a text editor and do not remove any trailing newlines or blanks).
Comment 12 Daniel Engberg freebsd_committer freebsd_triage 2026-04-08 16:52:40 UTC
Perhaps instead of doing the whack a mole approach, if you can get curl with default settings to build on 135i386 you probably also have fixed other 32-bit platforms but I think that's a reasonable start and easy to test yourself.
Comment 13 Santhosh Raju freebsd_committer freebsd_triage 2026-04-09 05:49:17 UTC
Created attachment 269535 [details]
wolfssl.patch

That was my bad, I was in a hurry and just copy pasted the patch without thinking twice.

This one should work. Let me know if it works for you.
Comment 14 Santhosh Raju freebsd_committer freebsd_triage 2026-04-09 06:07:48 UTC
(In reply to Daniel Engberg from comment #12)
I was able to build it correctly in the ref i386 machines, but unfortunately I cannot seem to get autoreconf to run correctly in these machines (since I am building it as non-root), so I could not test it out there.

The above patch was tested in my normal build machine which is (amd64).
Comment 15 Robert Clausecker freebsd_committer freebsd_triage 2026-04-09 08:53:05 UTC
(In reply to Santhosh Raju from comment #14)

That patch applies, now testing.
Please remember to bump PORTREVISION.
That said, patches produced by "git format-patch" are easier to process than those generated by "git diff" as they have all the meta data to become a commit automatically.  Please try to use "git format-patch" if possible.  I don't want to go and make up commit meta data every time someone sends me a patch.
Comment 16 Robert Clausecker freebsd_committer freebsd_triage 2026-04-09 09:04:58 UTC
(In reply to Santhosh Raju from comment #14)

Fixes the build for me on i386 and armv7 FreeBSD 13.
Please commit with PORTREVISION bump and MFH to 2026Q2.
Comment 17 Santhosh Raju freebsd_committer freebsd_triage 2026-04-09 09:41:17 UTC
(In reply to Robert Clausecker from comment #15)
Alright, did not know that will use "git format-patch" that in the future. Apologies for the inconvenience.
Comment 18 commit-hook freebsd_committer freebsd_triage 2026-04-09 10:24:08 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8318a3cd1c5262d51c70240d97798cce3c1a3bd6

commit 8318a3cd1c5262d51c70240d97798cce3c1a3bd6
Author:     Santhosh Raju <fox@FreeBSD.org>
AuthorDate: 2026-04-09 10:20:04 +0000
Commit:     Santhosh Raju <fox@FreeBSD.org>
CommitDate: 2026-04-09 10:20:04 +0000

    security/wolfssl: Fix 32-bit builds.

    Add upstream patch for the fix, until changes are merged and
    a new release is made.

    PR:             294287
    Reported by:    Robert Clausecker <fuz@FreeBSD.org>
    Reviewed by:    Robert Clausecker <fuz@FreeBSD.org>
    Tested by:      Robert Clausecker <fuz@FreeBSD.org>

 security/wolfssl/Makefile                             |  3 ++-
 security/wolfssl/files/patch-cmake_config.in (new)    | 15 +++++++++++++++
 security/wolfssl/files/patch-cmake_options.h.in (new) | 15 +++++++++++++++
 security/wolfssl/files/patch-configure.ac (new)       | 16 ++++++++++++++++
 4 files changed, 48 insertions(+), 1 deletion(-)
Comment 19 commit-hook freebsd_committer freebsd_triage 2026-04-09 10:38:12 UTC
A commit in branch 2026Q2 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b313943e623465360904471f07c88d3b22d930d7

commit b313943e623465360904471f07c88d3b22d930d7
Author:     Santhosh Raju <fox@FreeBSD.org>
AuthorDate: 2026-04-09 10:20:04 +0000
Commit:     Santhosh Raju <fox@FreeBSD.org>
CommitDate: 2026-04-09 10:35:28 +0000

    security/wolfssl: Fix 32-bit builds.

    Add upstream patch for the fix, until changes are merged and
    a new release is made.

    PR:             294287
    Reported by:    Robert Clausecker <fuz@FreeBSD.org>
    Reviewed by:    Robert Clausecker <fuz@FreeBSD.org>
    Tested by:      Robert Clausecker <fuz@FreeBSD.org>

    (cherry picked from commit 8318a3cd1c5262d51c70240d97798cce3c1a3bd6)

 security/wolfssl/Makefile                             |  3 ++-
 security/wolfssl/files/patch-cmake_config.in (new)    | 15 +++++++++++++++
 security/wolfssl/files/patch-cmake_options.h.in (new) | 15 +++++++++++++++
 security/wolfssl/files/patch-configure.ac (new)       | 16 ++++++++++++++++
 4 files changed, 48 insertions(+), 1 deletion(-)
Comment 20 Santhosh Raju freebsd_committer freebsd_triage 2026-04-09 10:43:22 UTC
I have committed the changes and also did a MFH 2026Q2

Thank you both @fuz and @dizzy in helping with the bug report.

Shall I mark this as "Closed"?
Comment 21 Robert Clausecker freebsd_committer freebsd_triage 2026-04-09 12:43:32 UTC
(In reply to Santhosh Raju from comment #20)

Should be fine now, thank you for following up so quickly!