optimad / bitpit

Open source library for scientific HPC
http://optimad.github.io/bitpit/
GNU Lesser General Public License v3.0
117 stars 33 forks source link

error while building on Ubuntu 16.04 LTS #14

Closed nuaawqf closed 5 years ago

nuaawqf commented 5 years ago

Hi everyone: After installing the BLAS CBLAS and lapack. I have encountered the following error while building. Could anyone help me? Thanks. My OS is Ubuntu 16.04 LTS, gcc version 5.4.0, cmake version 3.5.1.

[ 2%] Built target COMMON_TARGET_OBJECT [ 5%] Built target POD_TARGET_OBJECT [ 9%] Built target CONTAINERS_TARGET_OBJECT [ 20%] Built target IO_TARGET_OBJECT [ 20%] Built target LA_TARGET_OBJECT [ 21%] Built target CG_TARGET_OBJECT [ 25%] Built target PABLO_TARGET_OBJECT [ 26%] Built target SURFUNSTRUCTURED_TARGET_OBJECT [ 36%] Built target PATCHKERNEL_TARGET_OBJECT [ 36%] Built target VOLCARTESIAN_TARGET_OBJECT [ 38%] Built target VOLOCTREE_TARGET_OBJECT [ 38%] Built target VOLUNSTRUCTURED_TARGET_OBJECT [ 38%] Built target RBF_TARGET_OBJECT [ 45%] Built target LEVELSET_TARGET_OBJECT [ 46%] Built target bitpit [ 49%] Built target test_common_00001 [ 49%] Built target test_operators_00001 [ 52%] Built target test_IO_00003 [ 52%] Built target test_containers_00001 [ 54%] Built target test_IO_00004 [ 54%] Built target test_IO_00002 [ 57%] Built target test_IO_00005 [ 57%] Built target test_IO_00006 [ 60%] Built target test_LA_00001 [ 60%] Built target test_IO_00001 [ 61%] Linking CXX executable test_CG_00002 [ 61%] Built target test_SA_00001 [ 62%] Linking CXX executable test_CG00001 /usr/local/lib/liblapack.a(xerbla.o): In function `xerbla': xerbla.f:(.text+0x49): undefined reference to _gfortran_st_write' xerbla.f:(.text+0x54): undefined reference to_gfortran_string_len_trim' xerbla.f:(.text+0x69): undefined reference to _gfortran_transfer_character_write' xerbla.f:(.text+0x79): undefined reference to_gfortran_transfer_integer_write' xerbla.f:(.text+0x81): undefined reference to _gfortran_st_write_done' xerbla.f:(.text+0x8a): undefined reference to_gfortran_stop_string' collect2: error: ld returned 1 exit status test/CG/CMakeFiles/test_CG_00002.dir/build.make:99: recipe for target 'test/CG/test_CG_00002' failed make[2]: [test/CG/test_CG_00002] Error 1 CMakeFiles/Makefile2:2305: recipe for target 'test/CG/CMakeFiles/test_CG_00002.dir/all' failed make[1]: [test/CG/CMakeFiles/test_CG00002.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... /usr/local/lib/liblapack.a(xerbla.o): In function `xerbla': xerbla.f:(.text+0x49): undefined reference to _gfortran_st_write' xerbla.f:(.text+0x54): undefined reference to_gfortran_string_len_trim' xerbla.f:(.text+0x69): undefined reference to _gfortran_transfer_character_write' xerbla.f:(.text+0x79): undefined reference to_gfortran_transfer_integer_write' xerbla.f:(.text+0x81): undefined reference to _gfortran_st_write_done' xerbla.f:(.text+0x8a): undefined reference to_gfortran_stop_string' collect2: error: ld returned 1 exit status test/CG/CMakeFiles/test_CG_00001.dir/build.make:99: recipe for target 'test/CG/test_CG_00001' failed make[2]: [test/CG/test_CG_00001] Error 1 CMakeFiles/Makefile2:2374: recipe for target 'test/CG/CMakeFiles/test_CG_00001.dir/all' failed make[1]: [test/CG/CMakeFiles/test_CG_00001.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2

PS: I install the BLAS CBLAS and LAPACK using the following commands:


BLAS: gfortran -c -O3 -fPIC .f gcc -shared .o -fPIC -o libblas.so cp libblas.so /usr/local/lib/ ar rv libblas.a *.o
sudo cp libblas.a /usr/local/lib


CBLAS: cp ../BLAS/libblas.a testing
make
sudo cp lib/cblas_LINUX.a /usr/local/lib/libcblas.a


LAPACK: I use gfortran as the complier. change this in Makefile

lib: lapacklib tmglib

lib: blaslib variants lapacklig tmglib make cd lapacke
make cp include/.h /usr/local/include
cd .. cp
.a /usr/local/lib


marcocisternino commented 5 years ago

Hello Wu, we glad to know about your interest in bitpit. I will try to help with the building problem you encountered. It seems that the linker is not able to find the library libgfortran. You should check the value of the cmake variable FORTRAN_gfortran_LIBRARY Enter your build folder and launch ccmake .. You should be able to see a set of the exposed cmake variable. Press 't' to extend the list to all the cmake variables. Among them you should see FORTRAN_gfortran_LIBRARY. Please, verify that the value of this variable is set to an existing path in your filesystem and that the path points to a working gfortran library. In my case, Ubuntu 14.04 and gcc-4.8 the path is /usr/lib/gcc/x86_64-linux-gnu/4.8/libgfortran.so On my VM Ubuntu 16.04 and gcc 5.4.1 /usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.so

I assume that the value of FORTRAN_gfortran_LIBRARY is not correctly set. In order to find the right location of the library, please try: locate libgfortran However, this is quite weird, because cmake should be able to find libgfortran by its own.....

If this doesn't help, please, give us more information about the GNU Compiler and how you installed it. I would like to ask you a question: why did you choose to install blas and lapack manually and not using apt?

Please, let me know if you need more help. Thanks

Best regards,

Marco Cisternino, PhD marco.cisternino@optimad.it


OPTIMAD Engineering srl Via Giacinto Collegno 18, Torino, Italia. +3901119719782 www.optimad.it


Da: Wu Qifeng notifications@github.com Inviato: mercoledì 22 maggio 2019 12:15 A: optimad/bitpit Cc: Subscribed Oggetto: [optimad/bitpit] error while building on Ubuntu 16.04 (#14)

Hi everyone: After installing the BLAS CBLAS and lapack. I have encountered the following error while building. Could anyone help me? Thanks. My OS is Ubuntu 16.04 LTS, gcc version 5.4.0, cmake version 3.5.1.

[ 2%] Built target COMMON_TARGET_OBJECT [ 5%] Built target POD_TARGET_OBJECT [ 9%] Built target CONTAINERS_TARGET_OBJECT [ 20%] Built target IO_TARGET_OBJECT [ 20%] Built target LA_TARGET_OBJECT [ 21%] Built target CG_TARGET_OBJECT [ 25%] Built target PABLO_TARGET_OBJECT [ 26%] Built target SURFUNSTRUCTURED_TARGET_OBJECT [ 36%] Built target PATCHKERNEL_TARGET_OBJECT [ 36%] Built target VOLCARTESIAN_TARGET_OBJECT [ 38%] Built target VOLOCTREE_TARGET_OBJECT [ 38%] Built target VOLUNSTRUCTURED_TARGET_OBJECT [ 38%] Built target RBF_TARGET_OBJECT [ 45%] Built target LEVELSET_TARGET_OBJECT [ 46%] Built target bitpit [ 49%] Built target test_common_00001 [ 49%] Built target test_operators_00001 [ 52%] Built target test_IO_00003 [ 52%] Built target test_containers_00001 [ 54%] Built target test_IO_00004 [ 54%] Built target test_IO_00002 [ 57%] Built target test_IO_00005 [ 57%] Built target test_IO_00006 [ 60%] Built target test_LA_00001 [ 60%] Built target test_IO_00001 [ 61%] Linking CXX executable test_CG_00002 [ 61%] Built target test_SA_00001 [ 62%] Linking CXX executable test_CG00001 /usr/local/lib/liblapack.a(xerbla.o): In function xerbla': xerbla.f:(.text+0x49): undefined reference to _gfortran_st_write' xerbla.f:(.text+0x54): undefined reference to _gfortran_string_len_trim' xerbla.f:(.text+0x69): undefined reference to _gfortran_transfer_character_write' xerbla.f:(.text+0x79): undefined reference to _gfortran_transfer_integer_write' xerbla.f:(.text+0x81): undefined reference to gfortran_st_write_done' xerbla.f:(.text+0x8a): undefined reference to _gfortran_stop_string' collect2: error: ld returned 1 exit status test/CG/CMakeFiles/test_CG_00002.dir/build.make:99: recipe for target 'test/CG/test_CG_00002' failed make[2]: [test/CG/test_CG_00002] Error 1 CMakeFiles/Makefile2:2305: recipe for target 'test/CG/CMakeFiles/test_CG_00002.dir/all' failed make[1]: [test/CG/CMakeFiles/test_CG_00002.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... /usr/local/lib/liblapack.a(xerbla.o): In function xerbla': xerbla.f:(.text+0x49): undefined reference to _gfortran_st_write' xerbla.f:(.text+0x54): undefined reference to _gfortran_string_len_trim' xerbla.f:(.text+0x69): undefined reference to _gfortran_transfer_character_write' xerbla.f:(.text+0x79): undefined reference to _gfortran_transfer_integer_write' xerbla.f:(.text+0x81): undefined reference to _gfortran_st_write_done' xerbla.f:(.text+0x8a): undefined reference to _gfortran_stop_string' collect2: error: ld returned 1 exit status test/CG/CMakeFiles/test_CG_00001.dir/build.make:99: recipe for target 'test/CG/test_CG_00001' failed make[2]: [test/CG/test_CG_00001] Error 1 CMakeFiles/Makefile2:2374: recipe for target 'test/CG/CMakeFiles/test_CG_00001.dir/all' failed make[1]: [test/CG/CMakeFiles/test_CG_00001.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: [all] Error 2

PS: I install the BLAS CBLAS and LAPACK using the following commands: BLAS: gfortran -c -O3 -fPIC .f gcc -shared .o -fPIC -o libblas.so cp libblas.so /usr/local/lib/ ar rv libblas.a *.o sudo cp libblas.a /usr/local/lib CBLAS: cp ../BLAS/libblas.a testing make sudo cp lib/cblas_LINUX.a /usr/local/lib/libcblas.a LAPACK: I use gfortran as the complier. change this in Makefile

lib: lapacklib tmglib

lib: blaslib variants lapacklig tmglib make cd lapacke make cp include/.h /usr/local/include cd .. cp .a /usr/local/lib

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/optimad/bitpit/issues/14?email_source=notifications&email_token=ABSMIGDXALZ324BWNDBAF6LPWUMMJA5CNFSM4HOSYUJKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GVFOMTA, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABSMIGDWIBBL6DQ3LB5KA53PWUMMJANCNFSM4HOSYUJA.

nuaawqf commented 5 years ago

@marcocisternino Dear macro: Thanks for your reply. First, I check the FORTRAN_gfortran_LIBRARY variable and the value is /usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.so. After that, I delelte all the libs I've copied to the /usr/local/lib/ directory and install blas and lapack using apt, the version is 3.6.0. And then everything goes well. :-) The blas and lapack I used before is 3.8.0. I will try to complie them in lower verison manually later to see if any diffrence.

marcocisternino commented 5 years ago

This issue has not seen any recent activity. I'm closing the issue, but feel free to re-open a closed issue if needed.