Skip to content

Build system assumes lfortran broken because of -m32 flag (?) #693

Open
@barracuda156

Description

@barracuda156

Description

I was writing a portfile for stdlib anew, since being on a different machine, and did not specify gfortran; CMake build script opportunistically picked lfortran (which is fine after all), but decided it is broken because of unexpected flags :)

-- The Fortran compiler identification is unknown
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - failed
-- Check for working Fortran compiler: /opt/local/bin/lfortran
-- Check for working Fortran compiler: /opt/local/bin/lfortran - broken
CMake Error at /opt/local/share/cmake-3.26/Modules/CMakeTestFortranCompiler.cmake:59 (message):
  The Fortran compiler

    "/opt/local/bin/lfortran"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_fortran-stdlib/fortran-stdlib/work/build/CMakeFiles/CMakeScratch/TryCompile-ZI3iIZ
    
    Run Build Command(s):/opt/local/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_74af9/fast && /usr/bin/make  -f CMakeFiles/cmTC_74af9.dir/build.make CMakeFiles/cmTC_74af9.dir/build
    Building Fortran object CMakeFiles/cmTC_74af9.dir/testFortranCompiler.f.o
    /opt/local/bin/lfortran   -pipe -Os -m32  -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_fortran-stdlib/fortran-stdlib/work/build/CMakeFiles/CMakeScratch/TryCompile-ZI3iIZ/testFortranCompiler.f -o CMakeFiles/cmTC_74af9.dir/testFortranCompiler.f.o
    The following arguments were not expected: -m32 -Os -pipe
    Run with --help for more information.
    make[1]: *** [CMakeFiles/cmTC_74af9.dir/testFortranCompiler.f.o] Error 109
    make: *** [cmTC_74af9/fast] Error 2

While I did not use lfortran for real-life tasks yet, it passes its own tests fine, so definitely not broken.

Expected Behaviour

Perhaps build system should be aware of 32-bit platforms.

Version of stdlib

Github

Platform and Architecture

macOS 10.6 ppc

Additional Information

gcc 12.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions