scottransom / presto

Open source pulsar search and analysis toolkit
http://www.cv.nrao.edu/~sransom/presto/
GNU General Public License v2.0
239 stars 177 forks source link

Docker on ARM: build results in "Error: Old-style type declaration REAL*10 not supported at (1)" #159

Closed sanderjo closed 2 years ago

sanderjo commented 2 years ago

FYI (@NickSwainston ?)

A docker build . works on x86_64.

But same method on ARM64, results in the below in step 18 (the tempo stuff):

gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o bnryell1.o bnryell1.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o bnrymss.o bnrymss.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o bnrydds.o bnrydds.f
bnrydds.f:50:15:

   50 |         real*10 frb, tt0, tt, orbits
      |               1
Error: Old-style type declaration REAL*10 not supported at (1)
make[1]: *** [Makefile:478: bnrydds.o] Error 1
make[1]: Leaving directory '/home/soft/tempo/src'
make: *** [Makefile:359: all-recursive] Error 1
The command '/bin/sh -c git clone https://github.com/nanograv/tempo.git &&     cd tempo &&     ./prepare &&     ./configure &&     make &&     make install' returned a non-zero code: 2

So ... a fortran error message? Triggered in docker on ARM64, but not in docker on X86_64 ... ?

More logging from the docker build .:

Step 17/22 : ENV PSRCAT_FILE /home/soft/psrcat_tar/psrcat.db
 ---> Running in fb5437018aab
Removing intermediate container fb5437018aab
 ---> 59ea13fcd077
Step 18/22 : RUN git clone https://github.com/nanograv/tempo.git &&     cd tempo &&     ./prepare &&     ./configure &&     make &&     make install
 ---> Running in 18c7d89e182a
Cloning into 'tempo'...
Updating files: 100% (260/260), done.
configure.ac:6: installing 'config/compile'
configure.ac:24: installing 'config/config.guess'
configure.ac:24: installing 'config/config.sub'
configure.ac:3: installing 'config/install-sh'
configure.ac:3: installing 'config/missing'
src/Makefile.am: installing 'config/depcomp'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking for gfortran... gfortran
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether gfortran accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether byte ordering is bigendian... no
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking build system type... aarch64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking how to get verbose linking output from gfortran... -v
checking for Fortran 77 libraries of gfortran...  -L/usr/lib/gcc/aarch64-linux-gnu/9 -L/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu -L/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib -L/lib/aarch64-linux-gnu -L/lib/../lib -L/usr/lib/aarch64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/aarch64-linux-gnu/9/../../.. -lgfortran -lm
checking for dummy main to link with Fortran 77 libraries... none
checking for Fortran 77 name-mangling scheme... lower case, underscore, no extra underscore
checking if sgemm_ is being linked in already... no
checking for sgemm_ in -lopenblas... no
checking for ATL_xerbla in -latlas... no
checking for sgemm_ in -lblas... no
checking for sgemm_ in -lmkl... no
checking for sgemm_ in -framework vecLib... no
checking for sgemm_ in -lcxml... no
checking for sgemm_ in -ldxml... no
checking for sgemm_ in -lscs... no
checking for sgemm_ in -lcomplib.sgimath... no
checking for sgemm_ in -lblas... (cached) no
checking for sgemm_ in -lblas... (cached) no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating tempo.cfg
config.status: creating src/config.h
config.status: creating clock/Makefile
config.status: creating ephem/Makefile
config.status: creating test/Makefile
config.status: creating tzpar/Makefile
config.status: creating util/print_resid/Makefile
config.status: executing depfiles commands

Tempo is ready to be compiled.  Please run 'make'.

'make install' will copy 'tempo' to /usr/local/bin.

Making all in src
make[1]: Entering directory '/home/soft/tempo/src'
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o a1ut1f.o a1ut1f.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o a1utcf.o a1utcf.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o ang.o ang.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o arrtim.o arrtim.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o atimfake.o atimfake.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o bigendian.o bigendian.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o blkdbat.o blkdbat.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o bnrybt.o bnrybt.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o bnrybtx.o bnrybtx.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o bnrydd.o bnrydd.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o bnryddgr.o bnryddgr.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o bnryddk.o bnryddk.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o bnryddt.o bnryddt.f
bnryddt.f:123:10:

   46 |  do 20 i=1,4
      |                 2
......
  123 | 20 trb(i)=-d2bar
      |          1
Warning: Array reference at (1) out of bounds (4 > 3) in loop beginning at (2)
bnryddt.f:123:0:

  123 | 20 trb(i)=-d2bar
      |
Warning: iteration 3 invokes undefined behavior [-Waggressive-loop-optimizations]
bnryddt.f:46:0:

   46 |  do 20 i=1,4
      |
note: within this loop
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o bnryddfwhiecc.o bnryddfwhiecc.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o bnryeh.o bnryeh.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o bnryell1.o bnryell1.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o bnrymss.o bnrymss.f
gfortran  -g -O2 -ffixed-form -ffixed-line-length-none -std=legacy -c -o bnrydds.o bnrydds.f
bnrydds.f:50:15:

   50 |         real*10 frb, tt0, tt, orbits
      |               1
Error: Old-style type declaration REAL*10 not supported at (1)
make[1]: *** [Makefile:478: bnrydds.o] Error 1
make[1]: Leaving directory '/home/soft/tempo/src'
make: *** [Makefile:359: all-recursive] Error 1
The command '/bin/sh -c git clone https://github.com/nanograv/tempo.git &&     cd tempo &&     ./prepare &&     ./configure &&     make &&     make install' returned a non-zero code: 2

real    177m52.683s
user    0m6.458s
sys     0m2.949s
sander@nanopineo2:~/git/presto$
scottransom commented 2 years ago

Interesting. So this is an issue with TEMPO. Given the real*10, I wonder if it is because ARM64 doesn't support hardware (or maybe even software?) long double math?

sanderjo commented 2 years ago

Never done it, but I created a fortran program for testing purposes:

program hello
    real*10 frb, tt0, tt, orbits
    print *, "Hello World!"
end program

It does compile & run on x86, but not on ARM64:

sander@nanopineo2:~$ gfortran bla3.f90 
bla3.f90:2:11:

     real*10 frb, tt0, tt, orbits
           1
Error: Old-style type declaration REAL*10 not supported at (1)
sander@nanopineo2:~$ gfortran --version
GNU Fortran (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

OK ... https://stackoverflow.com/a/43811585 is very, very interesting:

Your compiler may have a REAL*10 type for the 80-bit arithmetic used by the x86 387 FPU,

So, it is x86-only stuff!

Finally, in Fortran 90 a way to refer to different kinds of real and integer types was made standard. The new syntax is REAL(n) or REAL(kind=n) and is supported by all standard-compliant compilers.

I tried some stuff on ARM64, but it looks bad:

sander@nanopineo2:~$ cat bla3.f90 
program hello
   ! real*10 frb, tt0, tt, orbits
   real blabla
   !real(10) :: frb  
   REAl(KIND=16) :: xq   ! 16 byte ieee float   
   REAl(KIND=10) :: frb  ! not ok on ARM64
   print *, "Hello World!"
end program

sander@nanopineo2:~$ gfortran bla3.f90 
bla3.f90:6:15:

    REAl(KIND=10) :: frb  ! not ok on ARM64
               1
Error: Kind 10 not supported for type REAL at (1)
sander@nanopineo2:~$ 

Anyway: that TEMPO fortran seems to be x86/x87 only.

sanderjo commented 2 years ago

oh, funny: real*16 blalbla is OK on ARM64.

program hello
   ! real*10 frb, tt0, tt, orbits
   real blabla
   real*16 blkdkdkdkdk

   !real(10) :: frb  
   REAl(KIND=16) :: xq   ! 16 byte ieee float   
   !REAl(KIND=10) :: frb  ! not ok on ARM64
   print *, "Hello World!"
end program

So: 16 good, 10 bad...

sanderjo commented 2 years ago

@scottransom thanks for your hint! Closing as TEMPO is x86/87-only, and indeed not-for-ARM.