[petsc-users] problem linking(?) a third party fortran code that uses petsc

Diana Valencia valencia at astro.utoronto.ca
Thu Sep 24 19:54:37 CDT 2015


Hi
Yes, I was missing a make variable (linking to the  conf/variables directory).
thank you very much!
Diana

_______________________
Diana Valencia
Assistant Professor,  Physics & Astrophysics
Department of Physical and Environmental Sciences 
University of Toronto, Scarborough
1265 Military Trail, Toronto, ON, Canada, M1C 1A4
Voice 416 208-2986

> On Sep 24, 2015, at 8:42 PM, Matthew Knepley <knepley at gmail.com> wrote:
> 
> On Thu, Sep 24, 2015 at 7:39 PM, Diana Valencia <valencia at astro.utoronto.ca <mailto:valencia at astro.utoronto.ca>> wrote:
> Thanks for the response.  In compiling the subroutines, one that uses petsc is compiled successfully with:
> 
> gfortran  -fdefault-real-8 -fdefault-double-8  -w -O2    -I /Users/valencia/software/petsc/petsc-3.2-p7/arch-darwin-c-opt/include -c PETScimple_mod.f90
> 
> Yes, this is _compilation_, and it was successful. However, in order for the _link_ to be successful, you
> will need the PETSc library on the link line. I am guessing that there is a make variable you must define.
> 
> I am Cc'ing one of the people at ETH since I think that place is responsible for this irresponsible build system.
> 
>    Matt
>  
> _______________________
> Diana Valencia
> Assistant Professor,  Physics & Astrophysics
> Department of Physical and Environmental Sciences 
> University of Toronto, Scarborough
> 1265 Military Trail, Toronto, ON, Canada, M1C 1A4
> Voice 416 208-2986 <tel:416%20208-2986>
>> On Sep 24, 2015, at 8:34 PM, Matthew Knepley <knepley at gmail.com <mailto:knepley at gmail.com>> wrote:
>> 
>> On Thu, Sep 24, 2015 at 7:21 PM, Diana Valencia <valencia at astro.utoronto.ca <mailto:valencia at astro.utoronto.ca>> wrote:
>> Hi,
>> 
>> 
>> I am trying to compile a third party software written in fortran90 that uses petsc.  There is the option of compiling the code with or without petsc.  Without it I have no problems, however when I use petsc, I encounter this:
>> 
>> After building the subroutines the error is:
>> 
>> Nowhere in this link line do I see -lpetsc. Are you sure you have this build system configured correctly?
>> 
>>    Matt
>>  
>> gfortran  -fdefault-real-8 -fdefault-double-8  -w -O2    -o stagyy main.o advdif.o communication.o continents.o evocore.o geometry.o init.o io.o iter.o melting.o miscellaneous.o MPDATA.o multi.o refstate.o phase_change.o poisson.o prolongate_restrict.o relax_all.o relax_cell.o relax_point.o residues.o tracers.o v_advection.o vee_cycle.o viscosity.o  crw.o geoid.o implicit_diffusion.o linpack.o plot.o wrtpng.o  blas123.o lapack.o nxs_dummy.o  PETScimple_mod.o xdmf_hdf5_io_dummy.o bcs_mod.o composition_mod.o control_mod.o continents_mod.o vgrid_mod.o init_mod.o io_mod.o iter_mod.o melting_mod.o meltingfns_mod.o multi_mod.o phase_change_mod.o plot_mod.o precision_mod.o refstat_mod.o stencil_mod.o timestep_mod.o timing_mod.o tracers_mod.o viscosity_mod.o thermochem_mod.o platesLea_mod.o /opt/X11/lib/libpng.dylib   
>> Undefined symbols for architecture x86_64:
>>   "_kspcreate_", referenced from:
>>       ___petscimple_MOD_simplepetsc_create_everything in PETScimple_mod.o
>>   "_kspdestroy_", referenced from:
>>       ___petscimple_MOD_simplepetsc_destroy_everything in PETScimple_mod.o
>>   "_kspgetpc_", referenced from:
>>       ___petscimple_MOD_simplepetsc_solve in PETScimple_mod.o
>>   "_kspsetfromoptions_", referenced from:
>>       ___petscimple_MOD_simplepetsc_solve in PETScimple_mod.o
>>   "_kspsetoperators_", referenced from:
>>       ___petscimple_MOD_simplepetsc_solve in PETScimple_mod.o
>>   "_kspsettype_", referenced from:
>>       ___petscimple_MOD_simplepetsc_solve in PETScimple_mod.o
>>   "_kspsolve_", referenced from:
>>       ___petscimple_MOD_simplepetsc_solve in PETScimple_mod.o
>>   "_matassemblybegin_", referenced from:
>>       ___petscimple_MOD_simplepetsc_solve in PETScimple_mod.o
>>   "_matassemblyend_", referenced from:
>>       ___petscimple_MOD_simplepetsc_solve in PETScimple_mod.o
>>   "_matcreateseqaij_", referenced from:
>>       ___petscimple_MOD_simplepetsc_create_everything in PETScimple_mod.o
>>   "_matdestroy_", referenced from:
>>       ___petscimple_MOD_simplepetsc_destroy_everything in PETScimple_mod.o
>>   "_matsetvalues_", referenced from:
>>       ___petscimple_MOD_simplepetsc_insert_compactrow in PETScimple_mod.o
>>   "_mpi_comm_size_", referenced from:
>>       ___petscimple_MOD_initialize in PETScimple_mod.o
>>   "_pcfactorsetmatsolverpackage_", referenced from:
>>       ___petscimple_MOD_simplepetsc_solve in PETScimple_mod.o
>>   "_pcsettype_", referenced from:
>>       ___petscimple_MOD_simplepetsc_solve in PETScimple_mod.o
>>   "_petscfinalize_", referenced from:
>>       ___petscimple_MOD_finalize in PETScimple_mod.o
>>   "_petscinitialize_", referenced from:
>>       ___petscimple_MOD_initialize in PETScimple_mod.o
>>   "_veccreateseqwitharray_", referenced from:
>>       ___petscimple_MOD_simplepetsc_create_everything in PETScimple_mod.o
>>   "_vecdestroy_", referenced from:
>>       ___petscimple_MOD_simplepetsc_destroy_everything in PETScimple_mod.o
>>   "_vecplacearray_", referenced from:
>>       ___petscimple_MOD_simplepetsc_solve in PETScimple_mod.o
>>   "_vecresetarray_", referenced from:
>>       ___petscimple_MOD_simplepetsc_solve in PETScimple_mod.o
>> ld: symbol(s) not found for architecture x86_64
>> collect2: error: ld returned 1 exit status
>> make: *** [stagyy] Error 1
>> 
>> 
>> 
>> My machine is OS X 10.10 and I am working with 64 bytes.  I configured petsc with the following flags:
>> 
>> ./configure --with-fc=gfortran --with-fortran-datatypes --with-x=0 --download-mpich --download-parmetis --download-superlu --download-superlu_dist --download-blacs --download-scalapack --download-mumps --download-umfpack --download-ml --with-debugging=no --download-f-blas-lapack=yes
>> 
>> Any help is greatly appreciated!!
>> Thanks
>> Diana
>> 
>> 
>> 
>> 
>> 
>> -- 
>> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
>> -- Norbert Wiener
> 
> 
> 
> 
> -- 
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150924/2f3ce9f2/attachment-0001.html>


More information about the petsc-users mailing list