-
Notifications
You must be signed in to change notification settings - Fork 563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Piro: Linking issue with gfortran, undefined reference to `_gfortran... #8632
Comments
Could you copy/paste the configuration script that you used to configure Trilinos before the compilation? Have you set any Fortran options during the configuration of Trilinos?
Have you try to fully clean the build directory and rebuild from scratch? |
Try adding this:
|
Thank you both for the suggestions, I have followed up with both of these and they did not remedy the issue. I had previously not set I then added -- Verifying Fortran/CXX Compiler Compatibility - Failed
and the CXX compiler:
failed to compile a simple test project using both languages. The output
Call Stack (most recent call first):
|
@tuckerhartland You might try adding the option |
I've seen this issue before. The linker needs -lgfortran. By adding |
Thanks @bradking ! @tuckerhartland - can you try adding CMAKE_POLICY_DEFAULT_CMP0056=NEW to your configure? Based on this comment from cmake documentation, you are probably getting the old behavior:
|
@bradking @rppawlo thank you for the suggestions. Adding CMAKE_POLICY_DEFAULT_CMP0056=NEW to the configure script did not remedy the issue. I still have the same issues as before, that is
|
The VerifyFortranC failure is probably due to CMake Issue 21408, which is about CMP0056 not being honored by FortranCInterface. That's been fixed by CMake MR 5483, and the fix will be in CMake 3.20. One could build CMake from source or try a nightly binary to get that fix. However, it should not be necessary to add $ grep _IMPLICIT_LINK_ CMakeFiles/*/CMake*Compiler.cmake What is its output? |
Thanks again @bradking for further insight into the source of the error. I am not certain why this issue wouldn't be more prevalent if it is due to the CMake Issue that you suggested. CMakeFiles/3.16.3/CMakeCCompiler.cmake:set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "mpi;gcc;gcc_s;pthread;c;gcc;gcc_s") I then built a more recent version of CMake (version 3.19.4) and tried configuring and building but had this did not remedy the previously stated issues. |
Thanks. The
That does list several of the libraries from I just ran one of CMake's tests for FortranCInterface using @tuckerhartland let's try a simpler case on your machine. Create a cmake_minimum_required(VERSION 3.16)
project(Example LANGUAGES C CXX Fortran)
include(FortranCInterface)
FortranCInterface_VERIFY()
FortranCInterface_VERIFY(CXX) Then create a fresh build tree and run |
Hello @bradking, thank you again for a helpful suggestion. Detection and verification was successful for this simple build example as I obtained the following upon running |
@bartlettroscoe - given the evidence above, I think the next question is: does tribits somehow overwrite the fortran link flags? |
CC: @rppawlo @tuckerhartland, dealing with issues like this have been such a pain over the years. It has been a long time since I have seen a link error like this but the way we resolved this was to tack on
See if that works. A lot has changed in CMake in the last 10 years since we get everything working so we may revisit issues like this as part of TriBITSPub/TriBITS#299. It would be so nice if we could find a way to make CMake automatically tack on libraries like |
@bartlettroscoe your suggestion for specifying the BLAS libraries fixed the issue, thank you so much for the help! |
Question
@trilinos/<Piro>
I have been working with Trilinos for a short time. I have had success in building Trilinos with BUILD_SHARED_LIBS=OFF, but in order to build Trilinos with PyTrilinos enabled, I need to set BUILD_SHARED_LIBS=ON. Unfortunately I receive the following error when I try to do a shared library build of Trilinos.
[ 98%] Linking CXX executable Piro_TempusSolver_SensitivitySinCosUnitTests.exe
/usr/bin/ld: ../../teuchos/numerics/src/libteuchosnumerics.so.13.1: undefined reference to
_gfortran_transfer_character_write' /usr/bin/ld: ../../teuchos/numerics/src/libteuchosnumerics.so.13.1: undefined reference to
_gfortran_st_write_done'/usr/bin/ld: ../../teuchos/numerics/src/libteuchosnumerics.so.13.1: undefined reference to
_gfortran_concat_string' /usr/bin/ld: ../../teuchos/numerics/src/libteuchosnumerics.so.13.1: undefined reference to
_gfortran_stop_string'/usr/bin/ld: ../../teuchos/numerics/src/libteuchosnumerics.so.13.1: undefined reference to
_gfortran_transfer_integer_write' /usr/bin/ld: ../../teuchos/numerics/src/libteuchosnumerics.so.13.1: undefined reference to
_gfortran_string_len_trim'/usr/bin/ld: ../../teuchos/numerics/src/libteuchosnumerics.so.13.1: undefined reference to `_gfortran_st_write'
collect2: error: ld returned 1 exit status
make[2]: *** [packages/piro/test/CMakeFiles/Piro_TempusSolver_SensitivitySinCosUnitTests.dir/build.make:199: packages/piro/test/Piro_TempusSolver_SensitivitySinCosUnitTests.exe] Error 1
make[1]: *** [CMakeFiles/Makefile2:17768: packages/piro/test/CMakeFiles/Piro_TempusSolver_SensitivitySinCosUnitTests.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
Any suggestions to fix this build issue would be greatly appreciated. Let me know if there is more information that I could provide that would help you understand the issue that I am having.
The text was updated successfully, but these errors were encountered: