[petsc-dev] petsc/master: unable to link in C++ with last night PETSC_WITH_EXTERNAL_LIB variable changes

Éric Chamberland Eric.Chamberland at giref.ulaval.ca
Sat Feb 10 14:25:09 CST 2018


ok, let put our in-house code away, simply try this simple example:

----------

#include <mpi.h>

int main() {
/*empty!! let's see the .o */

return 1;

}
---------

then:

g++ -c test.cc -I/opt/openmpi-1.10.2/include -o test.o

nm -C test.o | grep "MPI::" | grep " U "

                  U MPI::Win::Free()
                  U MPI::Comm::Comm()
                  U MPI::Datatype::Free()

so: as soon you are compiling a c++ file with this openmpi 1.10.2 (even 
if you use gcc -c test.cc -I/opt/openmpi-1.10.2/include -o test.o in my 
example) it *requires* you to link with mpi_cxx lib...

That's the "problem", that's *my* fault to have relied on a PETSC 
variable to link with an mpi c++ lib....

So I will add the mpi_cxx lib to our makefiles for these older versions 
of mpi...

Sorry for the annoyance...

But, as usual, thanks for your fast responses guys, you all deserve a 
gold medal!!! :)

Eric


Le 18-02-10 à 14:37, Jed Brown a écrit :
> "Smith, Barry F." <bsmith at mcs.anl.gov> writes:
>
>>     Then the testing is more involved, need to first check if C++ bindings exist and then check if supplied automatically by compilers (like on Cray). Annoying, I'd prefer to avoid but I still don't have the definitive word if C++ bindings are the issue from Eric.
> The undefined symbols are C++ bindings and they are referenced from a
> source file named StatistiqueMemoire.* which is not part of PETSc or a
> PETSc dependency.  We don't reference them so we shouldn't try to link
> them.



More information about the petsc-dev mailing list