stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

Build on PowerPC fails due to missing ieee_arithmetic

Open barracuda156 opened this issue 2 years ago • 5 comments

Description

FAILED: src/CMakeFiles/fortran_stdlib.dir/stdlib_stats_cov.f90.o src/mod_files/stdlib_stats@stdlib_stats_cov.smod 
/opt/local/bin/gfortran-mp-12 -I/opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_fortran-stdlib/fortran-stdlib/work/build/src -I/opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_fortran-stdlib/fortran-stdlib/work/build/src/mod_files -pipe -Os -m32 -fimplicit-none -ffree-line-length-132 -mmacosx-version-min=10.6 -Jsrc/mod_files/ -fPIC -fpreprocessed -c src/CMakeFiles/fortran_stdlib.dir/stdlib_stats_cov.f90-pp.f90 -o src/CMakeFiles/fortran_stdlib.dir/stdlib_stats_cov.f90.o
/opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_fortran-stdlib/fortran-stdlib/work/build/src/stdlib_stats_cov.f90:3:19:

    3 |   use, intrinsic:: ieee_arithmetic, only: ieee_value, ieee_quiet_nan
      |                   1
Fatal Error: Cannot find an intrinsic module named 'ieee_arithmetic' at (1)
compilation terminated.

FAILED: src/CMakeFiles/fortran_stdlib.dir/stdlib_stats_mean.f90.o src/mod_files/stdlib_stats@stdlib_stats_mean.smod 
/opt/local/bin/gfortran-mp-12 -I/opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_fortran-stdlib/fortran-stdlib/work/build/src -I/opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_fortran-stdlib/fortran-stdlib/work/build/src/mod_files -pipe -Os -m32 -fimplicit-none -ffree-line-length-132 -mmacosx-version-min=10.6 -Jsrc/mod_files/ -fPIC -fpreprocessed -c src/CMakeFiles/fortran_stdlib.dir/stdlib_stats_mean.f90-pp.f90 -o src/CMakeFiles/fortran_stdlib.dir/stdlib_stats_mean.f90.o
/opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_fortran-stdlib/fortran-stdlib/work/build/src/stdlib_stats_mean.f90:3:19:

    3 |   use, intrinsic:: ieee_arithmetic, only: ieee_value, ieee_quiet_nan
      |                   1
Fatal Error: Cannot find an intrinsic module named 'ieee_arithmetic' at (1)
compilation terminated.

There may be two solutions: if it is not required, for now fix compilation without it. If it is required, we need to implement ieee_arithmetic for PPC :) Relevant discussion: https://github.com/iains/darwin-toolchains-start-here/discussions/40

Expected Behaviour

We want Fortran stdlib to build successfully on PowerPC.

Version of stdlib

0.2.1

Platform and Architecture

MacOS/ppc

Additional Information

GCC 12.2.0 10.6.8 Rosetta (ppc32), but the failure applied to all macOS ppc/ppc64

barracuda156 avatar Jan 10 '23 20:01 barracuda156

Thanks for reporting this issue. This seems to be an issue related to the OS/compiler. Is the fix proposed in this thread working?

jvdp1 avatar Jan 10 '23 21:01 jvdp1

Thanks for reporting this issue. This seems to be an issue related to the OS/compiler. Is the fix proposed in this thread working?

@jvdp1 You are right, it is compiler-related, GCC does not have ieee_arithmetic module for Darwin PPC (as well as for a number of other systems and archs). Optimal solution would be implement that in GCC, of course. However it is not a trivial thing to do. If anyone is interested and can help with that, it would be awesome. There are some details in the discussion I have referred to above with GCC developers.

FreeBSD solution is not applicable, since Darwin does not use glibc.

barracuda156 avatar Jan 10 '23 21:01 barracuda156

@jvdp1 Could we come up with a temporary fix?

While I kinda have ieee_arithmetic fixed for PPC, it is still WIP, and even when completed, may take ages to get merged into GCC. It is desirable to have stdlib available prior to that. I do not ask for the fix to be here in master branch, if it is too intrusive. I rather mean a local patch for Macports.

barracuda156 avatar Mar 05 '23 08:03 barracuda156

Could the fix be a minimal implementation of ieee_arithmetic inside stdlib?

jvdp1 avatar Mar 05 '23 16:03 jvdp1

Could the fix be a minimal implementation of ieee_arithmetic inside stdlib?

@jvdp1 That would be awesome. It would also fix the build for some other platforms (perhaps something like Irix and VxWorks). (If that is done, it is desirable for it to be non-conflicting with compilers that do support ieee_arithmetic, including PowerPC case, so that we do not have to fix that again later on.)

barracuda156 avatar Mar 05 '23 17:03 barracuda156