How to build Octave on macOS from scratch?

On MacOS 11.3 with XCode 12.5 I get :

checking for clang++ option to enable C++11 features
result: -std=gnu++11

The default system compiler is :

$ clang++ --version
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: x86_64-apple-darwin20.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

c.

It does, and it is needed to build Octave because it provides the gfortran compiler.

But I would reccomend against using g++ to compile Octave as most binary dependencies
in homebrew are built with the system clang++

c.

@cdf: I don’t have a Mac to run tests locally. So much of the current github action rules for macOS are guess work and the result of trial-and-error.
The current rules are here:
octave/make.yaml at mmuetzel-CI-github-1 · mmuetzel/octave

Any kind of feedback would be very welcome.

The failures in test are probably due to use of libc++ rather than libstdc++; we have seen it before.
E.g. : GNU Octave - Bugs: bug #55538, logspace BIST tests fail when... [Savannah]

Fwiw, the failing tests with clang:

>>>>> processing /Users/runner/work/octave/octave/.build/libinterp/corefcn/mappers.cc-tst
***** test
 rval = pi/2;
 ival = 1.31695789692481635;
 obs = asin ([2, 2-i*eps, 2+i*eps]);
 exp = [rval - ival*i, rval - ival*i, rval + ival*i];
 assert (obs, exp, 2*eps);
 obs = asin ([-2, -2-i*eps, -2+i*eps]);
 exp = [-rval + ival*i, -rval - ival*i, -rval + ival*i];
 assert (obs, exp, 2*eps);
 assert (asin ([2 0]),  [rval - ival*i, 0], 2*eps);
 assert (asin ([2 0i]), [rval - ival*i, 0], 2*eps);
!!!!! test failed
ASSERT errors for:  assert (obs,exp,2 * eps)

  Location  |  Observed  |  Expected  |  Reason
    (3)      1.5708+1.317i 1.5708+1.317i   Abs err 1.1102e-15 exceeds tol 4.4409e-16 by 7e-16
shared variables   scalar structure containing the fields:

    rt2 = 1.4142
    rt3 = 1.7321


>>>>> processing /Users/runner/work/octave/octave/scripts/general/logspace.m
***** assert (logspace (Inf + 1i, Inf + 1i, 3), repmat (complex (-Inf,Inf), [1, 3]))
!!!!! test failed
ASSERT errors for:  assert (logspace (Inf + 1i, Inf + 1i, 3),repmat (complex (-Inf, Inf), [1, 3]))

  Location  |  Observed  |  Expected  |  Reason
    (1)        Inf+NaNi    -Inf+Infi     'NaN' mismatch
    (2)        Inf+NaNi    -Inf+Infi     'NaN' mismatch
    (3)        Inf+NaNi    -Inf+Infi     'NaN' mismatch
***** assert (logspace (-Inf + 1i, Inf + 1i, 3), [0, NaN + NaN * 1i, complex(-Inf, Inf)])
!!!!! test failed
ASSERT errors for:  assert (logspace (-Inf + 1i, Inf + 1i, 3),[0, NaN + NaN * 1i, complex(-Inf, Inf)])

  Location  |  Observed  |  Expected  |  Reason
    (3)        Inf+NaNi    -Inf+Infi     'NaN' mismatch


>>>>> processing /Users/runner/work/octave/octave/scripts/miscellaneous/memory.m
***** testif ; isunix () || ispc ()
 [user, syst] = memory ();
 assert (user.mem_used_octave > 0);
 assert (user.ram_used_octave <= user.mem_used_octave);
 assert (user.mem_used_octave < syst.SystemMemory.Total);
 assert (user.MemAvailableAllArrays <= syst.SystemMemory.Available);
!!!!! test failed
textscan: invalid stream number = -1


>>>>> processing /Users/runner/work/octave/octave/scripts/plot/util/hgsave.m
***** testif HAVE_MAGICK; (have_window_system () && __have_feature__ ("QT_OFFSCREEN") && strcmp ("qt", graphics_toolkit ())) || strcmp ("gnuplot", graphics_toolkit ());
 h1 = figure ("visible", "off", "paperposition", [0.25, 2.5, 8.0, 6.0]);
 unwind_protect
   x = 0:0.1:2*pi;
   y1 = sin (x);
   y2 = exp (x - 1);
   ax = plotyy (x,y1, x-1,y2, @plot, @semilogy);
   xlabel ("X");
   ylabel (ax(1), "Axis 1");
   ylabel (ax(2), "Axis 2");
   axes (ax(1));
   text (0.5, 0.5, "Left Axis", ...
         "color", [0 0 1], "horizontalalignment", "center");
   axes (ax(2));
   text (4.5, 80, "Right Axis", ...
         "color", [0 0.5 0], "horizontalalignment", "center");
   ftmp = [tempname() ".ofig"];
   png1 = [tempname() ".png"];
   png2 = [tempname() ".png"];
   unwind_protect
     hgsave (h1, ftmp);
     print (h1, png1);
     [img1, map1, alpha1] = imread (png1);
     h2 = hgload (ftmp);
     print (h2, png2);
     [img2, map2, alpha2] = imread (png2);
   unwind_protect_cleanup
     unlink (ftmp);
     unlink (png1);
     unlink (png2);
   end_unwind_protect
   assert (img1, img2);
   assert (map1, map2);
   assert (alpha1, alpha2);
 unwind_protect_cleanup
   close (h1);
   close (h2);
 end_unwind_protect
!!!!! test failed
ASSERT errors for:  assert (img1,img2)

  Location  |  Observed  |  Expected  |  Reason
(58,1097,1)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1098,1)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1100,1)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1101,1)      206          233        Abs err 27 exceeds tol 0 by 3e+01
(58,1102,1)      206          216        Abs err 10 exceeds tol 0 by 1e+01
(58,1103,1)      206          240        Abs err 34 exceeds tol 0 by 3e+01
(58,1104,1)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1105,1)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1106,1)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1107,1)      206          254        Abs err 48 exceeds tol 0 by 5e+01
(58,1108,1)      255          219        Abs err 36 exceeds tol 0 by 4e+01
(58,1109,1)      255          219        Abs err 36 exceeds tol 0 by 4e+01
(58,1113,1)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1114,1)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1115,1)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1118,1)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1119,1)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1120,1)      206          246        Abs err 40 exceeds tol 0 by 4e+01
(58,1121,1)      255          216        Abs err 39 exceeds tol 0 by 4e+01
(58,1122,1)      206          253        Abs err 47 exceeds tol 0 by 5e+01
(58,1123,1)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1124,1)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1127,1)      206          253        Abs err 47 exceeds tol 0 by 5e+01
(58,1128,1)      206          246        Abs err 40 exceeds tol 0 by 4e+01
(58,1097,2)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1098,2)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1100,2)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1101,2)      206          155        Abs err 51 exceeds tol 0 by 5e+01
(58,1102,2)      206           82        Abs err 124 exceeds tol 0 by 1e+02
(58,1103,2)      206          190        Abs err 16 exceeds tol 0 by 2e+01
(58,1104,2)       67          255        Abs err 188 exceeds tol 0 by 2e+02
(58,1105,2)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1106,2)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1107,2)      206          252        Abs err 46 exceeds tol 0 by 5e+01
(58,1108,2)      255           94        Abs err 161 exceeds tol 0 by 2e+02
(58,1109,2)      255           97        Abs err 158 exceeds tol 0 by 2e+02
(58,1110,2)      255          254        Abs err 1 exceeds tol 0 by 1
(58,1113,2)       67          255        Abs err 188 exceeds tol 0 by 2e+02
(58,1114,2)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1115,2)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1118,2)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1119,2)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1120,2)      206          215        Abs err 9 exceeds tol 0 by 9
(58,1121,2)      255           82        Abs err 173 exceeds tol 0 by 2e+02
(58,1122,2)       67          248        Abs err 181 exceeds tol 0 by 2e+02
(58,1123,2)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1124,2)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1127,2)      206          244        Abs err 38 exceeds tol 0 by 4e+01
(58,1128,2)      206          214        Abs err 8 exceeds tol 0 by 8
(58,1097,3)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1098,3)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1100,3)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1101,3)      206          122        Abs err 84 exceeds tol 0 by 8e+01
(58,1102,3)      206           24        Abs err 182 exceeds tol 0 by 2e+02
(58,1103,3)      206          168        Abs err 38 exceeds tol 0 by 4e+01
(58,1104,3)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1105,3)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1106,3)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1107,3)      206          251        Abs err 45 exceeds tol 0 by 4e+01
(58,1108,3)      255           40        Abs err 215 exceeds tol 0 by 2e+02
(58,1109,3)      255           44        Abs err 211 exceeds tol 0 by 2e+02
(58,1110,3)      255          253        Abs err 2 exceeds tol 0 by 2
(58,1113,3)       67          255        Abs err 188 exceeds tol 0 by 2e+02
(58,1114,3)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1115,3)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1118,3)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1119,3)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1120,3)      206          202        Abs err 4 exceeds tol 0 by 4
(58,1121,3)      255           24        Abs err 231 exceeds tol 0 by 2e+02
(58,1122,3)       67          245        Abs err 178 exceeds tol 0 by 2e+02
(58,1123,3)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1124,3)      206          255        Abs err 49 exceeds tol 0 by 5e+01
(58,1127,3)      206          241        Abs err 35 exceeds tol 0 by 4e+01
(58,1128,3)      206          200        Abs err 6 exceeds tol 0 by 6


>>>>> processing /Users/runner/work/octave/octave/test/mex/bug-51725.tst
***** assert (bug_51725 (), [])
!!!!! test failed
'bug_51725' undefined near line 2, column 2
***** error <element number 2 undefined in return list> [x,y,z] = bug_51725 ();
!!!!! error failed.
Expected <element number 2 undefined in return list>, but got <'bug_51725' undefined near line 2, column 2>

>>>>> processing /Users/runner/work/octave/octave/test/mex/bug-54096.tst
***** test
 s = bug_54096 ();
 assert (s, struct ("field", []));
 assert (s.field, []);
!!!!! test failed
'bug_54096' undefined near line 3, column 3
>>>>> processing /Users/runner/work/octave/octave/test/mex/mexnumtst.tst
***** test
 s = rand (3, 4, "single");
 sc = s + i * rand (3, 4, "single");
 d = rand (3, 4, "double");
 dc = d + i * rand (3, 4, "double");

 [sx, scx, dx, dcx] = mexnumtst (s, sc, d, dc);
 assert (s, sx)
 assert (sc, scx)
 assert (d, dx)
 assert (dc, dcx)
!!!!! test failed
'mexnumtst' undefined near line 8, column 8


>>>>> processing /Users/runner/work/octave/octave/scripts/specfun/expint.m
***** test <*47738>
 assert (expint (10i), 0.0454564330044554 + 0.0875512674239774i, -4*eps);
!!!!! regression: https://octave.org/testfailure/?47738
ASSERT errors for:  assert (expint (10i),0.0454564330044554 + 0.0875512674239774i,-4 * eps)

  Location  |  Observed  |  Expected  |  Reason
     ()      0.045456+0.087551i 0.045456+0.087551i   Rel err 9.1442e-16 exceeds tol 8.8818e-16 by 3e-17

I’m not sure if all of those are due to the different standard library implementations.

Not all of them.
The logspace bug is GNU Octave - Bugs: bug #55538, logspace BIST tests fail when... [Savannah]

The precision failures probably due to compiler. And I think those are quite small and the tol perhaps could be just relaxed a little.

Test results with a gcc runnner on macOS 10.15:

Summary:

  PASS                            16662
  FAIL                                9
  REGRESSION                          1
  XFAIL (reported bug)               44
  SKIP (missing feature)            152
  SKIP (run-time condition)          71

The failing tests:

>>>>> processing /Users/runner/work/octave/octave/.build/libinterp/corefcn/mappers.cc-tst
***** test
 rval = pi/2;
 ival = 1.31695789692481635;
 obs = asin ([2, 2-i*eps, 2+i*eps]);
 exp = [rval - ival*i, rval - ival*i, rval + ival*i];
 assert (obs, exp, 2*eps);
 obs = asin ([-2, -2-i*eps, -2+i*eps]);
 exp = [-rval + ival*i, -rval - ival*i, -rval + ival*i];
 assert (obs, exp, 2*eps);
 assert (asin ([2 0]),  [rval - ival*i, 0], 2*eps);
 assert (asin ([2 0i]), [rval - ival*i, 0], 2*eps);
!!!!! test failed
ASSERT errors for:  assert (obs,exp,2 * eps)

  Location  |  Observed  |  Expected  |  Reason
    (3)      1.5708+1.317i 1.5708+1.317i   Abs err 1.1102e-15 exceeds tol 4.4409e-16 by 7e-16
shared variables   scalar structure containing the fields:

    rt2 = 1.4142
    rt3 = 1.7321


>>>>> processing /Users/runner/work/octave/octave/scripts/general/logspace.m
***** assert (logspace (Inf + 1i, Inf + 1i, 3), repmat (complex (-Inf,Inf), [1, 3]))
!!!!! test failed
ASSERT errors for:  assert (logspace (Inf + 1i, Inf + 1i, 3),repmat (complex (-Inf, Inf), [1, 3]))

  Location  |  Observed  |  Expected  |  Reason
    (1)        Inf+NaNi    -Inf+Infi     'NaN' mismatch
    (2)        Inf+NaNi    -Inf+Infi     'NaN' mismatch
    (3)        Inf+NaNi    -Inf+Infi     'NaN' mismatch
***** assert (logspace (-Inf + 1i, Inf + 1i, 3), [0, NaN + NaN * 1i, complex(-Inf, Inf)])
!!!!! test failed
ASSERT errors for:  assert (logspace (-Inf + 1i, Inf + 1i, 3),[0, NaN + NaN * 1i, complex(-Inf, Inf)])

  Location  |  Observed  |  Expected  |  Reason
    (3)        Inf+NaNi    -Inf+Infi     'NaN' mismatch


>>>>> processing /Users/runner/work/octave/octave/scripts/miscellaneous/memory.m
***** testif ; isunix () || ispc ()
 [user, syst] = memory ();
 assert (user.mem_used_octave > 0);
 assert (user.ram_used_octave <= user.mem_used_octave);
 assert (user.mem_used_octave < syst.SystemMemory.Total);
 assert (user.MemAvailableAllArrays <= syst.SystemMemory.Available);
!!!!! test failed
textscan: invalid stream number = -1


>>>>> processing /Users/runner/work/octave/octave/scripts/plot/util/hgsave.m
***** testif HAVE_MAGICK; (have_window_system () && __have_feature__ ("QT_OFFSCREEN") && strcmp ("qt", graphics_toolkit ())) || strcmp ("gnuplot", graphics_toolkit ());
 h1 = figure ("visible", "off", "paperposition", [0.25, 2.5, 8.0, 6.0]);
 unwind_protect
   x = 0:0.1:2*pi;
   y1 = sin (x);
   y2 = exp (x - 1);
   ax = plotyy (x,y1, x-1,y2, @plot, @semilogy);
   xlabel ("X");
   ylabel (ax(1), "Axis 1");
   ylabel (ax(2), "Axis 2");
   axes (ax(1));
   text (0.5, 0.5, "Left Axis", ...
         "color", [0 0 1], "horizontalalignment", "center");
   axes (ax(2));
   text (4.5, 80, "Right Axis", ...
         "color", [0 0.5 0], "horizontalalignment", "center");
   ftmp = [tempname() ".ofig"];
   png1 = [tempname() ".png"];
   png2 = [tempname() ".png"];
   unwind_protect
     hgsave (h1, ftmp);
     print (h1, png1);
     [img1, map1, alpha1] = imread (png1);
     h2 = hgload (ftmp);
     print (h2, png2);
     [img2, map2, alpha2] = imread (png2);
   unwind_protect_cleanup
     unlink (ftmp);
     unlink (png1);
     unlink (png2);
   end_unwind_protect
   assert (img1, img2);
   assert (map1, map2);
   assert (alpha1, alpha2);
 unwind_protect_cleanup
   close (h1);
   close (h2);
 end_unwind_protect
!!!!! test failed
ASSERT errors for:  assert (img1,img2)

  Location  |  Observed  |  Expected  |  Reason
(58,1122,1)      255          251        Abs err 4 exceeds tol 0 by 4
(58,1123,1)      255          231        Abs err 24 exceeds tol 0 by 2e+01
(58,1124,1)      255          216        Abs err 39 exceeds tol 0 by 4e+01
(58,1125,1)      255          253        Abs err 2 exceeds tol 0 by 2
(58,1105,2)      214          255        Abs err 41 exceeds tol 0 by 4e+01
(58,1106,2)       0           255        Abs err 255 exceeds tol 0 by 3e+02
(58,1107,2)       25          255        Abs err 230 exceeds tol 0 by 2e+02
(58,1108,2)      252          255        Abs err 3 exceeds tol 0 by 3
(58,1115,2)      218          255        Abs err 37 exceeds tol 0 by 4e+01
(58,1116,2)       0           255        Abs err 255 exceeds tol 0 by 3e+02
(58,1117,2)       9           255        Abs err 246 exceeds tol 0 by 2e+02
(58,1118,2)      242          255        Abs err 13 exceeds tol 0 by 1e+01
(58,1119,2)      253          255        Abs err 2 exceeds tol 0 by 2
(58,1120,2)       62          255        Abs err 193 exceeds tol 0 by 2e+02
(58,1121,2)       5           255        Abs err 250 exceeds tol 0 by 2e+02
(58,1122,2)      209          239        Abs err 30 exceeds tol 0 by 3e+01
(58,1123,2)      255          149        Abs err 106 exceeds tol 0 by 1e+02
(58,1124,2)      255           82        Abs err 173 exceeds tol 0 by 2e+02
(58,1125,2)      180          248        Abs err 68 exceeds tol 0 by 7e+01
(58,1126,2)       0           255        Abs err 255 exceeds tol 0 by 3e+02
(58,1127,2)       76          255        Abs err 179 exceeds tol 0 by 2e+02
(58,1105,3)      214          255        Abs err 41 exceeds tol 0 by 4e+01
(58,1106,3)       0           255        Abs err 255 exceeds tol 0 by 3e+02
(58,1107,3)       25          255        Abs err 230 exceeds tol 0 by 2e+02
(58,1108,3)      252          255        Abs err 3 exceeds tol 0 by 3
(58,1115,3)      218          255        Abs err 37 exceeds tol 0 by 4e+01
(58,1116,3)       0           255        Abs err 255 exceeds tol 0 by 3e+02
(58,1117,3)       9           255        Abs err 246 exceeds tol 0 by 2e+02
(58,1118,3)      242          255        Abs err 13 exceeds tol 0 by 1e+01
(58,1119,3)      253          255        Abs err 2 exceeds tol 0 by 2
(58,1120,3)       62          255        Abs err 193 exceeds tol 0 by 2e+02
(58,1121,3)       5           255        Abs err 250 exceeds tol 0 by 2e+02
(58,1122,3)      209          233        Abs err 24 exceeds tol 0 by 2e+01
(58,1123,3)      255          114        Abs err 141 exceeds tol 0 by 1e+02
(58,1124,3)      255           24        Abs err 231 exceeds tol 0 by 2e+02
(58,1125,3)      180          245        Abs err 65 exceeds tol 0 by 6e+01
(58,1126,3)       0           255        Abs err 255 exceeds tol 0 by 3e+02
(58,1127,3)       76          255        Abs err 179 exceeds tol 0 by 2e+02


>>>>> processing /Users/runner/work/octave/octave/test/mex/bug-51725.tst
***** assert (bug_51725 (), [])
!!!!! test failed
'bug_51725' undefined near line 2, column 2
***** error <element number 2 undefined in return list> [x,y,z] = bug_51725 ();
!!!!! error failed.
Expected <element number 2 undefined in return list>, but got <'bug_51725' undefined near line 2, column 2>

>>>>> processing /Users/runner/work/octave/octave/test/mex/bug-54096.tst
***** test
 s = bug_54096 ();
 assert (s, struct ("field", []));
 assert (s.field, []);
!!!!! test failed
'bug_54096' undefined near line 3, column 3
>>>>> processing /Users/runner/work/octave/octave/test/mex/mexnumtst.tst
***** test
 s = rand (3, 4, "single");
 sc = s + i * rand (3, 4, "single");
 d = rand (3, 4, "double");
 dc = d + i * rand (3, 4, "double");

 [sx, scx, dx, dcx] = mexnumtst (s, sc, d, dc);
 assert (s, sx)
 assert (sc, scx)
 assert (d, dx)
 assert (dc, dcx)
!!!!! test failed
'mexnumtst' undefined near line 8, column 8

Looks quite similar.

I didn’t notice until failing while trying to use them. But the macOS 11 runners are still in a restricted preview phase:
About GitHub-hosted runners - GitHub Docs

Note: The macOS 11.0 virtual environment is currently provided as a private preview only. Any users or organizations that are already using this runner can continue using it, but we’re not accepting any further users or organizations at this time. The macos-latest YAML workflow label still uses the macOS 10.15 virtual environment.

I noticed that the macOS runners don’t pick up QHull:

checking for libqhull.h... no
checking for libqhull/libqhull.h... yes
checking for qh_qhull in -lqhull... no
configure: WARNING: Qhull library not found.  This will result in loss of functionality for some geometry functions.

Afaict, it is installed by homebrew though:

==> Downloading https://ghcr.io/v2/homebrew/core/qhull/manifests/2020.2
==> Downloading https://ghcr.io/v2/homebrew/core/qhull/blobs/sha256:b48c342482e1e50857c444f8eb39f71c36a522a9f0692bd479b93d2088672d2f
==> Downloading from https://pkg-containers-az.githubusercontent.com/ghcr1/blobs/sha256:b48c342482e1e50857c444f8eb39f71c36a522a9f0692bd479b93d2088672d2f?se=2021-04-29T17%3A05%3A00Z&sig=7P3Z3cQ04kiw5Zyq%2Bvd0HvU9jkih%2F8BK7a6wyMGC3iI%3D&sp=r&spr=https&sr=b&sv=2019-12-12
==> Pouring qhull--2020.2.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/qhull/2020.2: 116 files, 5.5MB

Also, I’m doubting if gcc actually is gcc on macOS. The build results are probably far too similar.
Is it just an alias for clang?

This qhull is probably too new. Fedora 34 still uses qhull 2015 aka 7.2.x There are quite a few api changes.

I think xcode uses gcc as link to its clang, but if you set up path to have /usr/local/bin first it should use real gcc.

Information is a little fuzzy around that. Some users are writing that homebrew installs only executables with version suffix (not without suffix). They are suggesting to use an alias or manually create symlinks.
Either way, if that is true, any solution is bound to break once homebrew updates to a newer gcc version…
Does a macOS user have any information on that?

With the runner using an actual gcc, linking fails with:

libtool: link: ranlib libinterp/corefcn/.libs/libcorefcn.a
Undefined symbols for architecture x86_64:
  "__Z13SuiteSparseQRISt7complexIdEElidlP21cholmod_sparse_structPS3_PPlS4_S6_PP20cholmod_dense_structP21cholmod_common_struct", referenced from:
      __ZN6octave4math9sparse_qrI19SparseComplexMatrixE13sparse_qr_repC1ERKS2_i in libnumeric.a(libnumeric_la-sparse-qr.o)
  "__Z19SuiteSparseQR_qmultISt7complexIdEEP20cholmod_dense_structiP21cholmod_sparse_structS3_PlS3_P21cholmod_common_struct", referenced from:
      __ZN6octave4math9sparse_qrI19SparseComplexMatrixE13sparse_qr_rep1CERK13ComplexMatrixb in libnumeric.a(libnumeric_la-sparse-qr.o)
      __ZN6octave4math9sparse_qrI19SparseComplexMatrixE13sparse_qr_rep1QEb in libnumeric.a(libnumeric_la-sparse-qr.o)
  "__Z22SuiteSparseQR_min2normISt7complexIdEEP20cholmod_dense_structidP21cholmod_sparse_structS3_P21cholmod_common_struct", referenced from:
      __ZN6octave4math9sparse_qrI12SparseMatrixE14min2norm_solveI6MArrayISt7complexIdEE13ComplexMatrixEET0_RKS2_RKT_Rxi in libnumeric.a(libnumeric_la-sparse-qr.o)
      __ZN6octave4math9sparse_qrI19SparseComplexMatrixE14min2norm_solveI6MArrayISt7complexIdEE13ComplexMatrixEET0_RKS2_RKT_Rxi in libnumeric.a(libnumeric_la-sparse-qr.o)
      __ZN6octave4math9sparse_qrI19SparseComplexMatrixE14min2norm_solveI6MArrayIdE13ComplexMatrixEET0_RKS2_RKT_Rxi in libnumeric.a(libnumeric_la-sparse-qr.o)
  "__Z22SuiteSparseQR_min2normISt7complexIdEEP21cholmod_sparse_structidS3_S3_P21cholmod_common_struct", referenced from:
      __ZN6octave4math9sparse_qrI12SparseMatrixE14min2norm_solveI19SparseComplexMatrixS5_EET0_RKS2_RKT_Rxi in libnumeric.a(libnumeric_la-sparse-qr.o)
      __ZN6octave4math9sparse_qrI19SparseComplexMatrixE14min2norm_solveIS2_S2_EET0_RKS2_RKT_Rxi in libnumeric.a(libnumeric_la-sparse-qr.o)
      __ZN6octave4math9sparse_qrI19SparseComplexMatrixE14min2norm_solveI12SparseMatrixS2_EET0_RKS2_RKT_Rxi in libnumeric.a(libnumeric_la-sparse-qr.o)
ld: symbol(s) not found for architecture x86_64

That is probably due to trying to link libraries that are built with clang++ (and libc++) together with libraries compiled with g++ (and libstdc++). IIUC, they use different symbols for standard classes (e.g., std::complex<T> for g++ vs. std::__1::complex<T> [IIRC] for clang).
That is probably what @cdf meant.

IIUC, we’d have to rebuild many dependencies with gcc to avoid those issues.
Alternatively, we could try and have g++ use libc++.

Imho, we don’t need to cover either case with CI runners necessarily. I’d guess not many people will be doing that anyway.
It’s probably good enough to have just the clang runner using libc++ on macOS (at least for now).

What do you think?

yes, mixing compilers and standard libraries is a bit messy,
I’d rather skip that.

IUC the approach in homebrew is to try to rely as much as possible on standard system libraries and tools and only rebuild packages from source when there really is no other choice.

Therefore dependency libraries built with (real) g++ and linked against libstdc++ would be very difficult to find on any user system, so testing this configuration would not be very useful.

c.

I do have a mac, but I do not use homebrew, so I cannot do tests locally anyway.
that said, I will try to look at the files and provide feedback if I can.
c.

I do not think we need both.

FYI: I could compile octave with clang and libc++ and the only problem I see linking is imagemagick. The “make check” gives 10 failures (I used AMD’s pre-12 clang fork). Reading Using libc++ — libc++ 13.0 documentation makes me think switching libs is more difficult with gcc than with clang.

Dmitri.

Qhull bug report
https://savannah.gnu.org/bugs/?60486

Wrt this failing test:

***** test
 rval = pi/2;
 ival = 1.31695789692481635;
 obs = asin ([2, 2-i*eps, 2+i*eps]);
 exp = [rval - ival*i, rval - ival*i, rval + ival*i];
 assert (obs, exp, 2*eps);
 obs = asin ([-2, -2-i*eps, -2+i*eps]);
 exp = [-rval + ival*i, -rval - ival*i, -rval + ival*i];
 assert (obs, exp, 2*eps);
 assert (asin ([2 0]),  [rval - ival*i, 0], 2*eps);
 assert (asin ([2 0i]), [rval - ival*i, 0], 2*eps);
!!!!! test failed
ASSERT errors for:  assert (obs,exp,2 * eps)

  Location  |  Observed  |  Expected  |  Reason
    (3)      1.5708+1.317i 1.5708+1.317i   Abs err 1.1102e-15 exceeds tol 4.4409e-16 by 7e-16

Could we just increase the tolerance to 5*eps on all platforms?
On the one hand, that’s more than twice the current tolerance. On the other hand, it’s probably still reasonably small for a test of a non-linear function.
What do you think?

I do not particularly mind. From another point of view when this loss of precision starts becoming a bug?
BTW, with recent compilers (gcc 11.1 / clang 12) and high optimization on newer cpus I get more precision related test failures. I.e. O3, march=native, mavx2, lto – all seems contribute to some loss of precision. And it is not completely benign, it significantly increases convergence time on some iterative solvers. E.g. timing of “test integral2” is more than 50 longer on -O3 -mavx2 -flto octave than on default one (-O2). I also noticed that the reference numbers in some of those special function tests are
taken from maple and those are different than what I see in Wolfram alpha.
Perhaps we should start a separate thread on that.

Dmitri.

1 Like

In particular for this test W. Alpha gives:

1.570796326794896619231321691639751442098584699687552910487472296… -
1.316957896924816708625046347307968444026981971467516479768472256… i
(result in radians)
Which is 4e16 off (~2eps)

Dmitri.

The current GitHub-CI rules are in the Mercurial repository now:
https://hg.savannah.gnu.org/hgweb/octave/file/tip/.github/workflows/make.yaml