Skip to content
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

undefined reference to symbol 'MPI_Rsend' and error adding symbols: DSO missing from command line #34

Open
sun51027 opened this issue Jun 30, 2023 · 9 comments

Comments

@sun51027
Copy link

Hi
I have problems with "make" files.
I follow the guide in Stellarator-Tools, and cmake runs well.
While when compiling ("make"), error occurred:

/usr/bin/ld: /home/linshih/Library/scalapack/build/lib/libscalapack.a(BI_Rsend.c.o): undefined reference to symbol 'MPI_Rsend'
/home/linshih/Library/openmpi-4.1.5/lib/libmpi.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
_deps/parvmec-build/CMakeFiles/xvmec.dir/build.make:106: recipe for target '_deps/parvmec-build/xvmec' failed
make[2]: *** [_deps/parvmec-build/xvmec] Error 1
CMakeFiles/Makefile2:929: recipe for target '_deps/parvmec-build/CMakeFiles/xvmec.dir/all' failed
make[1]: *** [_deps/parvmec-build/CMakeFiles/xvmec.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
make: *** [all] Error 2.   

Does it matter with my environment setting?
I've downloaded latest version SCALAPACK and OpenMPI and point them into correct paths, so cmake runs well. But I still don't understand what I should do to deal with this.
Thanks!

@cianciosa
Copy link
Collaborator

cianciosa commented Jun 30, 2023 via email

@sun51027
Copy link
Author

Hi I tried make VERBOSE=1
I still don't know what exactly the problems are.

[ 98%] Linking Fortran executable xvmec
cd /home/linshih/testspace/Stellarator-Tools/build/_deps/parvmec-build && /home/linshih/cmake-3.26.4-linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/xvmec.dir/link.txt --verbose=1
/usr/bin/gfortran -Wl,-rpath -Wl,/usr/lib/openmpi/lib -Wl,--enable-new-dtags -L/usr/lib/openmpi/lib -pthread CMakeFiles/xvmec.dir/Sources/TimeStep/vmec.f.o -o xvmec  -Wl,-rpath,/home/linshih/Library/openmpi-4.1.5/lib: libvmec.a ../libstell-build/libstell.a /home/linshih/Library/openmpi-4.1.5/lib/libmpi_usempif08.so /home/linshih/Library/openmpi-4.1.5/lib/libmpi_usempi_ignore_tkr.so /home/linshih/Library/openmpi-4.1.5/lib/libmpi_mpifh.so /home/linshih/Library/openmpi-4.1.5/lib/libmpi.so /usr/lib/x86_64-linux-gnu/libnetcdff.so /usr/lib/x86_64-linux-gnu/libnetcdf.so /home/linshih/Library/scalapack/build/lib/libscalapack.a /usr/lib/libblas.so /usr/lib/liblapack.so
/usr/bin/ld: /home/linshih/Library/scalapack/build/lib/libscalapack.a(BI_Rsend.c.o): undefined reference to symbol 'MPI_Rsend'
/home/linshih/Library/openmpi-4.1.5/lib/libmpi.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
_deps/parvmec-build/CMakeFiles/xvmec.dir/build.make:106: recipe for target '_deps/parvmec-build/xvmec' failed

Is it possible that the gfortran or other lib like mpi too old so it fails?
I guessed "openmpi" in my /usr/lib/ could be obsolete, so I installed the latest version openmpi-4.5.1 in my home directory lest affect other users on the server.
(I've done this cmake -DCMAKE_PREFIX_PATH=/home/linshih/Library/openmpi-4.1.5/lib)
Thank you!

@cianciosa
Copy link
Collaborator

I think the problem is the order that the MPI and Scalapack libraries are being linked. In the LIBSTELL/CMakeLists.txt file change

target_link_libraries (stell

                       PUBLIC

                       $<$<BOOL:${MPI_Fortran_FOUND}>:MPI::MPI_Fortran>
                       $<$<BOOL:${NetCDF_FOUND}>:NetCDF::NetCDF>
                       $<$<BOOL:${SCALAPACK_FOUND}>:SCALAPACK::SCALAPACK>
                       $<$<AND:$<BOOL:${BLAS_FOUND}>,$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.18>>:BLAS::BLAS>
                       $<$<AND:$<BOOL:${LAPACK_FOUND}>,$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.18>>:LAPACK::LAPACK>
                       $<$<AND:$<BOOL:${BLAS_FOUND}>,$<VERSION_LESS:${CMAKE_VERSION},3.18>>:${BLAS_LIBRARIES}>
                       $<$<AND:$<BOOL:${LAPACK_FOUND}>,$<VERSION_LESS:${CMAKE_VERSION},3.18>>:${LAPACK_LIBRARIES}>
)

to

target_link_libraries (stell

                       PUBLIC

                       $<$<BOOL:${NetCDF_FOUND}>:NetCDF::NetCDF>
                       $<$<BOOL:${SCALAPACK_FOUND}>:SCALAPACK::SCALAPACK>
                       $<$<BOOL:${MPI_Fortran_FOUND}>:MPI::MPI_Fortran>
                       $<$<AND:$<BOOL:${BLAS_FOUND}>,$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.18>>:BLAS::BLAS>
                       $<$<AND:$<BOOL:${LAPACK_FOUND}>,$<VERSION_GREATER_EQUAL:${CMAKE_VERSION},3.18>>:LAPACK::LAPACK>
                       $<$<AND:$<BOOL:${BLAS_FOUND}>,$<VERSION_LESS:${CMAKE_VERSION},3.18>>:${BLAS_LIBRARIES}>
                       $<$<AND:$<BOOL:${LAPACK_FOUND}>,$<VERSION_LESS:${CMAKE_VERSION},3.18>>:${LAPACK_LIBRARIES}>
)

and see if that fixes things.

@sun51027
Copy link
Author

sun51027 commented Jul 2, 2023

Thank you so much! This fixed DSO missing problem, and passed "Linking Fortran executable xvmec" .
But another problem occurred:

[ 98%] Linking Fortran executable xvmec
[ 98%] Built target xvmec
[ 98%] Building CXX object _deps/parvmec-build/CMakeFiles/xwout_diff.dir/Testing/test_utilities/wout_diff.cpp.o
[ 98%] Building CXX object _deps/parvmec-build/CMakeFiles/xwout_diff.dir/Testing/test_utilities/vmec_test_commandline_parser.cpp.o
/home/linshih/testspace/Stellarator-Tools/PARVMEC/Testing/test_utilities/vmec_test_commandline_parser.cpp:15:74: error: specialization of ‘template<class TYPE> TYPE vmec_test::commandline_parser::get(const string&) const’ in different namespace [-fpermissive]
 vmec_test::commandline_parser::get<std::string> (const std::string &key) const {
                                                                          ^
In file included from /home/linshih/testspace/Stellarator-Tools/PARVMEC/Testing/test_utilities/vmec_test_commandline_parser.cpp:6:0:
/home/linshih/testspace/Stellarator-Tools/PARVMEC/Testing/test_utilities/vmec_test_commandline_parser.hpp:99:14: error:   from definition of ‘template<class TYPE> TYPE vmec_test::commandline_parser::get(const string&) const’ [-fpermissive]
         TYPE get(const std::string &key) const {
              ^
_deps/parvmec-build/CMakeFiles/xwout_diff.dir/build.make:89: recipe for target '_deps/parvmec-build/CMakeFiles/xwout_diff.dir/Testing/test_utilities/vmec_test_commandline_parser.cpp.o' failed

Does this relate to my environment setting?
Thank you again!

@cianciosa
Copy link
Collaborator

No that's just a coding error on my part. What compiler, version of that compiler, and platform are you trying to build on?

@sun51027
Copy link
Author

sun51027 commented Jul 2, 2023

Compiler:
The Fortran compiler identification is GNU 5.4.0

I use the server of our instituite, it is ubuntu:

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.7 LTS
Release:	16.04

Other information
Found OpenMP_C: -fopenmp (found version "4.0")
Found OpenMP_CXX: -fopenmp (found version "4.0")
Found OpenMP_Fortran: -fopenmp (found version "4.0")
Found OpenMP: TRUE (found version "4.0")
Found NetCDF: /usr/lib/x86_64-linux-gnu/libnetcdf.so (found version "4.4.0")
Found SCALAPACK: /home/linshih/Library/scalapack/build/lib/libscalapack.a
Found MPI_C: /home/linshih/Library/openmpi-4.1.5/lib/libmpi.so (found version "3.1")
Found MPI_CXX: /home/linshih/Library/openmpi-4.1.5/lib/libmpi.so (found version "3.1")
Found MPI_Fortran: /home/linshih/Library/openmpi-4.1.5/lib/libmpi_usempif08.so (found version "3.1")
Found MPI: TRUE (found version "3.1")

Thank you!

@cianciosa
Copy link
Collaborator

cianciosa commented Jul 5, 2023 via email

@sun51027
Copy link
Author

I would also like to have a test run, so if test utilities are able to run, this may help me a lot.
Thank you so much!

@cianciosa
Copy link
Collaborator

cianciosa commented Jul 12, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants