certik / minpack

Library for solving nonlinear equations and nonlinear least squares problems
http://www.netlib.org/minpack/
Other
32 stars 10 forks source link

[SciPy]: Getting trouble while building #9

Open Pranavchiku opened 1 year ago

Pranavchiku commented 1 year ago

I tried to build this on my PC (ubuntu 22.04 linux) and it shows me the following logs on executing FC = lfortran cmake .

-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The Fortran compiler identification is unknown
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - failed
-- Check for working Fortran compiler: /home/pranavchiku/lfortran/src/bin/lfortran
-- Check for working Fortran compiler: /home/pranavchiku/lfortran/src/bin/lfortran - broken
CMake Error at /home/pranavchiku/conda_root/envs/lf/share/cmake-3.24/Modules/CMakeTestFortranCompiler.cmake:61 (message):
  The Fortran compiler

    "/home/pranavchiku/lfortran/src/bin/lfortran"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/pranavchiku/minpack/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_d141a/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_d141a.dir/build.make CMakeFiles/cmTC_d141a.dir/build
    gmake[1]: Entering directory '/home/pranavchiku/minpack/CMakeFiles/CMakeTmp'
    Building Fortran object CMakeFiles/cmTC_d141a.dir/testFortranCompiler.f.o
    /home/pranavchiku/lfortran/src/bin/lfortran    -c /home/pranavchiku/minpack/CMakeFiles/CMakeTmp/testFortranCompiler.f -o CMakeFiles/cmTC_d141a.dir/testFortranCompiler.f.o
    Linking Fortran executable cmTC_d141a
    /home/pranavchiku/conda_root/envs/lf/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d141a.dir/link.txt --verbose=1
    /home/pranavchiku/lfortran/src/bin/lfortran CMakeFiles/cmTC_d141a.dir/testFortranCompiler.f.o -o cmTC_d141a 
    /home/pranavchiku/conda_root/envs/lf/bin/../lib/gcc/x86_64-conda-linux-gnu/12.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/pranavchiku/lfortran/src/bin/../runtime/liblfortran_runtime.so: undefined reference to `clock_gettime'
    clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
    The command 'clang -o cmTC_d141a CMakeFiles/cmTC_d141a.dir/testFortranCompiler.f.o  -L"/home/pranavchiku/lfortran/src/bin/../runtime" -Wl,-rpath,"/home/pranavchiku/lfortran/src/bin/../runtime" -llfortran_runtime -lm' failed.
    gmake[1]: *** [CMakeFiles/cmTC_d141a.dir/build.make:99: cmTC_d141a] Error 10
    gmake[1]: Leaving directory '/home/pranavchiku/minpack/CMakeFiles/CMakeTmp'
    gmake: *** [Makefile:127: cmTC_d141a/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:6 (enable_language)

@certik if you could look, I am trying to resolve it as soon as possible :)

Pranavchiku commented 1 year ago

build successfully works with gfortran, till the error is resolved I am compiling minpack directly from scipy ( the files that are present in scipy)

certik commented 1 year ago

The following fails on your system:

     /home/pranavchiku/lfortran/src/bin/lfortran CMakeFiles/cmTC_d141a.dir/testFortranCompiler.f.o -o cmTC_d141a 
    /home/pranavchiku/conda_root/envs/lf/bin/../lib/gcc/x86_64-conda-linux-gnu/12.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/pranavchiku/lfortran/src/bin/../runtime/liblfortran_runtime.so: undefined reference to `clock_gettime'
    clang-11: error: linker command failed with exit code 1 (use -v to see invocation)

Which is a bug in LFortran, something in the Conda environment and the way cmake invokes LFortran break things.

Which compiler did you use to compile LFortran?

Pranavchiku commented 1 year ago

Which compiler did you use to compile LFortran?

clang