[CMake-Promote] does anyone have compile MPI program by cmake successfully

吴景鹏 tojingpeng at gmail.com
Fri Apr 24 07:00:37 EDT 2009


Hi, cmake users

I tried to use cmake to create the makefile , but I failed to make when
Linking CXX executable read_send_write,
there are many  references undefined. it seems that  the program haven't
found the libraries. maybe I don't have the right configuration of cmake.
The cmake configuration is attached. could you give me some suggestion?

I began to use cmake about one month ago and don't know the meanings of
settings in cmake exactly.
Could you give me some suggestions?
some information are as follows:

the end of error reported are as follows,
CMakeFiles/read_send_write.
dir/read_send_write.o(.gnu.linkonce.t._ZN4PMPI10Errhandler4FreeEv+0x11):
In function `PMPI::Errhandler::Free()':
: undefined reference to `MPI_Errhandler_free'
collect2: ld returned 1 exit status
make[2]: *** [read_send_write] Error 1
make[1]: *** [CMakeFiles/read_send_write.dir/all] Error 2
make: *** [all] Error 2
usage: more [-dflpcsu] [+linenum | +/pattern] name1 name2 ...




my CMakeLists.txt, downloaded from
http://crab-lab.zool.ohiou.edu/kevin/ITK_MPI/ :
cmake_minimum_required(VERSION 2.4)

project( ITK_MPI )

#include_directories( /usr/include/openmpi/1.2.4-gcc )
include_directories( /opt/openmpi/install/include/openmpi/ )

find_package ( ITK )
if ( ITK_FOUND )
        include( ${USE_ITK_FILE} )
endif( ITK_FOUND )

find_package ( MPI )
if ( MPI_FOUND )
        include_directories( ${MPI_INCLUDE_PATH} )
endif( MPI_FOUND )

add_executable( pieces pieces.cxx )
target_link_libraries( pieces ITKCommon)

add_executable( read_split_write read_split_write.cxx )
target_link_libraries( read_split_write ${MPI_LIBRARIES}
 ITKIO ITKCommon )

add_executable( read_send_write read_send_write.cxx )
target_link_libraries( read_send_write ${MPI_LIBRARIES}
 ITKIO ITKCommon )

add_executable( read_split_paste_write read_split_paste_write.cxx )
target_link_libraries( read_split_paste_write ITKIO ITKCommon )

add_executable( read_split_send_paste_write read_split_send_paste_write.cxx
)
add_executable( read_split_send_paste_write read_split_send_paste_write.cxx
)
target_link_libraries( read_split_send_paste_write  ${MPI_LIBRARIES}
  ITKIO ITKCommon )


the configuration of cmake.

 CMAKE_AR
/usr/bin/ar
 CMAKE_BACKWARDS_COMPATIBILITY
2.4
 CMAKE_BUILD_TYPE

 CMAKE_COLOR_MAKEFILE
ON
 CMAKE_CXX_COMPILER
/opt/openmpi/install/bin/mpicxx
 CMAKE_CXX_FLAGS

 CMAKE_CXX_FLAGS_DEBUG
-g
 CMAKE_CXX_FLAGS_MINSIZEREL       -Os
-DNDEBUG
 CMAKE_CXX_FLAGS_RELEASE          -O3
-DNDEBUG
 CMAKE_CXX_FLAGS_RELWITHDEBINFO   -O2
-g
 CMAKE_C_COMPILER
/opt/openmpi/install/bin/mpicc
 CMAKE_C_FLAGS

 CMAKE_C_FLAGS_DEBUG
-g
 CMAKE_C_FLAGS_MINSIZEREL         -Os
-DNDEBUG
 CMAKE_C_FLAGS_RELEASE            -O3
-DNDEBUG
 CMAKE_C_FLAGS_RELWITHDEBINFO     -O2
-g
 CMAKE_EXE_LINKER_FLAGS

 CMAKE_EXE_LINKER_FLAGS_DEBUG

 CMAKE_EXE_LINKER_FLAGS_MINSIZE

 CMAKE_EXE_LINKER_FLAGS_RELEASE

 CMAKE_EXE_LINKER_FLAGS_RELWITH

 CMAKE_INSTALL_PREFIX
/opt/openmpi/install
 CMAKE_MAKE_PROGRAM
/usr/bin/gmake
 CMAKE_MODULE_LINKER_FLAGS

 CMAKE_MODULE_LINKER_FLAGS_DEBU

 CMAKE_MODULE_LINKER_FLAGS_MINS

 CMAKE_MODULE_LINKER_FLAGS_RELE

 CMAKE_MODULE_LINKER_FLAGS_RELW

 CMAKE_RANLIB
/usr/bin/ranlib
 CMAKE_SHARED_LINKER_FLAGS

 CMAKE_SHARED_LINKER_FLAGS_DEBU

 CMAKE_SHARED_LINKER_FLAGS_MINS

 CMAKE_SHARED_LINKER_FLAGS_RELE

 CMAKE_SHARED_LINKER_FLAGS_RELW

 CMAKE_SKIP_RPATH
OFF
 CMAKE_USE_RELATIVE_PATHS
OFF
 CMAKE_VERBOSE_MAKEFILE
OFF
 EXECUTABLE_OUTPUT_PATH

 ITK_DIR
/opt/itk/bin
 LIBRARY_OUTPUT_PATH

 MPI_EXTRA_LIBRARY
/opt/openmpi/install/lib/libmpi_cxx.so.0
 MPI_INCLUDE_PATH
/opt/openmpi/install/include/
 MPI_LIBRARY                      /opt/openmpi/install/lib/libmpi_cxx.la
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-promote/attachments/20090424/c3089347/attachment.html>


More information about the CMake-Promote mailing list