Skip to content

Add Libs.private#343

Closed
fsimonis wants to merge 2 commits intoprecice:developfrom
fsimonis:add-libsprivate
Closed

Add Libs.private#343
fsimonis wants to merge 2 commits intoprecice:developfrom
fsimonis:add-libsprivate

Conversation

@fsimonis
Copy link
Copy Markdown
Member

This PR:

  • Keeps track of dependencies building a list of libraries
  • Adds the field Libs.private to the configured .pc file.

TODO

  • Verify that MPI work like this

Closes #313

@fsimonis fsimonis added the building Improves or extends the building or packaging of preCICE label Mar 25, 2019
@fsimonis fsimonis added this to the Version 1.5.0 milestone Mar 25, 2019
@MakisH MakisH self-requested a review May 21, 2019 07:25
Copy link
Copy Markdown
Member

@MakisH MakisH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I built preCICE as a static library using -DBUILD_SHARED_LIBS=OFF.

Then I tried to build the C++ (and C) solver dummies, which failed with an error for finding Eigen, MPI, and NumPy:

-- Configuring done
CMake Error at CMakeLists.txt:6 (add_executable):
  Target "solverdummy" links to target "Eigen3::Eigen" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:6 (add_executable):
  Target "solverdummy" links to target "MPI::MPI_CXX" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:6 (add_executable):
  Target "solverdummy" links to target "NumPy::NumPy" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

This seems to be a different issue (@fsimonis). I then tried to build the OpenFOAM adapter with preCICE as a static library, by using the --static option in pkg-config --silence-errors --libs --static libprecice.

Since the OpenFOAM adapter is a shared library, I got an error regarding relocation, which I solved by rebuilding preCICE with:

 CMAKE_CXX_FLAGS = -fPIC

Maybe we should integrate this by default.

The current issue, as @fsimonis expected, is for MPI during linking:

undefined symbol: _ZN3MPI8Datatype4FreeEv       (/home/makish/OpenFOAM/makish-5.0/platforms/linux64GccDPInt32Opt/lib/libpreciceAdapterFunctionObject.so)
undefined symbol: _ZN3MPI3Win4FreeEv    (/home/makish/OpenFOAM/makish-5.0/platforms/linux64GccDPInt32Opt/lib/libpreciceAdapterFunctionObject.so)
undefined symbol: ompi_mpi_cxx_op_intercept     (/home/makish/OpenFOAM/makish-5.0/platforms/linux64GccDPInt32Opt/lib/libpreciceAdapterFunctionObject.so)
undefined symbol: _ZN3MPI4CommC2Ev      (/home/makish/OpenFOAM/makish-5.0/platforms/linux64GccDPInt32Opt/lib/libpreciceAdapterFunctionObject.so)

@MakisH
Copy link
Copy Markdown
Member

MakisH commented May 21, 2019

OpenMPI also provides a pkg-config module:

$ pkg-config --libs --static mpi
-L/usr/lib/openmpi/lib -Wl,-rpath -Wl,/usr/lib/openmpi/lib -Wl,--enable-new-dtags -lmpi -ldl -libverbs -lutil -lm

@MakisH
Copy link
Copy Markdown
Member

MakisH commented May 21, 2019

I assume that we also need Requires.private. However, I tried adding Requires.private: mpi to the used libprecice.pc file and I still get the same error.

Here are the flags & paths that pkg-config returns on my system:

$ pkg-config --cflags libprecice 
-pthread -I/home/makish/inst/include -I/usr/lib/openmpi/include -I/usr/lib/openmpi/include/openmpi -I/usr/lib/openmpi/include/openmpi/opal/mca/event/libevent2021/libevent -I/usr/lib/openmpi/include/openmpi/opal/mca/event/libevent2021/libevent/include

$ pkg-config --libs --static libprecice 
-L/home/makish/inst/lib -L/usr/lib/openmpi/lib -lprecice -lboost_filesystem -lboost_log -lboost_log_setup -lboost_program_options -lboost_system -lboost_thread -lboost_unit_test_framework -lboost_date_time -lboost_regex -lboost_chrono -lboost_atomic -ldl -lxml2 -lpetsc -lpython2.7 -Wl,-rpath -Wl,/usr/lib/openmpi/lib -Wl,--enable-new-dtags -lmpi -ldl -libverbs -lutil -lm

@MakisH
Copy link
Copy Markdown
Member

MakisH commented May 21, 2019

We are currently confused about why this is happening but we don't consider it a high priority. We decided to postpone it.

@MakisH MakisH modified the milestones: Version 1.5.0, Version 1.x.x May 21, 2019
@fsimonis fsimonis marked this pull request as draft May 4, 2020 11:24
@MakisH MakisH removed their assignment Oct 27, 2020
@uekerman uekerman modified the milestones: Version 2.x.x, Version 3.0.0 Jul 27, 2022
@fsimonis
Copy link
Copy Markdown
Member Author

This is not worth the hassle until we have a real reason to do provide this.
Until then, maybe CMake has a generator for find package files ...

@fsimonis fsimonis closed this Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

building Improves or extends the building or packaging of preCICE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pkg-config: Add Libs.private

3 participants