[Cmake] CMake and MPI on Sun
Michael Kuhn
michael_cm at gmx.ch
Wed Jul 21 09:59:33 EDT 2004
Thanks, this worked :-)
> Try this:
> IF("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
> TARGET_LINK_LIBRARIES(
> MPITest
> socket;nsu;rt
> )
> ENDIF("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
>
> It seems that some functions on Solaris are included in different
> libraries than on Linux.
>
> michael_cm at gmx.ch wrote:
> > Hi,
> >
> > thanks a lot, this helped! I've manually inserted "-lsocket -lnsu -lrt"
> in
> > the CMake generated makefile, and the compilation (and linking) was
> > successfull. However, manually editing the makefile is definitely not
> > desirable. Does anybody know how to make CMake inserting this linking
> > commands itself?
> >
> > The same configuration (program + CMakeLists.txt) works fine under
> Linux.
> > Above linker commands are not necessary (and not generated by CMake).
> Does
> > anybody know why they are needed in the Sun environment?
> >
> > Thanks,
> >
> > Michael
> >
> >
> >
> >
> >
> >
> >>Try to set CMAKE_VERBOSE_MAKEFILE to ON (advanced options) to see the
> >>whole command line. Then you may check the libraries really linked (and
> >>their order). You may also compare the command line with the same
> >>produced by mpicc, it seems mpicc adds some other library you don't.
> >>
> >>With regards,
> >>
> >>O. Svetlik
> >>
> >>michael_cm at gmx.ch wrote:
> >>
> >>>Hi,
> >>>
> >>>I have a problem when trying to compile the following mpi program with
> >>
> >>the
> >>
> >>>CMake generated makefile under Sun Solaris:
> >>>
> >>>-----
> >>>
> >>>#include <iostream>
> >>>#include <string.h>
> >>>#include <stdio.h>
> >>>#include "mpi.h"
> >>>
> >>>
> >>>using std::cout;
> >>>using std::endl;
> >>>
> >>>int main( int argc, char* argv[] )
> >>>{
> >>> int my_rank;
> >>> int p;
> >>> int source;
> >>> int dest;
> >>>
> >>> int tag = 0;
> >>> char message[100];
> >>> MPI_Status status;
> >>>
> >>> MPI_Init(&argc, &argv);
> >>>
> >>> MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
> >>>
> >>> MPI_Comm_size(MPI_COMM_WORLD, &p);
> >>>
> >>> if(my_rank != 0) {
> >>> sprintf(message, "Greetings from process %d!", my_rank);
> >>> dest = 0;
> >>> MPI_Send(message, strlen(message) + 1, MPI_CHAR, dest, tag,
> >>> MPI_COMM_WORLD);
> >>> cout << "message sent" << endl;
> >>> } else {
> >>> cout << "my rank: " << my_rank << endl;
> >>> for (source = 1; source < p; source++) {
> >>> for (long i = 0; i < 1000000000; i++) {
> >>> int a = 0;
> >>> a += a;
> >>> }
> >>> MPI_Recv(message, 100, MPI_CHAR, MPI_ANY_SOURCE, tag,
> >>> MPI_COMM_WORLD, &status);
> >>> cout << message << endl;
> >>> }
> >>> }
> >>>
> >>>
> >>> MPI_Finalize();
> >>> return 0;
> >>>}
> >>>
> >>>-----
> >>>
> >>>I get to following error messages:
> >>>
> >>>-----
> >>>Building executable /home/kuhnmi/DA/Binary/MPITest/MPITest...
> >>>Undefined first referenced
> >>> symbol in file
> >>>xdr_short
> >>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(bswap2.o)
> >>>getsockname
> >>>
> >>
> >
>
/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_util.o)
> >
> >>>xdr_u_char
> >>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(bswap2.o)
> >>>listen
> >>>
> >>
> >
>
/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_util.o)
> >
> >>>xdr_opaque
> >>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(bswap2.o)
> >>>xdr_float
> >>>
> >>
>
>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_sr.o)
> >>
> >>>xdr_u_long
> >>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(bswap2.o)
> >>>xdr_u_int
> >>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(bswap2.o)
> >>>sched_yield
> >>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_tsr.o)
> >>>connect
> >>>
> >>
> >
>
/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_util.o)
> >
> >>>shutdown
> >>>
> >>
>
>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_sr.o)
> >>
> >>>xdr_long
> >>>
> >>
>
>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_sr.o)
> >>
> >>>gethostbyname
> >>>
> >>
> >
>
/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_util.o)
> >
> >>>accept
> >>>
> >>
> >
>
/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_util.o)
> >
> >>>sendto
>
>>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_utils.o)
> >>>getsockopt
> >>>
> >>
> >
>
/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_util.o)
> >
> >>>xdr_double
> >>>
> >>
>
>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_sr.o)
> >>
> >>>xdr_u_short
> >>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(bswap2.o)
> >>>getpeername
> >>>
> >>
> >
>
/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_util.o)
> >
> >>>xdr_int
> >>>
> >>
>
>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_sr.o)
> >>
> >>>socketpair
>
>>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_utils.o)
> >>>xdr_char
> >>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(bswap2.o)
> >>>socket
>
>>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_utils.o)
> >>>xdrmem_create
> >>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(bswap2.o)
> >>>setsockopt
> >>>
> >>
> >
>
/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_util.o)
> >
> >>>inet_ntoa
> >>>
> >>
> >
>
/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_util.o)
> >
> >>>bind
> >>>
> >>
> >
>
/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_util.o)
> >
> >>>recv
> >>>
> >>
> >
>
/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_util.o)
> >
> >>>xdr_array
> >>>
> >>
>
>>/usr/pack/mpich-1.2.5-mo/sun4u-sun-solaris2.8/lib/libmpich.a(p4_sock_sr.o)
> >>
> >>>ld: fatal: Symbol referencing errors. No output written to
> >>>/home/kuhnmi/DA/Binary/MPITest/MPITest
> >>>collect2: ld returned 1 exit status
> >>>make[1]: *** [/home/kuhnmi/DA/Binary/MPITest/MPITest] Error 1
> >>>make: *** [default_target] Error 2
> >>>
> >>>-----
> >>>
> >>>I can compile the same program under Windows with the CMake-generated
> >>
> >>Visual
> >>
> >>>Studio workspace and I can compile it under Sun Solaris with mpiCC. Can
> >>>somebody explain me what I'm doing wrong or what I could do to find out
> >>
> >>what
> >>
> >>>is going wrong? The CMakeLists.txt-File I'm using looks as follows:
> >>>
> >>>-----
> >>>
> >>>PROJECT(MPITest)
> >>>
> >>>FIND_PACKAGE(MPI)
> >>>
> >>>INCLUDE_DIRECTORIES(${MPI_INCLUDE_PATH})
> >>>
> >>>ADD_EXECUTABLE(MPITest MPITest.cxx)
> >>>
> >>>TARGET_LINK_LIBRARIES(
> >>> MPITest
> >>> ${MPI_LIBRARY}
> >>>)
> >>>
> >>>-----
> >>>
> >>>Thanks,
> >>>
> >>>Michael
> >>>
> >>>_______________________________________________
> >>>Cmake mailing list
> >>>Cmake at www.cmake.org
> >>>http://www.cmake.org/mailman/listinfo/cmake
> >>
> >>--
> >>programátor - vedoucàtýmu
> >>.................................................................
> >>Kerio Technologies
> >>Anglické nábÃ
â¢eÃ
¾Ã 1, 301 49 PlzeÃ
Ë
> >>tel. 377 338 901, fax 377 338 921
> >>www.kerio.cz www.winroute.cz
> >>.................................................................
> >>
> >
> >
>
> --
> programátor - vedoucà týmu
> .................................................................
> Kerio Technologies
> Anglické nábÅežà 1, 301 49 PlzeÅ
> tel. 377 338 901, fax 377 338 921
> www.kerio.cz www.winroute.cz
> .................................................................
>
More information about the Cmake
mailing list