superlu_dist icon indicating copy to clipboard operation
superlu_dist copied to clipboard

SuperLU won't build without Fortran compiler even though it doesn't depend on Fortran

Open BarrySmith opened this issue 8 years ago • 8 comments

Sherry,

When I try to cmake superlu_dist on a system without a Fortran compiler I get

Error configuring SUPERLU_DIST with cmake Could not execute "cd /Users/barrysmith/Src/petsc/arch-nofortran/externalpackages/git.superlu_dist/build && /usr/local/bin/cmake .. -DCMAKE_INSTALL_PREFIX=/Users/barrysmith/Src/petsc/arch-nofortran -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_C_COMPILER="/Users/barrysmith/PetscLibraries/bin/mpicc" -DCMAKE_AR=/usr/bin/ar -DCMAKE_RANLIB=/usr/bin/ranlib -DCMAKE_C_FLAGS:STRING="-Qunused-arguments -g3 -DNoChange" -DCMAKE_CXX_COMPILER="/Users/barrysmith/PetscLibraries/bin/mpicxx" -DCMAKE_CXX_FLAGS:STRING="-g -DNoChange" -DBUILD_SHARED_LIBS=on -DUSE_XSDK_DEFAULTS=YES -DTPL_BLAS_LIBRARIES="-llapack -lblas" -DTPL_PARMETIS_INCLUDE_DIRS="/Users/barrysmith/Src/petsc/arch-nofortran/include;/Users/barrysmith/Src/petsc/arch-nofortran/include" -DTPL_PARMETIS_LIBRARIES="-Wl,-rpath,/Users/barrysmith/Src/petsc/arch-nofortran/lib -L/Users/barrysmith/Src/petsc/arch-nofortran/lib -lparmetis -Wl,-rpath,/Users/barrysmith/Src/petsc/arch-nofortran/lib -L/Users/barrysmith/Src/petsc/arch-nofortran/lib -lmetis" -Denable_tests=0 -Denable_examples=0 -DCMAKE_INSTALL_NAME_DIR:STRING="/Users/barrysmith/Src/petsc/arch-nofortran/lib" -DMPI_C_COMPILER:STRING="/Users/barrysmith/PetscLibraries/bin/mpicc" -DMPI_C_COMPILE_FLAGS:STRING="" -DMPI_C_INCLUDE_PATH:STRING="" -DMPI_C_LIBRARIES:STRING=""": -- The C compiler identification is AppleClang 7.3.0.7030031 -- Check for working C compiler: /Users/barrysmith/PetscLibraries/bin/mpicc -- Check for working C compiler: /Users/barrysmith/PetscLibraries/bin/mpicc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- The Fortran compiler identification is unknown -- Configuring incomplete, errors occurred! See also "/Users/barrysmith/Src/petsc/arch-nofortran/externalpackages/git.superlu_dist/build/CMakeFiles/CMakeOutput.log". See also "/Users/barrysmith/Src/petsc/arch-nofortran/externalpackages/git.superlu_dist/build/CMakeFiles/CMakeError.log". Process XSDK defaults ... USE_XSDK_DEFAULTS = 'YES' -- XSDK: Setting default CMAKE_BUILD_TYPE=DEBUG -- SuperLU_DIST will be built as a shared library. CMake Error at CMakeLists.txt:71 (enable_language): No CMAKE_Fortran_COMPILER could be found.

Tell CMake where to find the compiler by setting either the environment variable "FC" or the CMake cache entry CMAKE_Fortran_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.

even though SuperLU_Dist itself is a C library and doesn't directly depend on Fortran compilers only extra capabilities depend on Fortran.

I suggest modifying the SuperLU_Dist cmake system to not depend on Fortran and only build the Fortran stubs if Fortran is available but otherwise still build the C SuperLU_dist libraries

@xiaoyeli @bartlettroscoe @curfman

BarrySmith avatar May 20 '16 03:05 BarrySmith

@xiaoyeli

You can fix this by deleteing the two lines from your CMakeLists.txt file

enable_language (Fortran) set(NOFORTRAN FALSE)

I tried to make a pull request but botched the fork so it is better if you just make the change yourself. You should make the change first in the release branch and then merge that into master so that everyone can benefit from the fix.

@bartlettroscoe @curfman

BarrySmith avatar May 20 '16 18:05 BarrySmith

At the very least, change this to:

if (XSDK_ENABLE_Fortran)
  enable_language (Fortran)
  set(NOFORTRAN FALSE)
endif()

But if SuperLUDist is not building any Fortran code, then you can just delete enable_language(Fortran).

bartlettroscoe avatar May 20 '16 20:05 bartlettroscoe

If users want to use Fortran wrapper, they need Fortran compiler. I will adopt Ross' suggestion, adding XSDK conditional around the 2 lines. I am pushing in github now, but will update release tarball later.

xiaoyeli avatar May 22 '16 18:05 xiaoyeli

The cmake/XSDKDefaults.cmake is suppose to handle all this language setting stuff automatically, if it is working correctly you should not need to have any of this extra code.

SET_DEFAULT(XSDK_ENABLE_C TRUE) SET_DEFAULT(XSDK_ENABLE_CXX TRUE) SET_DEFAULT(XSDK_ENABLE_Fortran TRUE) .....

Set default compilers and flags

IF (USE_XSDK_DEFAULTS)

Handle env vars for languages C, C++, and Fortran

IF (XSDK_ENABLE_C) XSDK_HANDLE_LANG_DEFAULTS(C CC CFLAGS) ENDIF()

IF (XSDK_ENABLE_CXX) XSDK_HANDLE_LANG_DEFAULTS(CXX CXX CXXFLAGS) ENDIF()

IF (XSDK_ENABLE_Fortran) SET(ENV_FFLAGS "$ENV{FFLAGS}") SET(ENV_FCFLAGS "$ENV{FCFLAGS}") IF ( (NOT "${ENV_FFLAGS}" STREQUAL "") AND (NOT "${ENV_FCFLAGS}" STREQUAL "") AND ....

BarrySmith avatar May 22 '16 19:05 BarrySmith

In XSDKDefaults.cmake, I don't understand the stuff set inside IF (XSDK_ENABLE_Fortran) ... ENDIF()

What env variables the users should set in order to use Fortran?

Sherry

On Sun, May 22, 2016 at 12:03 PM, Barry Smith [email protected] wrote:

The cmake/XSDKDefaults.cmake is suppose to handle all this language setting stuff automatically, if it is working correctly you should not need to have any of this extra code.

SET_DEFAULT(XSDK_ENABLE_C TRUE) SET_DEFAULT(XSDK_ENABLE_CXX TRUE) SET_DEFAULT(XSDK_ENABLE_Fortran TRUE) ..... Set default compilers and flags

IF (USE_XSDK_DEFAULTS)

Handle env vars for languages C, C++, and Fortran

IF (XSDK_ENABLE_C) XSDK_HANDLE_LANG_DEFAULTS(C CC CFLAGS) ENDIF()

IF (XSDK_ENABLE_CXX) XSDK_HANDLE_LANG_DEFAULTS(CXX CXX CXXFLAGS) ENDIF()

IF (XSDK_ENABLE_Fortran) SET(ENV_FFLAGS "$ENV{FFLAGS}") SET(ENV_FCFLAGS "$ENV{FCFLAGS}") IF ( (NOT "${ENV_FFLAGS}" STREQUAL "") AND (NOT "${ENV_FCFLAGS}" STREQUAL "") AND ....

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/xiaoyeli/superlu_dist/issues/3#issuecomment-220849688

xiaoyeli avatar May 23 '16 04:05 xiaoyeli

@BarrySmith,

The cmake/XSDKDefaults.cmake is suppose to handle all this language setting stuff automatically,

In general, you can't call enable_langauge(<LANG>) right in the include of this module. That would be too early for TriBITS. However, the module XSDKDefaults.cmake could provide a macro that could be called to so this like XSDK_ENABLE_LANGUAGES().

The assumption that I made when writing the module is that the client CMake project would know what languages they needed and would set them with SET(XSDK_ENABLE_<LANG> [TRUE|FALSE]) before including the module. If you look here, you can see that these vars are set using SET_DEFAULT() which does not create a CMake cache var so these would be invisible to the general user. That seems not to be what people expected so we need to change this; hence TriBITSPub/TriBITS#121.

@xiaoyeli,

In XSDKDefaults.cmake, I don't understand the stuff set inside IF (XSDK_ENABLE_Fortran) ... ENDIF()

Specifically, what lines are you referring to? Note that GitHub provides URLs for each individual line of a file. For example:

https://github.com/xsdk-project/XSDKCMakeProj/blob/master/xsdk/XSDKDefaults.cmake#L154

Is that the IF (XSDK_ENABLE_Fortran) block you are referring to?

bartlettroscoe avatar May 23 '16 12:05 bartlettroscoe

@BarrySmith and @xiaoyeli, just making XSDK_ENABLE_<LANG> a user settable CMake cache var is not 100% straightforward. Please see the discussion in xsdk-project/XSDKCMakeProj#1 and provide your input.

bartlettroscoe avatar May 23 '16 13:05 bartlettroscoe

For example, how should the users set env variable FFLAGS in order to be captured by the following line:

https://github.com/xsdk-project/XSDKCMakeProj/blob/master/xsdk/XSDKDefaults.cmake#L155

Sherry

On Mon, May 23, 2016 at 5:57 AM, Roscoe A. Bartlett < [email protected]> wrote:

@BarrySmith https://github.com/BarrySmith,

The cmake/XSDKDefaults.cmake is suppose to handle all this language setting stuff automatically,

In general, you can't call enable_langauge(<LANG>) right in the include of this module. That would be too early for TriBITS. However, the module XSDKDefaults.cmake could provide a macro that could be called to so this like XSDK_ENABLE_LANGUAGES().

The assumption that I made when writing the module is that the client CMake project would know what languages they needed and would set them with SET(XSDK_ENABLE_<LANG> [TRUE|FALSE]) before including the module. If you look here https://github.com/xsdk-project/XSDKCMakeProj/blob/master/xsdk/XSDKDefaults.cmake#L101, you can see that these vars are set using SET_DEFAULT() which does not create a CMake cache var so these would be invisible to the general user. That seems not to be what people expected so we need to change this; hence TriBITSPub/TriBITS#121 https://github.com/TriBITSPub/TriBITS/issues/121.

https://github.com/xiaoyeli ​​ https://github.com/xiaoyeli @xiaoyeli https://github.com/xiaoyeli,

In XSDKDefaults.cmake, I don't understand the stuff set inside IF (XSDK_ENABLE_Fortran) ... ENDIF()

Specifically, what lines are you referring to? Note that GitHub provides URLs for each individual line of a file. For example:

https://github.com/xsdk-project/XSDKCMakeProj/blob/master/xsdk/XSDKDefaults.cmake#L154

Is that the IF (XSDK_ENABLE_Fortran) block you are referring to?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/xiaoyeli/superlu_dist/issues/3#issuecomment-220972578

xiaoyeli avatar May 23 '16 23:05 xiaoyeli