Bug 247485

Summary: math/lapack (and math/atlas) do not build with gcc10
Product: Ports & Packages Reporter: gja822
Component: Individual Port(s)Assignee: Thierry Thomas <thierry>
Status: Closed FIXED    
Severity: Affects Only Me CC: alt2600, gja822, thierry
Priority: --- Flags: koobs: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257122
Bug Depends on: 247542    
Bug Blocks:    
Attachments:
Description Flags
path-Makefile
none
Makefile none

Description gja822 2020-06-22 16:54:00 UTC
math/lapack and math/atlas could be built with gcc7 or gcc8, but with gcc10 it stops with errors (although, 7 and 8 are considered outdated now?):

gfortran10 -O -Wl,-rpath=/usr/local/lib/gcc10 -fpic -c sgeqrt2.f -o sgeqrt2.o
--- sorcsd2by1.o ---
sorcsd2by1.f:389:40:

  366 |      $                   0, U1, LDU1, U2, LDU2, V1T, LDV1T, 0, 1, 0, 0,
      |                                      2  
......
  389 |      $                   0, V1T, LDV1T, 0, 1, U1, LDU1, U2, LDU2, 0, 0,
      |                                        1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/REAL(4)).
sorcsd2by1.f:412:35:

  366 |      $                   0, U1, LDU1, U2, LDU2, V1T, LDV1T, 0, 1, 0, 0,
      |                            2       
......
  412 |      $                   THETA, 0, 0, 1, V1T, LDV1T, U2, LDU2, U1, LDU1,
      |                                   1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/REAL(4)).
sorcsd2by1.f:436:55:

  366 |      $                   0, U1, LDU1, U2, LDU2, V1T, LDV1T, 0, 1, 0, 0,
      |                                                2       
......
  436 |      $                   THETA, 0, U2, LDU2, U1, LDU1, 0, 1, V1T, LDV1T,
      |                                                       1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/REAL(4)).
sorcsd2by1.f:473:23:

  347 |             CALL SORBDB1( M, P, Q, X11, LDX11, X21, LDX21, THETA, 0, 0,
      |                                                                  2
......
  473 |      $                 WORK(IPHI), WORK(ITAUP1), WORK(ITAUP2),
      |                       1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:480:44:

  351 |                CALL SORGQR( P, P, Q, U1, LDU1, 0, WORK(1), -1,
      |                                               2
......
  480 |             CALL SORGQR( P, P, Q, U1, LDU1, WORK(ITAUP1), WORK(IORGQR),
      |                                            1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:485:48:

  351 |                CALL SORGQR( P, P, Q, U1, LDU1, 0, WORK(1), -1,
      |                                               2 
......
  485 |             CALL SORGQR( M-P, M-P, Q, U2, LDU2, WORK(ITAUP2),
      |                                                1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:496:57:

  362 |      $                   0, WORK(1), -1, CHILDINFO )
      |                         2                                
......
  496 |             CALL SORGLQ( Q-1, Q-1, Q-1, V1T(2,2), LDV1T, WORK(ITAUQ1),
      |                                                         1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:503:22:

  366 |      $                   0, U1, LDU1, U2, LDU2, V1T, LDV1T, 0, 1, 0, 0,
      |                         2
......
  503 |      $                WORK(IPHI), U1, LDU1, U2, LDU2, V1T, LDV1T, 0, 1,
      |                      1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:528:23:

  370 |             CALL SORBDB2( M, P, Q, X11, LDX11, X21, LDX21, THETA, 0, 0,
      |                                                                  2
......
  528 |      $                 WORK(IPHI), WORK(ITAUP1), WORK(ITAUP2),
      |                       1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:540:55:

  351 |                CALL SORGQR( P, P, Q, U1, LDU1, 0, WORK(1), -1,
      |                                               2        
......
  540 |             CALL SORGQR( P-1, P-1, P-1, U1(2,2), LDU1, WORK(ITAUP1),
      |                                                       1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:545:48:

  351 |                CALL SORGQR( P, P, Q, U1, LDU1, 0, WORK(1), -1,
      |                                               2 
......
  545 |             CALL SORGQR( M-P, M-P, Q, U2, LDU2, WORK(ITAUP2),
      |                                                1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:550:46:

  362 |      $                   0, WORK(1), -1, CHILDINFO )
      |                         2                     
......
  550 |             CALL SORGLQ( Q, Q, R, V1T, LDV1T, WORK(ITAUQ1),
      |                                              1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:557:22:

  366 |      $                   0, U1, LDU1, U2, LDU2, V1T, LDV1T, 0, 1, 0, 0,
      |                         2
......
  557 |      $                WORK(IPHI), V1T, LDV1T, 0, 1, U1, LDU1, U2, LDU2,
      |                      1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:582:23:

  393 |             CALL SORBDB3( M, P, Q, X11, LDX11, X21, LDX21, THETA, 0, 0,
      |                                                                  2
......
  582 |      $                 WORK(IPHI), WORK(ITAUP1), WORK(ITAUP2),
      |                       1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:589:44:

  351 |                CALL SORGQR( P, P, Q, U1, LDU1, 0, WORK(1), -1,
      |                                               2
......
  589 |             CALL SORGQR( P, P, Q, U1, LDU1, WORK(ITAUP1), WORK(IORGQR),
      |                                            1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:601:25:

  351 |                CALL SORGQR( P, P, Q, U1, LDU1, 0, WORK(1), -1,
      |                                               2
......
  601 |      $                   WORK(ITAUP2), WORK(IORGQR), LORGQR, CHILDINFO )
      |                         1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:605:46:

  362 |      $                   0, WORK(1), -1, CHILDINFO )
      |                         2                     
......
  605 |             CALL SORGLQ( Q, Q, R, V1T, LDV1T, WORK(ITAUQ1),
      |                                              1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:612:29:

  366 |      $                   0, U1, LDU1, U2, LDU2, V1T, LDV1T, 0, 1, 0, 0,
      |                         2    
......
  612 |      $                THETA, WORK(IPHI), 0, 1, V1T, LDV1T, U2, LDU2, U1,
      |                             1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:642:23:

  417 |             CALL SORBDB4( M, P, Q, X11, LDX11, X21, LDX21, THETA, 0, 0,
      |                                                                  2
......
  642 |      $                 WORK(IPHI), WORK(ITAUP1), WORK(ITAUP2),
      |                       1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:655:46:

  351 |                CALL SORGQR( P, P, Q, U1, LDU1, 0, WORK(1), -1,
      |                                               2
......
  655 |             CALL SORGQR( P, P, M-Q, U1, LDU1, WORK(ITAUP1),
      |                                              1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:665:50:

  351 |                CALL SORGQR( P, P, Q, U1, LDU1, 0, WORK(1), -1,
      |                                               2   
......
  665 |             CALL SORGQR( M-P, M-P, M-Q, U2, LDU2, WORK(ITAUP2),
      |                                                  1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:674:46:

  362 |      $                   0, WORK(1), -1, CHILDINFO )
      |                         2                     
......
  674 |             CALL SORGLQ( Q, Q, Q, V1T, LDV1T, WORK(ITAUQ1),
      |                                              1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
sorcsd2by1.f:681:29:

  366 |      $                   0, U1, LDU1, U2, LDU2, V1T, LDV1T, 0, 1, 0, 0,
      |                         2    
......
  681 |      $                THETA, WORK(IPHI), U2, LDU2, U1, LDU1, 0, 1, V1T,
      |                             1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
*** [sorcsd2by1.o] Error code 1

make[3]: stopped in /usr/ports/math/lapack/work/lapack-3.5.0_SHARED/SRC
1 error

make[3]: stopped in /usr/ports/math/lapack/work/lapack-3.5.0_SHARED/SRC
*** [lapacklib] Error code 2

make[2]: stopped in /usr/ports/math/lapack/work/lapack-3.5.0_SHARED
1 error

make[2]: stopped in /usr/ports/math/lapack/work/lapack-3.5.0_SHARED
*** Error code 2

Stop.
make[1]: stopped in /usr/ports/math/lapack
*** Error code 1
Comment 1 gja822 2020-06-22 16:58:36 UTC
Also I've noticed this during build of atlas:

/usr/local/bin/ranlib ../liblapack.a
make[4]: "/usr/ports/Mk/bsd.gcc.mk" line 101: Malformed conditional (${PORTNAME} == gcc)
make[4]: Fatal errors encountered -- cannot continue===>  Cleaning for lapack-3.5.0_8

Is it O.K.?
Comment 2 Thierry Thomas freebsd_committer freebsd_triage 2020-06-22 17:21:29 UTC
math/blas and math/lapack are lagging: upstream released 3.9.0 and we have still 3.5.

I'm working on these ports, and it should fix the problem with recent compilers, but no ETA yet: blacs, lapacke, etc. must be upgraded together, and some exp-runs will be required.

However I'm not working on math/atlas: contributions are welcome.
Comment 3 gja822 2020-06-23 02:51:10 UTC
By the way net/mpich2 exhibits similar problem (not compiling with gcc10, only with gcc8) with FORTRAN argument mismatch error.
Comment 4 alt2600 2021-02-08 23:51:44 UTC
Created attachment 222281 [details]
path-Makefile

Fixes build with GCC10(+?). gfortran10 has apparently went the way of strict type checking, which will cause problems with 30+ year old fortran libraries. I added -fallow-argument-mismatch to the F77FLAGS line in the do-build: loop to make gfortran10 handle mismatches like and older fortran compiler would and atlas built. I attempted other methods like adding to EXTRAFLAGS but this seemed to break the C build. I'm guessing ATLAS checking the compiler flags causes issue when gcc10 spits back that this is a fortran flag not a C flag.

Either way it builds now fine. not sure how lapack was fixed but it built fine during a system update to 12.2 I just completed. Given this has no maintainer, I might consider taking it over. Just need to play a little to see how hard it would be to get the newest support 3.10.3 version going a little bit, and what lapacks it expects to see to optimize against. Not sure how far things have gone with upgrading lapack, lapacke, etc to later versions. I know those are tough given how many things require them.
Comment 5 alt2600 2021-02-08 23:54:53 UTC
Created attachment 222282 [details]
Makefile

Complete Makefile for those that might want to try things without dealing with a patch.
Comment 6 Thierry Thomas freebsd_committer freebsd_triage 2021-06-13 17:50:59 UTC
Fixed when upgrading to 3.9.1: see PR 247542.
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2021-07-12 02:26:57 UTC
^Triage: 

 - Track bug 247542 as the dependent of this issue (" - Fix the build with Gcc10") and correct resolution
 - Assign to committer that resolved