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

Compilation issues on a personal machine #13

Open
AxelDora opened this issue Sep 4, 2018 · 3 comments
Open

Compilation issues on a personal machine #13

AxelDora opened this issue Sep 4, 2018 · 3 comments
Labels
question Further information is requested

Comments

@AxelDora
Copy link

AxelDora commented Sep 4, 2018

Describe the bug

Compiling the code on a personal machine returns an error in the code that seems to be linked to how the libraries being used are linked by cmake

Expected Result
Compilation

Actual Result

cmake ../channelflow/
-- 
-- configuring channelflow version 2.0.2
-- Using GNU compiler options
-- 
-- Starting system introspection
-- Found FFTW 
-- FFTW_LIBRARY=/usr/local/lib/x86_64-linux-gnu/libfftw3.so
-- FFTW_OMP_LIBRARY=/usr/local/lib/x86_64-linux-gnu/libfftw3_omp.so
-- FFTW_MPI_LIBRARY=/usr/local/lib/x86_64-linux-gnu/libfftw3_mpi.a
-- MPI libs: 
-- FFTW_MPI library: /usr/local/lib/x86_64-linux-gnu/libfftw3_mpi.a
-- NetCDF include dir: /usr/include
-- 
-- Include directories: 
-- Git revision e702ced2706262a5d04f7cfcc47989af9d7d0ed1


   ###############################################
   ###########  Configuration summary  ###########
   ###############################################
   Compiler:                       GNU 7.3.0
   Build type:                     Release
   Install prefix:                 /usr/local
   Building shared library:        yes
   Linking programs to:            shared library

   Libraries
   MPI:                            enabled
   netcdf (default file format):   enabled
   Parallel netcdf:                disabled
   HDF5 C++ (legacy file format):  disabled

   Channelflow components
   nsolver:                        enabled
   Python wrapper:                 disabled
   GTest unit testing:             enabled


-- Configuring done
-- Generating done
-- Build files have been written to: /home/aksh/GITCLONED/build
aksh@aksh-LENOVO-Y50:~/GITCLONED/build$ make -j8
[  3%] Built target gmock
[  6%] Built target gmock_main
[  8%] Built target gtest
[  9%] Built target gtest_main
[ 18%] Built target nsolver
[ 19%] Linking CXX shared library libchflow.so
/usr/bin/x86_64-linux-gnu-ld: /usr/local/lib/x86_64-linux-gnu/libfftw3_mpi.a(api.o): relocation R_X86_64_PC32 against symbol `ompi_mpi_comm_null' can not be used when making a shared object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
channelflow/CMakeFiles/chflow.dir/build.make:646: recipe for target 'channelflow/libchflow.so' failed
make[2]: *** [channelflow/libchflow.so] Error 1
CMakeFiles/Makefile2:384: recipe for target 'channelflow/CMakeFiles/chflow.dir/all' failed
make[1]: *** [channelflow/CMakeFiles/chflow.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

Information on your system
Running on Ubuntu 18.04.1 LTS
2. (CMake configuration: 3.10.2-1ubuntu2)

Running on a 2015 Lenovo Y50-70

@symtor
Copy link
Collaborator

symtor commented Sep 4, 2018

@alalazo do you understand this? g++-7.3.0 with /usr/lib/x86_64-linux-gnu/libfftw3_mpi.so compiles on our CI.

@AxelDora Can you give more details on the MPI environment that you use?

@alalazo
Copy link
Contributor

alalazo commented Sep 4, 2018

The system detected static libraries and @AxelDora is trying to build shared ones. The error:

/usr/bin/x86_64-linux-gnu-ld: /usr/local/lib/x86_64-linux-gnu/libfftw3_mpi.a(api.o): relocation R_X86_64_PC32 against symbol `ompi_mpi_comm_null' can not be used when making a shared object; recompile with -fPIC

basically says that you need position independent code to construct a shared library.

TL;DR Substitute:

/usr/local/lib/x86_64-linux-gnu/libfftw3_mpi.a

with

/usr/local/lib/x86_64-linux-gnu/libfftw3_mpi.so

in CMakeCache.txt or build a static library.

@alalazo alalazo added the question Further information is requested label Sep 4, 2018
@AxelDora
Copy link
Author

AxelDora commented Sep 4, 2018

Hi guys.
Thanks for such prompt responses, you guys are wonderful.
I tried the hack you told me try @alalazo
The trouble is my system does not have libfftw3_mpi.so, only the libfftw3_mpi.so file, even though I installed fftw3, with the --enable_shared=yes (I reinstalled it to verify I was missing the file). Is there any chance anyone knows why that might be? If not, does installing a static fftw_mpi mean I have to install it to my build folder.
In general, fftw has given me a lot of painful memories, so if someone could give me a link to a dependable installation manual, I'd be grateful (I kinda installed it by just rough pieces patched together as I was learning my way through this stuff). Perhaps it would be helpful to add that link to the CF manual too, if CF is the first time fftw is being used in someone's life, like it was for me

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

No branches or pull requests

3 participants