[petsc-users] strange linking problem

Barry Smith bsmith at mcs.anl.gov
Wed Jun 20 16:27:09 CDT 2012


   I cannot find SAMappingInitializePackage in PETSc. 

    This option 
> -with-c-support 

means that PETSc is compiled with the C++ compiler but without C++ name mangling turned on (so that functions can be called from code compiled with the C compiler).  There is rarely a need to use this option since if you want to use PETSc from C just build it with the C compiler. 

   Why are you using this option?

   Now your problem comes up because whoever provided SAMappingInitializePackage did not do it correctly. Likely the prototype for it does not wrap it in extern C so that when called it gets mangled but when the code is compiled it does not mangle.

   Please switch to petsc-3.3 where fortunately all that SAMappingInitializePackage has been removed and the problem will go away.

   Barry

The person who put this incorrect SAMappingInitializePackage no longer has write access to PETSc source code so cannot cause these problems again in the future.




On Jun 20, 2012, at 3:52 AM, Juha Jäykkä wrote:

> Dear list,
> 
> I have a strange linking problem with libpetsc.so. After running 'make 
> PETSC_DIR=$(pwd) PETSC_ARCH=linux-gnu-cxx-opt all', the library looks like 
> this:
> 
> ~> nm linux-gnu-cxx-opt/lib/libpetsc.so|grep SAMappingInitializePackage
> 000000000048b4fe T SAMappingInitializePackage
>                 U _Z26SAMappingInitializePackagePKc
> 00000000006060b0 r _ZZ26SAMappingInitializePackageE8__func__
> 
> And, of course, make install will not fix it and therefore make test fails and 
> all programs using it fail.
> 
> Any ideas what could be causing this? It looks to me as if part of the code 
> was compiled with mpicxx and got the names mangled in C++ fashion (hence 
> _Z26SAMappingInitializePackagePKc) but for other parts, mpicc was used (hence 
> no mangling and SAMappingInitializePackage). But why?
> 
> I have --CC=mpicc.openmpi-gcc-1.4.4 --CXX=mpicxx.openmpi-gcc-1.4.4 on the 
> congfigure line, so the compilers should be fine. The complete configure line 
> is:
> 
> ./configure --prefix=${PREFIX}/petsc --with-shared-libraries --with-
> debugging=0 --with-fortran=0 --with-clanguage=C++ --with-dynamic-loading --
> with-c-support --useThreads=0 --with-mpi-shared=1 --with-hdf5=1 --with-gnu-
> compilers=1 --with-vendor-compilers=\[pathscale,intel\] --with-hdf5-
> dir=${HDF5_DIR} --with-petsc-arch=linux-gnu-cxx-opt --CC=mpicc.openmpi-
> gcc-1.4.4 --CXX=mpicxx.openmpi-gcc-1.4.4
> 
> and is the exact same line as I have used on numerous other machines, too.
> 
> Any ideas what's wrong or how to debug this?
> 
> Cheers,
> Juha



More information about the petsc-users mailing list