[mpich-discuss] MPI static library link problem.

Anatoly G anatolyrishon at gmail.com
Thu Jan 5 02:59:06 CST 2017


Hi Yanfei ,

It works.
Thank you very much.
I should review my compile / link flags.

Regards,
Anatoly.

On Wed, Jan 4, 2017 at 10:38 PM, Guo, Yanfei <yguo at anl.gov> wrote:

> Hi Anatoly,
>
> I tried you example and cannot reproduce the problem. I saw your compile
> and link command has many options that are redundant. mpicxx will give the
> essential options for compile and link with MPICH (see `mpicxx –show`).
>
> Can you try compile and link it with simple options (like the following
> commands)?
>
>   mpicxx –o mpi_hello_world.o –c mpi_hello_world.cpp
>   mpicxx –o mpi_hello_world mpi_hello_world.o
>
> Yanfei Guo
> Postdoctoral Researcher
> MCS Division, ANL
>
>
> On 1/4/17, 2:12 AM, "Anatoly G" <anatolyrishon at gmail.com> wrote:
>
>     Hi Yanfei ,
>
>
>     Test file attached.
>
>
>     compile command:
>     /mpis/Mpich-3.2/mpich-3.2/Ubuntu14.04/bin/mpicxx -c
> -ftemplate-depth-200 -Wall -Wno-reorder -Wno-comment -Wno-unknown-pragmas
> -Wno-unused -Wno-non-virtual-dtor -W -fPIC -g -O2
> -I/mpis/Mpich-3.2/mpich-3.2/Ubuntu14.04/include -o ./mpi_hello_world.o
> ./mpi_hello_world.cpp
>      -MMD
>
>
>     link command:
>     /mpis/Mpich-3.2/mpich-3.2/Ubuntu14.04/bin/mpicxx
> -L/usr/lib/x86_64-linux-gnu/ -L/usr/lib/ -Wl,-rpath=/usr/lib -lcurses -lnsl
> -lpthread -ldl -lrt -rdynamic -o ./mpi_hello_world ./mpi_hello_world.o
> -L/usr/lib/x86_64-linux-gnu/ -lpthread
>
>
>
>     mpich-3.1
>     compile and link pass without any warning or errors.
>
>
>
>     mpich-3.2
>
>
>     * Program pass compile and link.
>
>     * if you will remove comment from line with MPI_Recv, link will fail.
>
>
>
>
>
>     Please advice,
>     Anatoly.
>
>
>
>
>     On Tue, Jan 3, 2017 at 8:22 PM, Guo, Yanfei
>     <yguo at anl.gov> wrote:
>
>     Hi Anatoly,
>
>     It looks like a linking order problem at the first glance. How did you
> compile and link using the static library?
>
>     Yanfei Guo
>     Postdoctoral Researcher
>     MCS Division, ANL
>
>
>     On 1/3/17, 8:20 AM, "Anatoly G" <anatolyrishon at gmail.com> wrote:
>
>         Dear MPICH,
>
>
>         I use MPICH 3.2 configured (without shared libraries):
>         ./configure --prefix=/mpis/Mpich-3.2/mpich-3.2/Ubuntu14.04
> --enable-error-checking=runtime --enable-g=dbg CFLAGS=-fPIC
> CXXFLAGS=-fPIC FFLAGS=-fpic --enable-threads=runtime --enable-totalview
>         --enable-shared=no --disable-fortran
>
>
>
>         When I try to compile my program I get linkage errors:
>         /mpis/Mpich-3.2/mpich-3.2/Ubuntu14.04/lib/libmpicxx.a(initcxx.o):
> In function `MPI::File::Create_errhandler(void (*)(MPI::File&, int*,
> ...))':
>         /mpis/Mpich-3.2/mpich_3.2_config/mpich-3.2/src/binding/cxx/initcxx.cxx:693:
> undefined reference to `MPIR_Errhandler_set_cxx'
>         /mpis/Mpich-3.2/mpich-3.2/Ubuntu14.04/lib/libmpicxx.a(initcxx.o):
> In function `MPI::Comm::Create_errhandler(void (*)(MPI::Comm&, int*,
> ...))':
>         /mpis/Mpich-3.2/mpich_3.2_config/mpich-3.2/src/binding/cxx/initcxx.cxx:704:
> undefined reference to `MPIR_Errhandler_set_cxx'
>         /mpis/Mpich-3.2/mpich-3.2/Ubuntu14.04/lib/libmpicxx.a(initcxx.o):
> In function `MPI::Win::Create_errhandler(void (*)(MPI::Win&, int*, ...))':
>         /mpis/Mpich-3.2/mpich_3.2_config/mpich-3.2/src/binding/cxx/initcxx.cxx:714:
> undefined reference to `MPIR_Errhandler_set_cxx'
>         /mpis/Mpich-3.2/mpich-3.2/Ubuntu14.04/lib/libmpicxx.a(initcxx.o):
> In function `MPI::Comm::Create_keyval(int (*)(MPI::Comm const&, int, void*,
> void*, void*, bool&), int (*)(MPI::Comm&, int, void*, void*), void*)':
>         /mpis/Mpich-3.2/mpich_3.2_config/mpich-3.2/src/binding/cxx/initcxx.cxx:510:
> undefined reference to `MPIR_Keyval_set_proxy'
>         /mpis/Mpich-3.2/mpich-3.2/Ubuntu14.04/lib/libmpicxx.a(initcxx.o):
> In function `MPI::Datatype::Create_keyval(int (*)(MPI::Datatype const&,
> int, void*, void*, void*, bool&), int (*)(MPI::Datatype&, int, void*,
> void*), void*)':
>         /mpis/Mpich-3.2/mpich_3.2_config/mpich-3.2/src/binding/cxx/initcxx.cxx:574:
> undefined reference to `MPIR_Keyval_set_proxy'
>         /mpis/Mpich-3.2/mpich-3.2/Ubuntu14.04/lib/libmpicxx.a(initcxx.o):
> In function `MPI::Win::Create_keyval(int (*)(MPI::Win const&, int, void*,
> void*, void*, bool&), int (*)(MPI::Win&, int, void*, void*), void*)':
>         /mpis/Mpich-3.2/mpich_3.2_config/mpich-3.2/src/binding/cxx/initcxx.cxx:638:
> undefined reference to `MPIR_Keyval_set_proxy'
>         /mpis/Mpich-3.2/mpich-3.2/Ubuntu14.04/lib/libmpicxx.a(initcxx.o):
> In function `MPI::Op::Init(void (*)(void const*, void*, int, MPI::Datatype
> const&), bool)':
>         /mpis/Mpich-3.2/mpich_3.2_config/mpich-3.2/src/binding/cxx/initcxx.cxx:393:
> undefined reference to `MPIR_Op_set_cxx'
>         /mpis/Mpich-3.2/mpich-3.2/Ubuntu14.04/lib/libmpicxx.a(initcxx.o):
> In function `MPI::Comm::Reduce_scatter_block(void const*, void*, int,
> MPI::Datatype const&, MPI::Op const&) const':
>         /mpis/Mpich-3.2/mpich_3.2_config/mpich-3.2/./src/binding/cxx/mpicxx.h:1490:
> undefined reference to `MPI_Reduce_scatter_block'
>         collect2: error: ld returned 1 exit status
>
>
>
>         When I configure MPI with shared libraries:
>         ./configure --prefix=/mpis/Mpich-3.2/mpich-3.2/Ubuntu14.04
> --enable-error-checking=runtime --enable-g=dbg CFLAGS=-fPIC
> CXXFLAGS=-fPIC FFLAGS=-fpic --enable-threads=runtime --enable-totalview
> --disable-fortran
>
>
>
>         my program's build completed correctly.
>
>
>         When I used MPICH 3.1 I didn't see these problems.
>         Can you please advice?
>
>
>         Regards,
>         Anatoly.
>
>
>
>
>
>
>
>     _______________________________________________
>     discuss mailing list     discuss at mpich.org
>     To manage subscription options or unsubscribe:
>     https://lists.mpich.org/mailman/listinfo/discuss
>
>
>
>
>
>
>
> _______________________________________________
> discuss mailing list     discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20170105/2ce13483/attachment.html>
-------------- next part --------------
_______________________________________________
discuss mailing list     discuss at mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss


More information about the discuss mailing list