Skip to content

octave 10.1.0 #218368

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 2 commits into
base: main
Choose a base branch
from
Open

octave 10.1.0 #218368

wants to merge 2 commits into from

Conversation

BrewTestBot
Copy link
Member

Created by brew bump


Created with brew bump-formula-pr.

@github-actions github-actions bot added java Java use is a significant feature of the PR or issue bump-formula-pr PR was created using `brew bump-formula-pr` long build Set a long timeout for formula testing labels Apr 5, 2025
@chenrui333 chenrui333 added the CI-no-fail-fast Continue CI tests despite failing GitHub Actions matrix builds. label Apr 5, 2025
@daeho-ro daeho-ro force-pushed the bump-octave-10.1.0 branch from 1106fb0 to fc5e151 Compare April 6, 2025 09:28
@daeho-ro
Copy link
Member

daeho-ro commented Apr 8, 2025

It seems that dynare is not working with octave 10.

@mmuetzel
Copy link

mmuetzel commented Apr 8, 2025

It seems that dynare is not working with octave 10.

Compatibility of Dynare with Octave 10 seems to have been fixed upstream with this change:
https://git.dynare.org/Dynare/dynare/-/commit/e3ff2f108862b462bfb8f5b92bcebaaf6f8a6aa9

Maybe, you could cherry-pick that patch here...

@mmuetzel
Copy link

mmuetzel commented Apr 8, 2025

Some background to the change in Octave 10:
.mex file linking has changed. .mex files need to be linked with -loctmex instead of with -loctinterp -loctave.
We expect that liboctmex will change far less often than liboctinterp or liboctave. We hope that the soversion of liboctmex won't change on minor or major(!) version updates of Octave looking forward. So, dependencies that only need to link to liboctmex (like Dynare iiuc) might no longer need to be rebuilt on each update of Octave.

@mmuetzel
Copy link

mmuetzel commented Apr 8, 2025

https://github.com/Homebrew/homebrew-core/pull/218368/files#diff-031e5a5adbc75659239d3bc9de4ac2114b3bd6c53cef704b992552956aee683aR86-R91

    # Default configuration passes all linker flags to mkoctfile, to be
    # inserted into every oct/mex build. This is unnecessary and can cause
    # cause linking problems.
    inreplace "src/mkoctfile.in.cc",
              /%OCTAVE_CONF_OCT(AVE)?_LINK_(DEPS|OPTS)%/,
              '""'

The build rules on macOS have been slightly overhauled for Octave 10. You should no longer need the above modification of the source files. By default, Octave should no longer link mex or oct files to all dependencies.

@@ -152,14 +152,14 @@ def install
{ return ovl (42); }
CPP
system bin/"octave", "--eval", <<~MATLAB
mkoctfile ('-v', '-std=c++11', '-L#{lib}/octave/#{version}', 'oct_demo.cc');
mkoctfile ('-v', '-std=c++17', '-L#{lib}/octave/#{version}', 'oct_demo.cc');
Copy link

Choose a reason for hiding this comment

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

Suggested change
mkoctfile ('-v', '-std=c++17', '-L#{lib}/octave/#{version}', 'oct_demo.cc');
mkoctfile ('-v', '-L#{lib}/octave/#{version}', 'oct_demo.cc');

The build system should have figured out automatically which flags are needed to tell the compiler to use the C++17 standard. The necessary flags should be stored and used by mkoctfile automatically. No need to override it here.
If it turns out that you do need to override that here, please let me know. In any case, you should build with GNU extensions, i.e., -std=gnu++17. But like written previously, preferably don't override the C++ standard flags at all.

Copy link
Member

Choose a reason for hiding this comment

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

When I remove this, I got an error and so it is needed now.

Choose a reason for hiding this comment

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

When I remove this, I got an error and so it is needed now.

That is unexpected.
Is it possible to see the output of the configure script when building Octave? At least the summary might already be helpful.

Does Homebrew set a CXX environment variable when building/testing the packages? If it does, which value does it have?

Choose a reason for hiding this comment

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

I don't have access to an Apple device. So, I can't test myself.
Could you please install Octave 10.1.0 as it is built by the rules here? What does the following return for you?

unset CXX
mkoctfile -p CXX

I'd expect something like clang++ -std=gnu++17. Is that the case for you?

Choose a reason for hiding this comment

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

If my suspicion about the failing dynare tests is correct, the following change might also fix this:

Suggested change
mkoctfile ('-v', '-std=c++17', '-L#{lib}/octave/#{version}', 'oct_demo.cc');
unsetenv ('CXX');
mkoctfile ('-v', '-L#{lib}/octave/#{version}', 'oct_demo.cc');

Choose a reason for hiding this comment

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

Unsetting CXX for the duration of the tests of Octave might still be a nice modification.
Users shouldn't need to pass -std=gnu++17 every time they call mkoctfile. They also shouldn't need to set CXX manually.
It would be nice if the tests here could check if that works out of the box...
If CXX needs to be set as an environment variable for the recipe for some reason, it might be best if you could append -std=gnu++17 to CXX instead of passing the flag manually to mkoctfile.

assert(oct_demo, 42)
MATLAB
# Test FLIBS environment variable
system bin/"octave", "--eval", <<~MATLAB
args = strsplit (mkoctfile ('-p', 'FLIBS'));
args = args(~cellfun('isempty', args));
mkoctfile ('-v', '-std=c++11', '-L#{lib}/octave/#{version}', args{:}, 'oct_demo.cc');
mkoctfile ('-v', '-std=c++17', '-L#{lib}/octave/#{version}', args{:}, 'oct_demo.cc');
Copy link

Choose a reason for hiding this comment

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

Suggested change
mkoctfile ('-v', '-std=c++17', '-L#{lib}/octave/#{version}', args{:}, 'oct_demo.cc');
mkoctfile ('-v', '-L#{lib}/octave/#{version}', args{:}, 'oct_demo.cc');

Same motivation as a couple of lines above.

@mmuetzel
Copy link

mmuetzel commented Apr 8, 2025

While at it, maybe you could also consider using the patch I proposed in another issue:
#201376 (comment)

@mmuetzel
Copy link

mmuetzel commented Apr 9, 2025

Another potential caveat for the update:
Newer versions of gnulib no longer accept Apple's version of iconv: see https://savannah.gnu.org/bugs/?66448

It might be better to depend on the version of iconv that is distributed by Homebrew. Otherwise, some text encoding conversion facilities in Octave might no longer work on macOS 14 or newer.

@daeho-ro daeho-ro force-pushed the bump-octave-10.1.0 branch from 9a66f16 to f91a38b Compare April 10, 2025 04:58
@daeho-ro daeho-ro force-pushed the bump-octave-10.1.0 branch from f91a38b to 17d8e63 Compare April 10, 2025 05:33
@mmuetzel
Copy link

mmuetzel commented Apr 10, 2025

The build error looks like Octave fails to compile some sources from the statistics package.
The dynare.rb hard-codes the version 1.6.5 of that package:

url "https://github.com/gnu-octave/statistics/archive/refs/tags/release-1.6.5.tar.gz", using: :nounzip

Newer versions of the statistics package are available now:
https://github.com/gnu-octave/statistics/releases/tag/release-1.7.3

Could you please try if updating to the latest statistics package avoids that compilation error?

@mmuetzel
Copy link

By the way: Is it possible to have a look at the output of the configure script in the CI run?

@daeho-ro daeho-ro force-pushed the bump-octave-10.1.0 branch 2 times, most recently from e85116c to 563a4bc Compare April 10, 2025 06:59
@github-actions github-actions bot added automerge-skip `brew pr-automerge` will skip this pull request CI-linux-self-hosted Build on Linux self-hosted runner labels Apr 10, 2025
@daeho-ro daeho-ro force-pushed the bump-octave-10.1.0 branch from 563a4bc to 707720b Compare April 10, 2025 07:05
@github-actions github-actions bot removed the automerge-skip `brew pr-automerge` will skip this pull request label Apr 10, 2025
@mmuetzel
Copy link

mmuetzel commented Apr 10, 2025

Still the same build error.

I'm suspecting that something is setting the environment variable CXX. And with that, the compiler flags that mkoctfile would use by default are overridden.

Could you please try to add CXX+=" -std=gnu++17" to the test step in dynare.rb (or whatever Ruby syntax would add that to that environment variable)?
Alternatively, the equivalent of unset CXX might also help...

@mmuetzel
Copy link

mmuetzel commented Apr 10, 2025

A potential implementation of that idea in Octave syntax could be the following code snippet change in dynare.rb (note the additional unsetenv command):

    # Replace `makeinfo` with dummy command `true` to prevent generating docs
    # that are not useful to the test.
    (testpath/"dyn_test.m").write <<~MATLAB
      makeinfo_program true
      unsetenv ('CXX');
      pkg prefix #{testpath}/octave
      pkg install statistics-release-#{statistics.version}.tar.gz
      dynare bkk.mod console
    MATLAB

@daeho-ro daeho-ro force-pushed the bump-octave-10.1.0 branch from 707720b to a946fc2 Compare April 10, 2025 07:56
@daeho-ro daeho-ro force-pushed the bump-octave-10.1.0 branch from a946fc2 to 22af215 Compare April 10, 2025 08:48
@daeho-ro daeho-ro force-pushed the bump-octave-10.1.0 branch from 22af215 to c822f91 Compare April 10, 2025 09:11
@mmuetzel
Copy link

It looks like this is finally building and passing the tests now. 🎉

I still suspect that executing __run_test_suite__ in Octave on macOS 14 or later will fail a couple of tests. That is because gnulib no longer accepts Apple's own iconv implementation. (See #218368 (comment))

Would it be possible to use Homebrew's iconv as dependency of Octave instead? At least on macOS 14 and newer?

@daeho-ro
Copy link
Member

@mmuetzel Thank you for the huge help and now it seems fine.

I am not confident to change iconv and it is fine as-is, maybe we can handle it later once something happen.

@mmuetzel
Copy link

@mmuetzel Thank you for the huge help and now it seems fine.

Thank you for taking this on.

I am not confident to change iconv and it is fine as-is, maybe we can handle it later once something happen.

Ok. It might be okay to leave that for a later day.

Would it be ok to attempt to address #201376 as part of the update though? I'm afraid that if this isn't addressed with the major version update now, it won't be addressed for the foreseeable future again.

@mmuetzel
Copy link

mmuetzel commented Apr 10, 2025

Looking at octave.rb, you are already appending to one of the startup files here:

# Make sure that Octave uses the modern texinfo at run time
rcfile = buildpath/"scripts/startup/site-rcfile"
rcfile.append_lines "makeinfo_program(\"#{Formula["texinfo"].opt_bin}/makeinfo\");"

Maybe, you could expand that to something like this to address #201376:

    # Make sure that Octave uses the modern texinfo at run time
    rcfile = buildpath/"scripts/startup/site-rcfile"
    rcfile.append_lines "makeinfo_program(\"#{Formula["texinfo"].opt_bin}/makeinfo\");" 

    # Update the paths in the Fortran linker flags at run time
    rcfile.append_lines <<~MATLAB
      [~, homebrew_prefix] = system ('brew --prefix');
      homebrew_prefix = strtrim (homebrew_prefix);
      [~, fortran_machine] = system ('gfortran -dumpmachine');
      fortran_machine = strtrim (fortran_machine);
      [~, fortran_version] = system ('gfortran -dumpversion');
      fortran_version = regexp (fortran_version, '[^\.]*', 'match'){1};  # major version
      setenv ('FLIBS', ...
        ['-L', fullfile(homebrew_prefix, 'opt/gcc/lib/gcc/current/gcc', fortran_machine, fortran_version), ...
        ' -L', fullfile(homebrew_prefix, 'opt/gcc/lib/gcc/current/gcc'), ...
        ' -L', fullfile(homebrew_prefix, 'opt/gcc/lib/gcc/current'), ...
        ' -lemutls_w -lheapt_w -lgfortran -lquadmath']);
    MATLAB

This is assuming that brew is always installed when using Octave from Homebrew. It is also assuming that gfortran is installed as a dependency of Octave. (Edit: Looking at the build recipe: It is a dependency.)
Please let me know if that is not the case, and I can try to adapt for that.

Also please note that I don't know whether the above change is valid Ruby syntax. (It is valid Octave syntax.) But I hope you can see what I attempted to do.

@mmuetzel
Copy link

Pinging @cho-m because he gave some input in #201376. (I hope that is ok.)

Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. To keep this pull request open, add a help wanted or in progress label.

@github-actions github-actions bot added the stale No recent activity label Apr 13, 2025
@daeho-ro daeho-ro removed the stale No recent activity label Apr 13, 2025
@mmuetzel
Copy link

mmuetzel commented Apr 14, 2025

@cho-m, @daeho-ro: Would it be ok to use something like the code snippet proposed in #218368 (comment) to address #201376?

To check whether this is working correctly, you could try and install an Octave package that (partly) consists of Fortran sources (e.g., call pkg install -forge -verbose control inside Octave). Does that still work without errors with those changes?

Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. To keep this pull request open, add a help wanted or in progress label.

@github-actions github-actions bot added the stale No recent activity label Apr 16, 2025
@daeho-ro daeho-ro added help wanted Task(s) needing PRs from the community or maintainers and removed stale No recent activity labels Apr 16, 2025
@mmuetzel
Copy link

mmuetzel commented May 1, 2025

@cho-m, @daeho-ro: Did you come around to testing whether the code snippet proposed in #218368 (comment) would work?
Does pkg install -forge -verbose control install correctly with that change?

I don't have access to a macOS computer. So, I can't test myself.

@daeho-ro
Copy link
Member

daeho-ro commented May 3, 2025

I am not experts on the C related languages, I just tried to pass the CI build errors.

I understand that the flag -std=c++17 should not be required among the expectation, but I am hesitated to add many lines of prescription to resolve it. Needs help here.

cc. @Homebrew/core

@mmuetzel
Copy link

mmuetzel commented May 5, 2025

I understand that the flag -std=c++17 should not be required among the expectation, but I am hesitated to add many lines of prescription to resolve it. Needs help here.

Just to clarify: The proposed changes won't address whether an explicit -std=c++17 is needed or not.

#201376 is about the fact that some standard library locations for Fortran change when Homebrew updates gfortran. Octave uses the C++ or C compiler as the linker driver for .oct or .mex files (which need at least one C++ or C file which provides the interface to Octave).
The C++ or C linker driver does not automatically add any linker flags that are required when linking Fortran object code. To make it easier for users to build .oct or .mex files that (partly) consist of Fortran code, Octave "remembers" these library locations when it is built. However, if these locations change (like they do when Homebrew updates gfortran to a newer version), what Octave "remembered" from its build time no longer matches what is actually there at runtime.
To work around that issue, the proposed code snippet overrides what Octave "remembered" at its build time with flags that should still be valid after Homebrew updates gfortran to a newer version.

Without these changes, users won't be able to build .oct or .mex files that (partly) consist of Fortran sources or install packages that contain Fortran sources after Homebrew updates to a newer version of gfortran.
Alternatively, Octave could be rebuilt on every update of gfortran. But the proposed change would probably avoid that build time (and hopefully avoid user frustration because it doesn't immediately work as expected if Octave isn't rebuilt by Homebrew).

@mmuetzel
Copy link

@cho-m, @daeho-ro: Did you come around to testing whether the code snippet proposed in #218368 (comment) would work? Does pkg install -forge -verbose control install correctly with that change?

I don't have access to a macOS computer. So, I can't test myself.

Our users on macOS would love to get the latest version of Octave with Homebrew.
Could you please apply the changes proposed above and merge this PR?

apjanke added a commit to octave-app/homebrew-octave-app that referenced this pull request May 13, 2025
Uses mkoctfile "--std=c++17" flxes (in the tests) that were proposed to core Homebrew but not merged yet as of 2025-05-13, in their PR for Octave 10.1.0. See Homebrew/homebrew-core#218368 and Homebrew/homebrew-core#218368 (comment).

Does not include the larger mkoctfile Fortran compiler fix (munging Octave's site-rcfile with Fortran flags) proposed in Homebrew/homebrew-core#218368 (comment). Will tackle that in a separate formula and branch.
@apjanke
Copy link
Contributor

apjanke commented May 13, 2025

Our users on macOS would love to get the latest version of Octave with Homebrew.

In the mean time, users can grab 10.1 from the octave-app custom tap. It has landed there, and looks pretty much like the formula here. Just have to run it with the command [email protected] instead of plain octave.

$ brew tap octave-app/octave-app
$ brew install [email protected]
$ [email protected] --gui

Also, the dynare formula doesn't know about this alternate [email protected] formula, so if you're actually using dynare, this won't take care of you.

I don't have access to a macOS computer. So, I can't test myself.

I'll see about getting you remote access to a Mac build box, @mmuetzel.

@p-linnane p-linnane requested a review from a team May 14, 2025 00:44
@@ -48,6 +49,11 @@ class Dynare < Formula
sha256 "fa80f7c75dab6bfaca93c3b374c774fd87876f34fba969af9133eeaea5f39a3d"
end

patch do
Copy link
Member

Choose a reason for hiding this comment

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

Can this get a comment explaining what it's doing/why it's needed/upstream bug report?

Comment on lines +95 to +96
ENV.cxx
ENV.append "CXXFLAGS", "-std=gnu++17"
Copy link
Member

Choose a reason for hiding this comment

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

Similarly a comment here would be good.

@oscarbg
Copy link

oscarbg commented Jun 14, 2025

Our users on macOS would love to get the latest version of Octave with Homebrew.

In the mean time, users can grab 10.1 from the octave-app custom tap. It has landed there, and looks pretty much like the formula here. Just have to run it with the command [email protected] instead of plain octave.

$ brew tap octave-app/octave-app
$ brew install [email protected]
$ [email protected] --gui

Also, the dynare formula doesn't know about this alternate [email protected] formula, so if you're actually using dynare, this won't take care of you.

I don't have access to a macOS computer. So, I can't test myself.

I'll see about getting you remote access to a Mac build box, @mmuetzel.

@apjanke :
done with [email protected] and works cmdline but GUI no:
[email protected] --gui
octave: GUI features missing or disabled in this build

@apjanke
Copy link
Contributor

apjanke commented Jun 16, 2025

@oscarbg :

done with [email protected] and works cmdline but GUI no:
[email protected] --gui
octave: GUI features missing or disabled in this build

Hmm. That should've worked. That [email protected] formula doesn't even have an option to do a no-GUI build. Maybe some dependency is missing from your system, that the formula is unaware of? Or some version compatibility thing with dependencies.

That's not a core Homebrew formula, so please drop by the Octave.app repo and report that as an issue there - https://github.com/octave-app/octave-app/issues - and we can figure it out.

@oscarbg
Copy link

oscarbg commented Jun 17, 2025

@oscarbg :

done with [email protected] and works cmdline but GUI no:
[email protected] --gui
octave: GUI features missing or disabled in this build

Hmm. That should've worked. That [email protected] formula doesn't even have an option to do a no-GUI build. Maybe some dependency is missing from your system, that the formula is unaware of? Or some version compatibility thing with dependencies.

That's not a core Homebrew formula, so please drop by the Octave.app repo and report that as an issue there - https://github.com/octave-app/octave-app/issues - and we can figure it out.

@apjanke

@oscarbg :

done with [email protected] and works cmdline but GUI no:
[email protected] --gui
octave: GUI features missing or disabled in this build

Hmm. That should've worked. That [email protected] formula doesn't even have an option to do a no-GUI build. Maybe some dependency is missing from your system, that the formula is unaware of? Or some version compatibility thing with dependencies.

That's not a core Homebrew formula, so please drop by the Octave.app repo and report that as an issue there - https://github.com/octave-app/octave-app/issues - and we can figure it out.

@apjanke found issue and fixed it! opened issue for others to see:
octave-app/octave-app#312

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump-formula-pr PR was created using `brew bump-formula-pr` CI-linux-self-hosted Build on Linux self-hosted runner CI-no-fail-fast Continue CI tests despite failing GitHub Actions matrix builds. help wanted Task(s) needing PRs from the community or maintainers java Java use is a significant feature of the PR or issue long build Set a long timeout for formula testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants