Bug 293334 - math/octave-forge-mboct-fem-pkg: Fails to build with GCC 15: configure: error: octave header files not found
Summary: math/octave-forge-mboct-fem-pkg: Fails to build with GCC 15: configure: error...
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: Stephen Montgomery-Smith
URL: https://pkg-status.freebsd.org/gohan0...
Keywords:
Depends on:
Blocks: 292692
  Show dependency treegraph
 
Reported: 2026-02-21 13:44 UTC by Lorenzo Salvadore
Modified: 2026-03-05 00:03 UTC (History)
0 users

See Also:
salvadore: maintainer-feedback+


Attachments
Patch to get GCC 15 to work. (1.93 KB, text/plain)
2026-02-23 07:18 UTC, Stephen Montgomery-Smith
no flags Details
Patch to get GCC 15 to work. (1.93 KB, text/plain)
2026-02-23 07:23 UTC, Stephen Montgomery-Smith
no flags Details
Patch to get GCC 15 to work version 3 (1.94 KB, text/plain)
2026-02-23 08:22 UTC, Stephen Montgomery-Smith
no flags Details
Patch to get GCC 15 to work. (1.91 KB, text/plain)
2026-02-26 02:30 UTC, Stephen Montgomery-Smith
no flags Details
Patch to get GCC 15 to work. (717 bytes, text/plain)
2026-03-02 19:23 UTC, Stephen Montgomery-Smith
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lorenzo Salvadore freebsd_committer freebsd_triage 2026-02-21 13:44:20 UTC
The port fails to build with GCC 15 and blocks GCC_DEFAULT update to 15. Full log in URL field. This link might be useful: https://gcc.gnu.org/gcc-15/porting_to.html .

checking for nlopt_set_ftol_abs... yes
checking for nlopt_optimize... yes
checking for octave/oct.h... no
configure: error: octave header files not found
===>  Script "configure" failed unexpectedly.
Please report the problem to stephen@FreeBSD.org [maintainer] and attach the
"/wrkdirs/usr/ports/math/octave-forge-mboct-fem-pkg/work/mboct-fem-pkg-0.2.2/src/config.log"
including the output of the failure of your make command. Also, it might be
a good idea to provide an overview of all packages installed on your system
(e.g. a /usr/local/sbin/pkg-static info -g -Ea).
*** Error code 1
Comment 1 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2026-02-22 21:03:42 UTC
Can you provide me a guide on the best way to test the port with GCC-15?
Comment 2 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2026-02-23 07:18:41 UTC
Created attachment 268288 [details]
Patch to get GCC 15 to work.

OK, I figured out how to test GCC_DEFAULT=15.

This turned out to be a rather difficult job, since the port uses constexpr in a non-compliant manner.  So I had to be rather creative.  Tell me if the attached patch works?
Comment 3 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2026-02-23 07:23:47 UTC
Created attachment 268289 [details]
Patch to get GCC 15 to work.

Use this patch instead.  The last one has an error.
Comment 4 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2026-02-23 08:22:39 UTC
Created attachment 268291 [details]
Patch to get GCC 15 to work version 3

No, use this one.
Comment 5 Lorenzo Salvadore freebsd_committer freebsd_triage 2026-02-25 09:12:33 UTC
Thanks Stephen, I will test yout patch as soon as possible.

Just a note about style: I have noticed that you are adding a pre-build target before you finish declaring variables. This is very unusual and the recommendation in the porter's handbook is to declare targets after variables (https://docs.freebsd.org/en/books/porters-handbook/order/#porting-order-targets). I strongly suggest you follow it unless you have a specific reason to do things differently.
Comment 6 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2026-02-25 19:40:42 UTC
(In reply to Lorenzo Salvadore from comment #5)

OK, I'll do that.
Comment 7 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2026-02-26 02:30:34 UTC
Created attachment 268362 [details]
Patch to get GCC 15 to work.
Comment 8 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2026-02-28 19:13:29 UTC
I contacted the writers of the code.  The just informed me that their solution is to use clang instead of gcc.  I am somewhat conflicted about this advice, since technically their code is non-compliant, and they are relying on the notion that clang doesn't strictly follow the standard.
Comment 9 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2026-02-28 19:41:38 UTC
(In reply to Stephen Montgomery-Smith from comment #8)

Oh, they also require c++23.
Comment 10 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2026-03-02 19:23:02 UTC
Created attachment 268488 [details]
Patch to get GCC 15 to work.

This patch is much simpler.  I won't even bump portrevision with this one.  After more testing, I will commit it, probably today.
Comment 11 commit-hook freebsd_committer freebsd_triage 2026-03-03 01:45:31 UTC
A commit in branch main references this bug:

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

commit 99139ce3bdd80f7fbbd1aa13590fcc92d04e0769
Author:     Stephen Montgomery-Smith <stephen@FreeBSD.org>
AuthorDate: 2026-03-03 01:43:02 +0000
Commit:     Stephen Montgomery-Smith <stephen@FreeBSD.org>
CommitDate: 2026-03-03 01:43:02 +0000

    math/octave-forge-mboct-fem-pkg: Premptive fix for GCC-15.

    - Changes so that when GCC defaults to version 15, the port will
      still build.

    PR:             293334
    Reported by:    salvadore@freebsd.org

 math/octave-forge-mboct-fem-pkg/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Comment 12 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2026-03-03 15:37:27 UTC
This is why the most recent patch is the correct approach.  The initial error you cited was caused by the item compiler:gcc-c++11-lib in USES.  The result was that c++ was used as the compiler, which I didn't realize.  clang, being more strictly compliant with the C++ standard than gcc, created these constexpr errors.

It took me a while to realize that c++ was being used instead of g++15.  This mistake on my part was compounded when the software writers told me that they were using clang++.

When I realized that this port was using c++, I added USE_GCC, and that fixed the problem.  It seems that g++15 makes the same mistake as g++14, and that mistake is what is required to make this port work.
Comment 13 Lorenzo Salvadore freebsd_committer freebsd_triage 2026-03-03 19:26:25 UTC
Thanks a lot for your hard work Stephen.

I am sorry that I could not help you test patches, but unfortunately lang/rust was in the dependency chain, and apparently I do not have enough ram to build rust under poudriere, unless this is the only thing the machine is doing... Even using prebuilt packages was not an option as gcc_default=15 implied forced rebuild for lang/rust... (I think poudriere might have been a bit too aggressive.)

I assume we can close this bug report as fixed.

Just a few observations:

- in general, we prefer ports to be built with the default FreeBSD compiler (clang). If they also build with GCC this is even better, but it is a secondary goal (and I guess very small amount of users actually want to change the default compiler with a GCC version). GCC should be enforced only for ports that have very good reasons to do so (main reason: they don't built with clang).

- it is weird that this port did not use GCC but failed in the exp-run that tested GCC_DEFAULT=15. It is possible that the cause was within one of its dependencies, or that it was a mistake: maybe the port did not build for a reason that had nothing to do with the compiler in use, but the error was found for the first time in this context and was misinterpreted.

- the original error was "configure: error: octave header files not found". Not finding files is not exactly a compilation error, it should not depend on the compiler in use. It might depends on the options passed to the compiler (maybe default options that change from a compiler to another), but not on the compilation process.

Anyway, thanks a lot for your fix. As long as it builds with GCC 15, as maintainer of the GCC ports, I am fine.
Comment 14 Stephen Montgomery-Smith freebsd_committer freebsd_triage 2026-03-05 00:03:06 UTC
It was compiler:gcc-c++11-lib in USES that previously caused it to build with GCC.  And it was removing this that fixed the original problem you posted.  I don't understand why.