Hi,<br><br>[--with-shared=0, and do not use --with-dyanmic]<br>I compiled petsc and link the static lib with my makefile<br><span style="color: rgb(255, 0, 0);">"ADDLIBSTATIC := $(ADDLIBSTATIC) $(PETSC_LIBDIR)/</span><div>
<span style="color: rgb(255, 0, 0);">libpetsccontrib.a
$(PETSC_LIBDIR)/libpetscksp.a $(PETSC_LIBDIR)/libpetscsnes.a
$(PETSC_LIBDIR)/libpetscvec.a $(PETSC_LIBDIR)/libpetsc.a
$(PETSC_LIBDIR)/libpetscdm.a $(PETSC_LIBDIR)/libpetscmat.a
$(PETSC_LIBDIR)/libpetscts.a"</span><br>The result was the same as before. So I really wonder how to link petsc with static library? This is useful when I could not generate shared library. <br>Tomorrow morning I will try the <b>setCompilers.py </b>that you sent me for avoiding the error of -PIC. it is 00:37, I will go to sleep. <br>
See you tomorrow. Good night.<br>yours sincerely<br>Weidong<br></div><br><br><div class="gmail_quote">On Tue, Mar 10, 2009 at 10:53 PM, Satish Balay <span dir="ltr"><<a href="mailto:balay@mcs.anl.gov" target="_blank">balay@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><br>
<br>
On Tue, 10 Mar 2009, Wei-Dong Lian wrote:<br>
<br>
</div><div>> Now I also found a problem for my computer about using petsc.<br>
> In my computer, petsc can be compiled successfully without any problem. So I<br>
> use the *.so library to link into my programme, it worked very well. But<br>
> today I just have a try to link *.a library into my programme and it can not<br>
> be compiled successfully.<br>
<br>
</div>Why do you want to do this? [When shared libraries exist - the<br>
compiler prefers then - instead of static. So you should just stick<br>
with the compiler default behavior. And if build PETSc with<br>
--with-dynamic - then the .a files are useless anyway.]<br>
<br>
So the shared vs static usage should be chosen at PETSc configure step.<br>
[--with-shared=1/0, and do not use --with-dyanmic]<br>
<br>
<br>
So you should just use:<br>
<div><br>
ADDLIB := $(ADDLIB) -L$(PETSC_LIBDIR) -Wl,-rpath,$(PETSC_LIBDIR)<br>
</div>-lpetsccontrib -lpetscts -lpetscsnes -lpetscksp -lpetscdm<br>
-lpetscmat -lpetscvec -lpetsc<br>
<font color="#888888"><br>
<br>
Satish<br>
</font></blockquote></div><br>