link error

Yixun Liu enjoywm at cs.wm.edu
Wed Feb 11 20:57:05 CST 2009


Satish Balay wrote:
> This truncated message is not useful...  Please send complete compile
> commands - when encountering compile errors.
>
> Which PETSc example is this? Are you using a PETSc makefile?
>
> Satish
>
> On Wed, 11 Feb 2009, Yixun Liu wrote:
>
>   
>> Hi,
>> I compile petsc successfully, but when I run a simple petsc example,
>> some errors appear. It seems that I miss x11 lib.
>>
>> /home/scratch/yixun/petsc-3.0.0-p3/linux-gnu-c-debug/lib/libpetsc.a(xops.o):
>> In function `PetscDrawLine_X':
>> /home/scratch/yixun/petsc-3.0.0-p3/src/sys/draw/impls/x/xops.c:29:
>> undefined reference to `XSetForeground'
>> /home/scratch/yixun/petsc-3.0.0-p3/src/sys/draw/impls/x/xops.c:32:
>> undefined reference to `XDrawLine'
>> /home/scratch/yixun/petsc-3.0.0-p3/linux-gnu-c-debug/lib/libpetsc.a(xops.o):
>> In function `PetscDrawPoint_X':
>> /home/scratch/yixun/petsc-3.0.0-p3/src/sys/draw/impls/x/xops.c:45:
>> undefined reference to `XSetForeground'
>> /home/scratch/yixun/petsc-3.0.0-p3/src/sys/draw/impls/x/xops.c:46:
>> undefined reference to `XDrawPoint'
>>
>>
>> Thanks.
>>
>>     
>  I can successfully compile the example with PETSC makefile. However, I need integrate PETSC into an existing application, which use CMake to generate makefile. I add the following into CMakelist.txt and use CMake to generate makefile and then make.
>   
#----------
# PETSc
#----------
SET(PETSC_DIR /home/scratch/yixun/petsc-3.0.0-p3)
SET(PETSC_ARCH /linux-gnu-c-debug)
SET(X11_DIR /usr/X11R6)
SET(PETSC_INCLUDE_DIR ${PETSC_DIR}/include
${PETSC_DIR}/${PETSC_ARCH}/include)
SET(PETSC_LIB_DIR ${PETSC_DIR}/${PETSC_ARCH}/lib ${X11_DIR}/lib64
${X11_DIR}/lib/X11)



Thanks.



More information about the petsc-users mailing list