yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #14991
Re: [Question #635850]: Trouble linking Trilinos shared libraries
Question #635850 on Yade changed:
https://answers.launchpad.net/yade/+question/635850
Description changed to:
Hello Yade community,
I am trying to incorporate some tools from the Trilinos tool box into
yade, but I am running into an issue with linking shared libraries. If
you have any experience linking shared libraries with yade (or other
software), I would greatly appreciate some advice here.
The process follows:
-Compile Trilinos as shared libraries
-Add a "FindTrilinos.cmake" and modify CMakeLists.txt (see below)
-Compile Yade (successfully)
-Run a test with the new yade installation and I receive the following error:
Traceback (most recent call last):
File "/home/rcaulk/YADE/buildYade/interactiondistribution/install/bin/yade-2017-05-24.git-0ade6cf", line 129, in <module>
import yade
File "/home/rcaulk/YADE/buildYade/interactiondistribution/install/lib/x86_64-linux-gnu/yade-2017-05-24.git-0ade6cf/py/yade/__init__.py", line 65, in <module>
import boot
ImportError: libteuchoscomm.so.12: cannot open shared object file: No such file or directory
_____________________________________________________________________
But libteachoscomm.so.12 is a file and it is in the following directory:
/usr/local/lib/trilinos2/install/lib/
I believe this directory is linked using the following (selected)
commands in FindTrilinos.cmake:
SET(TRILINOS_LIB_SEARCH_PATH /usr/local/lib/trilinos2/install/lib)
FIND_LIBRARY(TEUCHOS_LIBRARY_COMM NAMES teuchoscomm PATHS
${TRILINOS_LIB_SEARCH_PATH})
IF(TEUCHOS_INCLUDE_PATH AND TEUCHOS_LIBRARY)
SET(TRILINOS_INCLUDE_DIR ${TRILINOS_INCLUDE_DIR} ${TEUCHOS_INCLUDE_PATH})
SET(TRILINOS_LIBRARIES ${TRILINOS_LIBRARIES} ${TEUCHOS_LIBRARY} ${TEUCHOS_LIBRARY_PARAMETER_LIST} ${TEUCHOS_LIBRARY_NUMERICS} ${TEUCHOS_LIBRARY_REMAINDER} ${TEUCHOS_LIBRARY_COMM})
SET(HAVE_TEUCHOS YES)
ENDIF(TEUCHOS_INCLUDE_PATH AND TEUCHOS_LIBRARY)
and then in my CMakeLists.txt:
IF(ENABLE_TRILINOS)
FIND_PACKAGE(Trilinos)
IF (TRILINOS_FOUND)
INCLUDE_DIRECTORIES(${TRILINOS_INCLUDE_DIR})
LINK_DIRECTORIES(${TRILINOS_LIBRARIES})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTRILINOS")
SET(LINKLIBS "${LINKLIBS};${TRILINOS_LIBRARIES};")
SET(CONFIGURED_FEATS "${CONFIGURED_FEATS} TRILINOS")
MESSAGE("Adding Trilinos")
ELSE(TRILINOS_FOUND)
MESSAGE(STATUS "TRILINOS NOT found")
SET(DISABLED_FEATS "${DISABLED_FEATS} TRILINOS")
SET(ENABLE_TRILINOS OFF)
ENDIF(TRILINOS_FOUND)
ELSE(ENABLE_TRILINOS)
SET(DISABLED_FEATS "${DISABLED_FEATS} TRILINOS")
ENDIF(ENABLE_TRILINOS)
_____________________________________________________________________
The cmake step is successful, and so is the following make and
installation of yade.
I am almost certain my problem lies in the CMakeList.txt file. I am
linking here as if these are static libraries? But I noticed other
shared libraries are linked slightly differently? Notice I am not very
familiar with why or if we need to link static vs shared libraries
differently. I have tried to link these as shared libraries with:
ADD_EXECUTABLE(yade ${SOURCES})
TARGET_LINK_LIBRARIES(yade ${TRILINOS_LIBRARIES})
Instead of SET(LINKLIBS...) but cmake cries about yade not being an
executable.
All help appreciated,
Robert
--
You received this question notification because your team yade-users is
an answer contact for Yade.