[petsc-users] PETSc, C++ and Eclipse

Matt Bockman mdbockma at ucsd.edu
Wed Jul 27 21:21:27 CDT 2011


Hi Berend,

First of all, you have been extremely helpful. Second, I was FINALLY able to
compile the example through Eclipse. Sadly, it's the biggest breakthrough
I've had in the last 2 weeks of my research :(.

Here's what I did:

I tried running what Eclipse was running from a terminal:

Eclipse:
/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/bin/mpicc
-I/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/include
-I/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/include -O0
-g3 -Wall -Wwrite-strings -Wno-strict-aliasing -MMD -MP -MF"ex1.d"
-MT"ex1.d" -o"ex1.o" "../ex1.c"

That did not work. So I ran make ex1 in the original ex1 tutorial directory
and saw what the makefile was doing there:

/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/bin/mpicc
-o ex1.o -c -Wall -Wwrite-strings -Wno-strict-aliasing -g3
-I/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/src/dm/mesh/sieve
-I/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/include
-I/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/include
-I/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/include
-D__INSDIR__=src/ksp/ksp/examples/tutorials/ ex1.c

/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/bin/mpicc
-Wall -Wwrite-strings -Wno-strict-aliasing -g3  -o ex1 ex1.o
-Wl,-rpath,/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/lib
-L/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/lib
-lpetsc   -lX11
-Wl,-rpath,/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/lib
-L/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/lib
-lflapack -lfblas -lnsl -lrt -lm
-L/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/lib
-L/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2
-L/usr/lib/x86_64-linux-gnu -ldl -lmpich -lpthread -lrt -lgcc_s -lmpichf90
-lgfortran -lm -lm -ldl -lmpich -lpthread -lrt -lgcc_s -ldl

So apparently it was making an object file then linking. I then compared the
one from Eclipse and found that I was missing
-I/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/src/dm/mesh/sieve.
Why I need this I do not know (ideas?).

But, after I found that I added it to my Include Directories and it
compiled!

Thanks Berend and others, I appreciate your persistence and aid.

Matt

On Wed, Jul 27, 2011 at 6:28 PM, Berend van Wachem <
b.van-wachem at imperial.ac.uk> wrote:

> Dear Matt,
>
> I can't directly see anything wrong with your settings.
>
> Have you tried compiling your example outside of eclipse with the PETSc
> makefile system?
>
> The previous pastebin output you emailed me does suggest that the error is
> during the compile stage: it cannot find the correct headers describing the
> implementations of PetscInitialize etc.
>
> Have you tried using the mpicc outside of eclipse directly on the
> directory?
>
> /home/mdbockman/Documents/**Research/codes/petsc/petsc-3.**
> 1-p8/linux-gnu-c-debug/bin/**mpicc -I"/home/mdbockman/Documents/**
> Research/codes/petsc/petsc-3.**1-p8/include" -I"/home/mdbockman/Documents/
> **Research/codes/petsc/petsc-3.**1-p8/linux-gnu-c-debug/**include" -O0 -g3
> -Wall -Wwrite-strings -Wno-strict-aliasing -MMD -MP -MF"ex1.d" -MT"ex1.d"
> -o"ex1.o" "../ex1.c"
>
> within the eclipse directory? This way you can more easily play around with
> it to see what is the problem.
>
> I'm sorry I can't be of more help.
>
> Regards,
> Berend.
>
>
>
> On 07/28/2011 02:20 AM, Matt Bockman wrote:
>
>> Hi Berend,
>>
>> Under Library search path I have:
>>
>> /home/mdbockman/Documents/**Research/codes/petsc/petsc-3.**
>> 1-p8/linux-gnu-c-debug/lib
>>
>> For libraries I have:
>>
>> petsc
>> X11
>> flapack
>> fblas
>> nsl
>> rt
>> m
>> dl
>> mpich
>> pthread
>> rt
>> gcc_s
>> mpichf90
>> gfortran
>> m
>> m
>> dl
>> mpich
>> rt
>> gcc_s
>> dl
>>
>> I used the exact order as I found in petscmachineinfo.h file (see here:
>> http://pastebin.com/cqzNgjJe)
>>
>> Thank you very much for your help Berend,
>> Matt
>>
>> On Wed, Jul 27, 2011 at 6:11 PM, Berend van Wachem
>> <b.van-wachem at imperial.ac.uk <mailto:b.van-wachem at imperial.**ac.uk<b.van-wachem at imperial.ac.uk>>>
>> wrote:
>>
>>    Dear Matt,
>>
>>
>>    What do you have under
>>    Properties->C/C++ Build -> Settings -> GCC Linker Libraries for both
>>    "Libraries" and "Library Search Path"?
>>
>>    Regards,
>>    Berend.
>>
>>
>>
>>    On 07/28/2011 02:04 AM, Matt Bockman wrote:
>>
>>        Hi Berend,
>>
>>        Under Properties->C/C++ Build -> Settings -> GCC C Compiler ->
>>        Directories : Include paths (-I) I have:
>>
>>        /home/mdbockman/Documents/__**Research/codes/petsc/petsc-3._**
>> _1-p8/include
>>        /home/mdbockman/Documents/__**Research/codes/petsc/petsc-3._**
>> _1-p8/linux-gnu-c-debug/**include
>>
>>        Under Properties -> C/C++ BUild -> Environment -> I have
>>
>>        PETSC_ARCH = linux-gnu-c-debug
>>        PETSC_DIR =
>>        /home/mdbockman/Documents/__**Research/codes/petsc/petsc-3._**
>> _1-p8
>>
>>        In my source file I have included petsc.h:
>>
>>        #include "petsc.h"
>>
>>        Thanks,
>>        Matt
>>
>>        On Wed, Jul 27, 2011 at 5:54 PM, Berend van Wachem
>>        <b.van-wachem at imperial.ac.uk
>>        <mailto:b.van-wachem at imperial.**ac.uk<b.van-wachem at imperial.ac.uk>
>> >
>>        <mailto:b.van-wachem at imperial.**__ac.uk
>>        <mailto:b.van-wachem at imperial.**ac.uk<b.van-wachem at imperial.ac.uk>>>>
>> wrote:
>>
>>        Dear Matt,
>>
>>        The error is definitely in the compiler stage: it cannot find that
>>        appropriate petsc.h include file.
>>        1. Have you included petsc.h in the source file?
>>        2. What do you have under
>>        <Your Project> -> Settings -> Includes
>>        ?
>>
>>        Also, just to make sure, you can set the appropriate values for
>>        PETSC_DIR and PETSC_ARCH if you wish under
>>        <Your Project> -> Settings -> Environment
>>
>>        Regards,
>>
>>        Berend.
>>
>>
>>
>>        On 07/28/2011 01:49 AM, Matt Bockman wrote:
>>
>>        Hi Berend,
>>
>>        Here is the complete output of the build:
>>
>>        http//pastebin.com/Es4ms4EF <http://pastebin.com/Es4ms4EF>
>>        <http://pastebin.com/Es4ms4EF>
>>
>>
>>        and by the 2nd to last line "collect2: ld returned 1 exit status" I
>>        believe it is failing during the linking step. I'm not 100% sure
>>        though.
>>
>>        Thanks for your quick response and help. Please advise,
>>
>>        Matt
>>
>>        On Wed, Jul 27, 2011 at 5:39 PM, Berend van Wachem
>>        <b.van-wachem at imperial.ac.uk <mailto:b.van-wachem at imperial.**ac.uk<b.van-wachem at imperial.ac.uk>
>> >
>>        <mailto:b.van-wachem at imperial.**__ac.uk
>>        <mailto:b.van-wachem at imperial.**ac.uk<b.van-wachem at imperial.ac.uk>
>> >>
>>        <mailto:b.van-wachem at imperial.
>>        <mailto:b.van-wachem at imperial.**>____ac.uk <http://ac.uk>
>>        <mailto:b.van-wachem at imperial.**__ac.uk
>>        <mailto:b.van-wachem at imperial.**ac.uk<b.van-wachem at imperial.ac.uk>>>>>
>> wrote:
>>
>>        Dear Matt,
>>
>>        Does it say this during the compiling? Or linking?
>>
>>        If it says this during the compiling, it means that eclipse cannot
>>        find the PETSc header files. So, it must be the setting of the
>>        "Includes". You might want to "hard-code" the directory, just to
>>        make sure.
>>
>>        It is indeed not completely straightforward - eclipse has so many
>>        options. But trust me - many of them you will really learn to
>>        appreciate over time.
>>
>>        Kind regards,
>>
>>        Berend.
>>
>>
>>
>>        On 07/28/2011 01:34 AM, Matt Bockman wrote:
>>
>>        Thanks Berend for your thorough response,
>>
>>        I have done what you have said but I still get the same error
>>        regarding
>>        "undefined references to PetscInitialize" etc. It's like I didn't
>>        include the petscksp.h file, but it's there. I even tried
>>        petsc.h to no
>>        avail.
>>
>>        I'm not sure what the compiler is referring to when it says
>>        "Undefined
>>        references to ...". What I think this is is in the assembly code
>>        generated by the compiler, there is a PetscInitialize symbol
>>        that isn't
>>        found in the library. But I'm soooooooooo confused at this point
>>        :(. How
>>        did you guys all learn how to compile this?
>>
>>        Matt
>>
>>        On Wed, Jul 27, 2011 at 4:46 PM, Berend van Wachem
>>        <b.van-wachem at imperial.ac.uk
>>        <mailto:b.van-wachem at imperial.**ac.uk<b.van-wachem at imperial.ac.uk>
>> >
>>        <mailto:b.van-wachem at imperial.**__ac.uk
>>        <mailto:b.van-wachem at imperial.**ac.uk<b.van-wachem at imperial.ac.uk>
>> >>
>>        <mailto:b.van-wachem at imperial.
>>        <mailto:b.van-wachem at imperial.**>____ac.uk <http://ac.uk>
>>        <mailto:b.van-wachem at imperial.**__ac.uk
>>        <mailto:b.van-wachem at imperial.**ac.uk<b.van-wachem at imperial.ac.uk>
>> >>>
>>        <mailto:b.van-wachem at imperial <mailto:b.van-wachem at imperial>**.
>>        <mailto:b.van-wachem at imperial
>>        <mailto:b.van-wachem at imperial>**.__>____ac.uk <http://ac.uk>
>>        <http://ac.uk>
>>
>>        <mailto:b.van-wachem at imperial.
>>        <mailto:b.van-wachem at imperial.**>____ac.uk <http://ac.uk>
>>        <mailto:b.van-wachem at imperial.**__ac.uk
>>        <mailto:b.van-wachem at imperial.**ac.uk<b.van-wachem at imperial.ac.uk>>>>>>
>> wrote:
>>
>>        Dear Matt,
>>
>>        I use Eclipse and have eclipse make the makefiles.
>>        It is just a matter of indicating to eclipse where the PETSc
>>        headers/libraries are to be found, so if you have a C project which
>>        needs PETSc headers and libraries:
>>
>>        To do this, click on your managed C project with the right sided
>>        mouse button, select
>>
>>        Properties -> C/C++ Build -> Settings
>>
>>        Then you get a new window with on the right hand side the various
>>        setting options.
>>
>>        Select Includes, and add the required PETSc paths. In my case I
>> have
>>        added
>>        ${PETSC_DIR}/include
>>        ${PETSC_DIR}/${PETSC_ARCH}/___**_____include
>>
>>        Then select "Libraries" under the header Linker
>>        and you should set the Library search path:
>>        ${PETSC_DIR}/${PETSC_ARCH}/lib
>>
>>        and then the libraries, in my case:
>>        m, petsc, stdc++, mpichxx, mpich, lapack, blas, gfortran, dl,
>>        rt,gcc_s, pthread, X11
>>        (you can find these easily in
>>        $PETSC_DIR/$PETSC_ARCH/_______**_petscmachineinfo.h)
>>
>>        The nice thing is that in eclipse you can easily switch between
>>        Debug/Release code, traverse into the PETSc source code etc. It's
>>        really a very productive tool with PETSc I've found.
>>
>>        Let me know if you have any questions.
>>
>>        Kind regards,
>>
>>        Berend.
>>
>>
>>
>>        On 07/27/2011 11:25 PM, Matt Bockman wrote:
>>
>>        Thanks everyone for the help,
>>
>>        I was able to compile a single example in Eclipse using the
>> provided
>>        makefile. I'm pretty new to makefiles so it's a LOT to digest.
>>        I'm now
>>        manually creating a makefile for my project in Eclipse (and I've
>> set
>>        Eclipse up to use a makefile that I create instead of automatically
>>        generating one). Unfortunately this is a big pain but since I can't
>>        figure out how to make Eclipse automatically include a few files
>>        in the
>>        makefile I don't really have any other choices :(.
>>
>>        Thanks again,
>>        Matt
>>
>>        On Wed, Jul 27, 2011 at 1:43 PM, Mohammad Mirzadeh
>>        <mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>>>**>__>
>> wrote:
>>
>>        There two problems(I think) in this code.
>>
>>        1) there is no main function in your source code. If this is the
>>        only file you are compiling, you need to change the function name
>> to
>>        main.
>>        2) linking should be done after object files are created. A simple
>>        g++ call would first compile the main file and then link the object
>>        to the petsc lib i.e
>>
>>        g++ -c -I($PETSC_INCLUDE) main.cpp
>>        g++ -o main main.o $PETSC_LIBS
>>
>>        alternatively, you could do it in a single line if you like
>>
>>        g++ -o main -I($PETSC_INCLUDE) main.cpp $PETSC_LIBS
>>
>>        my point is you should link to petsc after compiling your own code.
>>        So wherever in Eclipse that you are seting the parameters, make
>> sure
>>        the $PETSC_LIBS is in the linker option and not compiler.
>>
>>        Mohammad
>>
>>
>>        On Wed, Jul 27, 2011 at 12:39 PM, Matt Bockman
>>        <mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>>>>**> wrote:
>>
>>        I added the include directories from "make getincludedirs" and I
>>        added the line from "make getlinklib". Eclipse creates a gcc
>>        call as follows:
>>
>>        /home/mdbockman/Documents/____**____Research/codes/petsc/**
>> petsc-__3.______1-p8/linux-**gnu-c-__debug/bin/______mpicc
>>        -I/home/mdbockman/Documents/__**______Research/codes/petsc/__**
>> petsc-__3.____1-p8/linux-gnu-_**_c-debug/____include
>>        -I/home/mdbockman/Documents/__**______Research/codes/petsc/__**
>> petsc-__3.____1-p8/include
>>        -I/home/mdbockman/Documents/__**______Research/codes/petsc/__**
>> petsc-__3.____1-p8/linux-gnu-_**_c-debug/____include
>>        -O0 -g3 -pg -p -Wall
>>        -Wl,-rpath,/home/mdbockman/___**_____Documents/Research/codes/**
>> ________petsc/petsc-3.1-p8/**linux-__gnu-______c-debug/lib
>>        -Wl,-rpath,/home/mdbockman/___**_____Documents/Research/codes/**
>> ________petsc/petsc-3.1-p8/**linux-__gnu-______c-debug/lib
>>        -L/home/mdbockman/Documents/__**______Research/codes/petsc/__**
>> petsc-__3.____1-p8/linux-gnu-_**_c-debug/__lib
>>        -lpetsc -lX11
>>        -Wl,-rpath,/home/mdbockman/___**_____Documents/Research/codes/**
>> ________petsc/petsc-3.1-p8/**linux-__gnu-______c-debug/lib
>>        -L/home/mdbockman/Documents/__**______Research/codes/petsc/__**
>> petsc-__3.____1-p8/linux-gnu-_**_c-debug/__lib
>>        -lflapack -lfblas -lnsl -lrt -lm
>>        -L/home/mdbockman/Documents/__**______Research/codes/petsc/__**
>> petsc-__3.____1-p8/linux-gnu-_**_c-debug/__lib
>>        -L/usr/lib/x86_64-linux-gnu/__**______gcc/x86_64-linux-gnu/4.**5.2
>>        -L/usr/lib/x86_64-linux-gnu -ldl -lmpich -lpthread -lrt -lgcc_s
>>        -lmpichf90 -lgfortran -lm -lm -ldl -lmpich -lpthread -lrt
>>        -lgcc_s -ldl -MMD -MP -MF"SparseMatrixPetsc.d"
>>        -MT"SparseMatrixPetsc.d" -o"SparseMatrixPetsc.o"
>>        "../SparseMatrixPetsc.c
>>
>>        And when it is compiled I get the following:
>>
>>        http://pastebin.com/CbRzYcZj
>>
>>        The source file which is being compiled is:
>>
>>        http://pastebin.com/Q85hXvnS
>>
>>        Please have a look. I'm not quite sure what I'm doing wrong but
>>        I feel like I'm getting closer and closer to the solution.
>>
>>        Matt
>>
>>
>>        On Wed, Jul 27, 2011 at 11:52 AM, Satish Balay
>>        <balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>
>>        <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>>
>>        <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>
>>        <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>>>
>>        <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>
>>        <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>>
>>        <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>
>>        <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>>>>
>>        <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>
>>        <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>>
>>        <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>
>>        <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>>>
>>        <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>
>>        <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>>
>>        <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>
>>        <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>>>>>**> wrote:
>>
>>        use:
>>        make getincludedirs
>>
>>        Satish
>>
>>        On Wed, 27 Jul 2011, Mohammad Mirzadeh wrote:
>>
>>         > I applogize for the mistake; Include files are actually
>>        located
>>         > in $PETSC_DIR/include
>>         >
>>         > On Wed, Jul 27, 2011 at 11:18 AM, Mohammad Mirzadeh
>>        <mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com
>>        <mailto:mirzadeh at gmail.com>>>>**>__>______wrote:
>>
>>
>>         >
>>         > > Ok then. Now I don't have enough experience with Eclipse so
>>         > > I apologize beforehand if you already know these/have
>>        tried them out. If
>>         > > not, hopefully they can be of help. I assume there
>>        should be a way in
>>         > > Eclipse to give it the link lib directory. In plain
>>        makefile that's just a
>>         > > simple step when linking. To get all the needed
>>        linklibs for petsc, you can
>>         > > do
>>         > >
>>         > > make getlinklibs
>>         > >
>>         > > in the $PETSC_DIR. As for the needed include files,
>>        they are all located
>>         > > in
>>         > >
>>         > > $PETSC_DIR/$PETSC_ARCH/include
>>         > >
>>         > > Again, its easy to use these directories along with
>>        your makefile. I'm not
>>         > > sure about how you give them to Eclipse though.
>>        Hopefully this has been
>>         > > helpful.
>>         > >
>>         > > Best,
>>         > > Mohammad
>>         > >
>>         > >
>>         > >
>>         > >
>>         > > On Wed, Jul 27, 2011 at 10:52 AM, Matt Bockman
>>        <mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>>>>**> wrote:
>>         > >
>>         > >> Just pointing it to the library would be sufficient.
>>         > >>
>>         > >> Matt
>>         > >>
>>         > >>
>>         > >> On Wed, Jul 27, 2011 at 10:21 AM, Mohammad Mirzadeh
>>        <mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com
>>        <mailto:mirzadeh at gmail.com>>>>**>__>______wrote:
>>
>>
>>         > >>
>>         > >>> So do you want to be able to compile PETSc with
>>        Eclipse or just point it
>>         > >>> to the library to use in your own applications?
>>         > >>>
>>         > >>>
>>         > >>> On Wed, Jul 27, 2011 at 9:14 AM, Matt Bockman
>>        <mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>
>>        <mailto:mdbockma at ucsd.edu <mailto:mdbockma at ucsd.edu>>>>>**> wrote:
>>         > >>>
>>         > >>>> Thanks Mohammad,
>>         > >>>>
>>         > >>>> I'll give that a shot. I use Qt Creator for some GUI
>>        applications so I
>>         > >>>> am familiar with it, but I've never tried doing a
>>        non-Qt project in it. I'd
>>         > >>>> really like to get Eclipse to work.
>>         > >>>>
>>         > >>>> Regarding the makefiles for eclipse. There are
>>        makefiles that it
>>         > >>>> generates (which are for GNU make) but I think I can
>>        also manually create my
>>         > >>>> makefiles. After sleeping on it, it seems like this
>>        might be the best
>>         > >>>> option, unless I can figure out a way to configure
>>        eclipse to include the
>>         > >>>> conf/variables and conf/rules files in the makefile.
>>         > >>>>
>>         > >>>> Matt
>>         > >>>>
>>         > >>>>
>>         > >>>> On Wed, Jul 27, 2011 at 12:01 AM, Mohammad Mirzadeh
>>        <mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>
>>        <mailto:mirzadeh at gmail.com <mailto:mirzadeh at gmail.com>>>>**>
>>
>>
>>         > >>>> > wrote:
>>         > >>>>
>>         > >>>>> Although this is sort of orthogonal to what you do
>>        right now,
>>         > >>>>> I recommend Qt Creator as an alternative IDE to
>>        Eclipse. It links nicely
>>         > >>>>> with PETSc(or any other library for that matter)
>>        and has excellent c/c++
>>         > >>>>> support.
>>         > >>>>>
>>         > >>>>> Mohammad
>>         > >>>>>
>>         > >>>>>
>>         > >>>>> On Tue, Jul 26, 2011 at 7:22 PM, Barry Smith
>>        <bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>
>>        <mailto:bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>>
>>        <mailto:bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>
>>        <mailto:bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>>>
>>        <mailto:bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>
>>        <mailto:bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>>
>>        <mailto:bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>
>>        <mailto:bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>>>>
>>        <mailto:bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>
>>        <mailto:bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>>
>>        <mailto:bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>
>>        <mailto:bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>>>
>>        <mailto:bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>
>>        <mailto:bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>>
>>        <mailto:bsmith at mcs.anl.gov <mailto:bsmith at mcs.anl.gov>
>>        <mailto:bsmith at mcs.anl.gov
>>        <mailto:bsmith at mcs.anl.gov>>>>**>__>______wrote:
>>
>>
>>         > >>>>>
>>         > >>>>>>
>>         > >>>>>> There is a tiny bit of information in the PETSc
>>        users manual about
>>         > >>>>>> Eclipse:
>>         > >>>>>>
>>         > >>>>>> \section{Eclipse Users} \sindex{eclipse}
>>         > >>>>>>
>>         > >>>>>> If you are interested in developing code that uses
>>        PETSc from Eclipse
>>         > >>>>>> or developing PETSc in Eclipse and have knowledge
>>        of how to do indexing and
>>         > >>>>>> build libraries in Eclipse please contact us at \
>>         > >>>>>> trl{petsc-dev at mcs.anl.gov
>>        <mailto:trl%7Bpetsc-dev at mcs.**anl.gov<trl%257Bpetsc-dev at mcs.anl.gov>
>> >
>>        <mailto:trl%7Bpetsc-dev at mcs.__**anl.gov <http://anl.gov>
>>        <mailto:trl%257Bpetsc-dev at mcs.**anl.gov<trl%25257Bpetsc-dev at mcs.anl.gov>
>> >>
>>        <mailto:trl%7Bpetsc-dev at mcs.
>>        <mailto:trl%257Bpetsc-dev at mcs.**>____anl.gov <http://anl.gov>
>>        <mailto:trl%257Bpetsc-dev at mcs.**__anl.gov
>>        <mailto:trl%25257Bpetsc-dev@**mcs.anl.gov<trl%2525257Bpetsc-dev at mcs.anl.gov>
>> >>>
>>        <mailto:trl%7Bpetsc-dev at mcs <mailto:trl%257Bpetsc-dev at mcs>**.
>>        <mailto:trl%257Bpetsc-dev at mcs
>>        <mailto:trl%25257Bpetsc-dev@**mcs <trl%2525257Bpetsc-dev at mcs>
>> >.__>____anl.gov <http://anl.gov>
>>        <http://anl.gov>
>>        <mailto:trl%257Bpetsc-dev at mcs.
>>        <mailto:trl%25257Bpetsc-dev@**mcs <trl%2525257Bpetsc-dev at mcs>
>> .>____anl.gov <http://anl.gov>
>>        <mailto:trl%25257Bpetsc-dev at __**mcs.anl.gov <http://mcs.anl.gov>
>>        <mailto:trl%2525257Bpetsc-dev@**mcs.anl.gov<trl%252525257Bpetsc-dev at mcs.anl.gov>
>> >>>>
>>        <mailto:trl%7Bpetsc-dev at mcs <mailto:trl%257Bpetsc-dev at mcs>
>>        <mailto:trl%257Bpetsc-dev at mcs <mailto:trl%25257Bpetsc-dev@**mcs<trl%2525257Bpetsc-dev at mcs>
>> >>__.
>>
>>        <mailto:trl%257Bpetsc-dev at mcs <mailto:trl%25257Bpetsc-dev@**mcs<trl%2525257Bpetsc-dev at mcs>
>> >
>>        <mailto:trl%25257Bpetsc-dev at __**mcs
>>        <mailto:trl%2525257Bpetsc-dev@**mcs <trl%252525257Bpetsc-dev at mcs>
>> >>.__>____anl.gov
>>        <http://anl.gov> <http://anl.gov>
>>
>>        <http://anl.gov>
>>
>>        <mailto:trl%257Bpetsc-dev at mcs <mailto:trl%25257Bpetsc-dev@**mcs<trl%2525257Bpetsc-dev at mcs>
>> >.
>>        <mailto:trl%25257Bpetsc-dev at __**mcs
>>        <mailto:trl%2525257Bpetsc-dev@**mcs <trl%252525257Bpetsc-dev at mcs>
>> >.>____anl.gov <http://anl.gov>
>>        <http://anl.gov>
>>
>>        <mailto:trl%25257Bpetsc-dev@
>>        <mailto:trl%2525257Bpetsc-dev@**>____mcs.anl.gov <
>> http://mcs.anl.gov>
>>
>>        <mailto:trl%2525257Bpetsc-dev@**__mcs.anl.gov
>>        <mailto:trl%252525257Bpetsc-**dev at mcs.anl.gov<trl%25252525257Bpetsc-dev at mcs.anl.gov>
>> >>>>>}.
>>
>>
>>
>>
>>
>>         > >>>>>>
>>         > >>>>>> To make PETSc an Eclipse package
>>         > >>>>>> \begin{itemize}
>>         > >>>>>> \item Install the Mecurial plugin for Eclipse and
>>        then import the
>>         > >>>>>> PETSc repository to Eclipse.
>>         > >>>>>> \item elected New->Convert to C/C++ project and
>>        selected shared
>>         > >>>>>> library. After this point you can perform searchs
>>        in the code.
>>         > >>>>>> \end{itemize}
>>         > >>>>>>
>>         > >>>>>> A PETSc user has provided the following steps to
>>        build an Eclipse
>>         > >>>>>> index for PETSc that can be used with their own
>>        code without compiling PETSc
>>         > >>>>>> source into their project.
>>         > >>>>>> \begin{itemize}
>>         > >>>>>> \item In the user project source directory, create
>>        a symlink to the
>>         > >>>>>> petsc/src directory.
>>         > >>>>>> \item Refresh the project explorer in Eclipse, so
>>        the new symlink is
>>         > >>>>>> followed.
>>         > >>>>>> \item Right-click on the project in the project
>>        explorer, and choose
>>         > >>>>>> "Index -> Rebuild". The index should now be build.
>>         > >>>>>> \item Right-click on the PETSc symlink in the
>>        project explorer, and
>>         > >>>>>> choose "Exclude from build..." to make sure
>>        Eclipse does not try to compile
>>         > >>>>>> PETSc with the project.
>>         > >>>>>> \end{itemize}
>>         > >>>>>>
>>         > >>>>>> We'd love to have someone figure out how to do it
>>        right and include
>>         > >>>>>> that information.
>>         > >>>>>>
>>         > >>>>>> Barry
>>         > >>>>>>
>>         > >>>>>> On Jul 26, 2011, at 4:32 PM, Matt Bockman wrote:
>>         > >>>>>>
>>         > >>>>>> > Has anyone gotten PETSc to work w/Eclipse?
>>        Eclipse nicely generates
>>         > >>>>>> all my makefiles for me for my current project
>>        (which is written in C++).
>>         > >>>>>> I'd like to link PETSc w/my application but I'm
>>        not sure how to do this.
>>         > >>>>>> >
>>         > >>>>>> > Suggestions?
>>         > >>>>>> >
>>         > >>>>>> > Thanks,
>>         > >>>>>> > Matt
>>         > >>>>>>
>>         > >>>>>>
>>         > >>>>>
>>         > >>>>
>>         > >>>
>>         > >>
>>         > >
>>         >
>>
>>
>>
>>
>>
>>
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110727/b05bbbb1/attachment-0001.htm>


More information about the petsc-users mailing list