[petsc-users] libpetsc.a(lgc.c.o): In function `PetscDrawLGDraw':lgc.c:469: undefined reference to `XSetIOErrorHandler'

Jed Brown jedbrown at mcs.anl.gov
Thu Oct 17 12:46:27 CDT 2013


When writing the list, please start new threads instead of replying to
old threads.

Ted Sariyski <tsariysk at craft-tech.com> writes:

> At link time, I get a long list of "undefined reference to ..." (see 
> below).
>
> What do I miss here?

When using static libraries, you have to link *all* the libraries:
-lpetsc is not sufficient.  You can use "make getlinklibs" to obtain the
full list.  Put that into Eclipse.

> ex10d: (works fine)
> =================================
> mpicxx -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas 
> -g   -o ex10 ../ex10.c -I/home/tsariysk/MFEM/OMPI/PETSc_real/include 
> -I/home/tsariysk/MFEM/OMPI/PETSc_real/include 
> -I/home/tsariysk/MFEM/OMPI/metis-5.1.0/build/Linux-x86_64/include 
> -I/usr/include -I/usr/include/openmpi-x86_64 
> -L/home/tsariysk/MFEM/OMPI/PETSc_real/lib  -lpetsc -llapack -lblas -lX11 
> -Wl,-rpath,/home/tsariysk/MFEM/OMPI/metis-5.1.0/build/Linux-x86_64/libmetisusr 
> -L/home/tsariysk/MFEM/OMPI/metis-5.1.0/build/Linux-x86_64/libmetisusr 
> -lmetis -lpthread -Wl,-rpath,/usr/lib64 -L/usr/lib64 -lhdf5 -lhdf5_cpp 
> -lhdf5_fortran -lhdf5_hl -lhdf5_hl_cpp -lm -L/usr/lib64/openmpi/lib 
> -L/opt/centos/devtoolset-1.1/root/usr/lib/gcc/x86_64-redhat-linux/4.7.2 
> -L/opt/centos/devtoolset-1.1/root/usr/lib64 
> -L/opt/centos/devtoolset-1.1/root/usr/lib -lmpi_f90 -lmpi_f77 -lgfortran 
> -lm -lgfortran -lm -lquadmath -lm -lmpi_cxx -lstdc++ -ldl -lmpi -lgcc_s 
> -lpthread -ldl

You need all the libraries and paths above.

> ex3p: (eclipse Makefile)
> =================================
> g++ -I/home/tsariysk/MFEM/OMPI/PETSc_real/include 
> -I/home/tsariysk/MFEM/OMPI/PETSc_real/include 
> -I/home/tsariysk/MFEM/OMPI/metis-5.1.0/build/Linux-x86_64/include 
> -I/usr/include -I/usr/include/openmpi-x86_64 -L/usr/lib64/openmpi/lib 
> -L/home/tsariysk/MFEM/OMPI/PETSc_real/lib 
> -L/home/tsariysk/MFEM/OMPI/metis-5.1.0/build/Linux-x86_64/libmetis 
> -L/home/tsariysk/MFEM/OMPI/hypre-2.9.0b/src/hypre/lib -g3 -o "SPHERE"  
> ./mesh/element.o ./mesh/hexahedron.o ./mesh/mesh.o ./mesh/mesquite.o 
> ./mesh/ncmesh.o ./mesh/nurbs.o ./mesh/pmesh.o ./mesh/point.o 
> ./mesh/quadrilateral.o ./mesh/segment.o ./mesh/tetrahedron.o 
> ./mesh/triangle.o ./mesh/vertex.o ./linalg/densemat.o ./linalg/hypre.o 
> ./linalg/matrix.o ./linalg/ode.o ./linalg/operator.o ./linalg/solvers.o 
> ./linalg/sparsemat.o ./linalg/sparsesmoothers.o ./linalg/vector.o 
> ./general/array.o ./general/communication.o ./general/error.o 
> ./general/isockstream.o ./general/osockstream.o ./general/sets.o 
> ./general/socketstream.o ./general/sort_pairs.o ./general/stable3d.o 
> ./general/table.o ./general/tic_toc.o  ./fem/bilinearform.o 
> ./fem/bilininteg.o ./fem/coefficient.o ./fem/eltrans.o ./fem/fe.o 
> ./fem/fe_coll.o ./fem/fespace.o ./fem/geom.o ./fem/gridfunc.o 
> ./fem/intrules.o ./fem/linearform.o ./fem/lininteg.o 
> ./fem/nonlinearform.o ./fem/nonlininteg.o ./fem/pbilinearform.o 
> ./fem/pfespace.o ./fem/pgridfunc.o ./fem/plinearform.o 
> ./fem/pnonlinearform.o  ./sphere.o   -lmpi_cxx -lmpi -ldl -lmetis 
> -lHYPRE -lpetsc

This only does -lpetsc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131017/6d91e7ed/attachment.pgp>


More information about the petsc-users mailing list