CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Eclipse for OpenFOAM (https://www.cfd-online.com/Forums/openfoam-programming-development/75800-eclipse-openfoam.html)

AMahrla May 5, 2010 10:44

Eclipse for OpenFOAM
 
Dear FOAMers,

a new tutorial how to use the IDE Eclipse for OpenFOAM development is now available in the OpenFoam Wiki:
http://openfoamwiki.net/index.php/Ho...M_with_Eclipse


Best,

Astrid

wyldckat May 5, 2010 17:47

Hi Astrid,

Great post!! Many thanks!

The only thing I can't figure out is if it's possible to use the same instructions to also debug OpenFOAM's libraries... you know, just in case we want to add something to the core of OpenFOAM, or to verify where things are going through.

Best regards,
Bruno

PS: 2h20m to write a whole wiki page... that is wicked fast! I probably would take a whole day to do the same!!

AMahrla May 6, 2010 03:53

Hi Bruno!

You should be able to import every piece of OpenFOAM-code into eclipse and everything should be linked by setting the wmake build command. For debugging you'll have to provide a test case and a solver. But keep in mind that the indexer only works for those parts that imported in your eclipse workspace, but stepping through the code while debugging should be possible.

Best,
Astrid

P.S. Actually, I had prepared something for the wiki entry in advance...

l_r_mcglashan May 11, 2010 05:15

Good work, I use Eclipse too :D

Do you know if it's possible to "ssh" to a server and run wmake?

I find IDEs quicker if I run them on my desktop instead of on another file server/node. But I'm not sure how to ssh to the file server and run wmake. Does that make sense? I would guess that you'd add it to make target: http://openfoamwiki.net/index.php/File:Eclipse05.png

olesen May 12, 2010 02:28

1 Attachment(s)
Quote:

Originally Posted by l_r_mcglashan (Post 258289)
Good work, I use Eclipse too :D

Do you know if it's possible to "ssh" to a server and run wmake?

No real problem, but you probably want to use the wmakeScheduler mechanism for doing this. A common slip-up is not having the correct OpenFOAM environment defined on the remote server, but the wmakeScheduler usually gets it right for you.

For your reference (and without any guarantees, warranties etc.) I've attached an example of running wmake as a parallel job with GridEngine. The script is both a submission script and a job script rolled into one. See the usage with '-help'.

l_r_mcglashan May 13, 2010 07:18

That's really useful, thanks for sharing your script.

universez May 26, 2010 15:58

Error with wmake
 
Hi, i got this error with Eclipse and openfoam

could anyone tell me why.

Thanks

**** Build of configuration Default for project simpleFoam ****


(Cannot run program "wmake": Unknown reason)

Yu

l_r_mcglashan May 26, 2010 16:10

Are you building on your own machine or on another? Either it can't find wmake, or you've run out of memory from the few hits google gives for that issue with eclipse.

universez May 26, 2010 16:17

wmake error
 
I used my own machine. I never used eclipse before and have no idea about it. I just try to follow the tutorial. but can not make it work.

It that possible because the I use ubuntu?


Yu

Quote:

Originally Posted by l_r_mcglashan (Post 260408)
Are you building on your own machine or on another? Either it can't find wmake, or you've run out of memory from the few hits google gives for that issue with eclipse.


l_r_mcglashan May 28, 2010 05:01

Are you able to run wmake in a terminal outside of eclipse? I can't see what would be wrong I'm afraid.

universez June 1, 2010 16:06

I can run wmake in a terminal. but not in eclipse.

Thanks,
yu

Quote:

Originally Posted by l_r_mcglashan (Post 260630)
Are you able to run wmake in a terminal outside of eclipse? I can't see what would be wrong I'm afraid.


wyldckat June 2, 2010 19:28

Greetings Yu,

Quote:

Originally Posted by universez (Post 261245)
I can run wmake in a terminal. but not in eclipse.

Are you running Eclipse from the terminal or from the application menu? The terminal calls ~/.bashrc by itself, but starting an application from the "Applications" menu usually doesn't call the terminal first!

If you wish to always start eclipse from the menu, you have various solutions, some of which are:
  • edit the menu, then edit the Eclipse menu item and switch to "Type: Application in Terminal".
  • or, in Eclipse, instead of just using to wmake, also use the auxiliary OpenFOAM script to start up the environment for running OpenFOAM applications, like so:
    Code:

    $HOME/OpenFOAM/OpenFOAM-1.6/bin/foamExec wmake
    You might want to replace "$HOME" for your actual home folder, just in case ;) Also, use that foamExec script for starting your custom solver or utility in Eclipse.
  • or, to simplify the previous possibility, add a new entry to the "Applications" menu, where you have the Eclipse item, clone it, and change the cloned version to run foamExec prior to eclipse.
Mmmm... I thought I would have more possible solutions, but I'm already all out of possibilities for now :(

Best regards,
Bruno

universez June 4, 2010 11:35

Hi, Bruno,

Thank you, it works fine now. ;)

Yu


Quote:

Originally Posted by wyldckat (Post 261470)
Greetings Yu,


Are you running Eclipse from the terminal or from the application menu? The terminal calls ~/.bashrc by itself, but starting an application from the "Applications" menu usually doesn't call the terminal first!

If you wish to always start eclipse from the menu, you have various solutions, some of which are:
  • edit the menu, then edit the Eclipse menu item and switch to "Type: Application in Terminal".
  • or, in Eclipse, instead of just using to wmake, also use the auxiliary OpenFOAM script to start up the environment for running OpenFOAM applications, like so:
    Code:

    $HOME/OpenFOAM/OpenFOAM-1.6/bin/foamExec wmake
    You might want to replace "$HOME" for your actual home folder, just in case ;) Also, use that foamExec script for starting your custom solver or utility in Eclipse.
  • or, to simplify the previous possibility, add a new entry to the "Applications" menu, where you have the Eclipse item, clone it, and change the cloned version to run foamExec prior to eclipse.
Mmmm... I thought I would have more possible solutions, but I'm already all out of possibilities for now :(

Best regards,
Bruno


heavy_user June 9, 2010 04:44

Hi There,

great Post, sounds promising...i have been locking for something like this !

I managed to reproduce the "tutorial" on the wiki-page.. but there are still some major concerns of mine.

1. When I run the debug, i have the very same output in the console window I am
used to see running it "as usual". In the debug window I see some storage adresses(eg ...::correct @someaddres)
I was hoping to see what happens behind the scene... so to see which operation he
uses on which object and what values are returned...and so on..
Did I overlook it, or how can I achieve this?

2. I have been trying to understand a certain solver. Loading the solver like in the tutorial leaves me with "selected name can not be mapped to a symbol name" once I ask for the source code or something else.
So I added the whole FOAM folder as a project. But I still have some trouble with it.
For example: He Includes UEqn.H. I can open the sourcecode of this now, but trying to find out what he does when he calles "UEqn.relax();" is not possible with this tool..he says: "selected name can not be mapped to a symbol name".
".relax" happens to be NOT declared in UEqn.H and i dont know (yet) where UEqn.H is inherited from.

So do I have to go DOXYGEN again or is there a way to make him answer ;) ?

3. Also the auto completion does not work :-( .. I have "runTime.write" in the code...so when I write "runTime." right below the "runTime.write" and press crt+space he says "no proposals..." so what did I do wrong.
It does neither work with the only the solver importet nor with the whole OpenFoam-Folder.



thx & best regards!

AMahrla June 9, 2010 10:28

Hi heavy_user!

Concerning your questions..

1. During running the debug, the console output stays the same, but you have the possibility to watch the variables and the current position in the source code in the debug view. If your variables are pointers or references the storage adresses will be shown.

2. If you want to have a look into a function as .relax(); just go into the function using F5. This should open the file where the function is executed.

3. Sorry - no idea.. maybe this depends on the files you imported in your workspace..

Hope this could help you a little bit..

Best,

Astrid

heavy_user June 9, 2010 11:40

Hi Astrid,


thanks for your reply!!


Quote:

Originally Posted by AMahrla (Post 262303)

1. During running the debug, the console output stays the same, but you have the possibility to watch the variables and the current position in the source code in the debug view. If your variables are pointers or references the storage adresses will be shown.
Astrid

....wow :confused: ...if you want to make a video one day "how to use the debugger properly" i will be glad to assist watching the outcome ;) !

Or is there already a good video to it, which i didnt find yet?

-----------------------------------------------------------------
In the "DSF-Dissasembly" I have stuff like:

00416be8: mov $0x1,%ecx
00416bed: push %r14

which tells me nothing.

"debug" shows stuff like :

main() at 0x00000andsuchstuff

"variables" is empty.
---------------------------------------------> :confused: :confused: :confused:

is there a view where i can see e.g. which values/objects "turbulence->correct" uses and which values it gives back ??

Quote:

Originally Posted by AMahrla (Post 262303)

2. If you want to have a look into a function as .relax(); just go into the function using F5. This should open the file where the function is executed.
Astrid

I did some playing arround and with the "open declaration" option I get a result for ".write" and "turbulence" now...but still no luck with "correct" or "runTime"...or such things..does everyone work for you ?
I use "open declaration" (F3) (F5 is refresh in my version).

.....UPDATE !! : now most of the "open declaration"-calls work :eek: ...he seemed to be loading a while (about 1hour ), can i see the progress somewhere ?


Quote:

Originally Posted by AMahrla (Post 262303)

3. Sorry - no idea.. maybe this depends on the files you imported in your workspace..
Astrid

The autocompletion does not work at all, also for the things where he finds the declaration. Is there a way to check on it - to figure out why it does not work?

Quote:

Originally Posted by AMahrla (Post 262303)
Hope this could help you a little bit..
Astrid

YEA, great WORK... here we would say :
"Du bisch gut, kommst ind Supp. "


thx again!

heavy_user June 10, 2010 09:21

Hi There,

i found great tutorial videos for eclipse here:

http://eclipsetutorial.sourceforge.net/

but it is for java which is gonna mess with my shaki c++ .

Does anyone know videos like this for c++ ?
(I found some, but they are only covering the very basics or seem not to be working)

THX!

AlmostSurelyRob January 4, 2011 04:07

1 Attachment(s)
Hello and thanks for the tutorial!

The tutorial was really helpful and it's great to be able to run OF under a proper IDE. I was wondering if you could give me a hand with configuration since I have run into some little difficulties.

On my laptop with OpenSUSE 11.2 everything went smoothly and I can debug my OF applications under Eclipse.

On my desktop with OpenSUSE 11.3 I can't seem to get it right. Please, let me summarise what is happening.

- OF is compiled in Debug mode. It was compiled in an Opt mode previously on the same machine.

- I can add solver/cases to Eclipse project view.

- I can compile my projects in Eclipse.

- I can run Eclipse cases with an output to Eclipse console.

- I can debug my applications with gdb

However when I run Debug under eclipse it stops without any apparent reason. I get a set of runtime error messages (see log attached).

GDB also informs me about missing debuginfo for libutil but it does not hinder the further debugging process and does not result in any errors.

None of these problems appear on my laptop...

Could you please advise?

AMahrla January 10, 2011 05:13

It seems that there is a bug in gdb 7.x - as it runs with gdb 6.x versions.. I wrote something about that in the IDE forum on extend-project.de..

http://www.extend-project.de/component/kunena/35-integrated-development-environment-ide-for-openfoam-group-forum/13-graphical-variable-visualisation-while-debugging

Best, Astrid Mahrla

AlmostSurelyRob January 10, 2011 05:21

Quote:

Originally Posted by AMahrla (Post 289834)
It seems that there is a bug in gdb 7.x - as it runs with gdb 6.x versions.. I wrote something about that in the IDE forum on extend-project.de..

http://www.extend-project.de/component/kunena/35-integrated-development-environment-ide-for-openfoam-group-forum/13-graphical-variable-visualisation-while-debugging

Best, Astrid Mahrla

Good grief... and I have made a downgrade of the whole system to OpenSUSE 11.2 because of this issue. I knew it's an overkill...

Anyway, many thanks for your reply. I will keep that in mind. Now it works very well. Also, thanks for the link!

Just one thing that occurs to me... If this is a GDB bug, why does it work from a command line?

AMahrla January 10, 2011 07:39

Hi!

I think it's a bug in the machine interface gdb/mi .. If I remember correctly I was able to reproduce the bug with another IDE in same manner..

Best,

Astrid

luther May 7, 2011 08:49

Debugging problem in Eclipse
 
Hi All,

I have managed to successfully import a solver to an eclipse helios project. I can also run it applied to a test case thanks to the tutorial on how to use eclipse with openfoam.

My problem is that when I insert breakpoints, the debugger does not stop at them. It only stops at entry into main(). Also it does not display any code information. It only says " No source available for "main() at 0x8055df0" ".

Can anyone help me please. I have changed the option in the ./etc/bashrc file to Debug instead op Opt. What else should I do to be able to see the code and walk through it?

Regards
Luther

AlmostSurelyRob May 7, 2011 08:59

Luther,

did you also compile the OpenFOAM sources after changing the value of the environmental variable?

luther May 7, 2011 09:07

Hi Robert,

I have only compiled the solver that I have imported. In this test case it is a local copy of simpleFoam located in my /home/ directory. The binary that gets created are located $FOAM_USER_APPBIN. This is also the binary I point to in the run and debug configurations of Eclipse. I hope this info helps.

Thanks

Regards
Luther

AlmostSurelyRob May 7, 2011 09:14

I can't think of anything else, but to compile the main sources as well so if you have a possibility to do that it shouldn't hurt to try. I am not myself an expert on debugging OpenFOAM but the fact that you didn't recompile the main sources seems to explain why you enter the main of your solver, but can't get any other info.

luther May 7, 2011 09:20

I would expect not to get any information on all of the other sources, such as createMesh for example, since they are release builds, but i would expect to get information on the main() subroutine of the solver I have just compiled and imported into eclipse.

Thank you for your help. I will fiddle some more with the options in eclipse.

AlmostSurelyRob May 17, 2011 06:47

Dear Astrid,

could I ask for advice again? I've been running the Eclipse debugging smoothly for quite some time. Recently I've changed to openSUSE 11.4. According to your advice I compiled gdb 6.8 but still, I cannot install breakpoints.

It either replies with:

No source file named ...
or
No line ... in file ...

Neither of these problems appear in gdb run from the command line. I've already tried adding my code to Source in Eclipse/Debug configuration, but no change.

I'm afraid that my problem might be specific to configuration, but if you have encountered a problem of this kind and know a workaround please let me know.

Many thanks,
Robert

AMahrla May 17, 2011 07:59

Hi Robert!

Remote diagnostics always makes things a little bit difficult, but of course I can try some standard guesses..
- I assume that you've recompiled OpenFOAM in debug mode..?
- Are you sure that eclipse starts with correct environment variables for OpenFOAM (check this starting eclipse from console, in case you haven't already done so...)?
- Can you compile from eclipse? If not, this is a hint for wrong environment variables..

By the way... Suse 11.4 uses gdb 7.2, isn't it? Is the bug still present?

Best, Astrid

AlmostSurelyRob May 17, 2011 08:41

Thanks for the reply.

Quote:

Originally Posted by AMahrla (Post 307950)
Hi Robert!
- I assume that you've recompiled OpenFOAM in debug mode..?

Yes. Also, I can run debug with full functionality when I run GDB (without Eclipse) from commandline.

Quote:

Originally Posted by AMahrla (Post 307950)
- Are you sure that eclipse starts with correct environment variables for OpenFOAM (check this starting eclipse from console, in case you haven't already done so...)?

What output should I expect? I run Eclipse from the commandline than go to debug mode but nothing happens. The only output is on Eclipse console.

Yes, I can compile from Eclipse.

Quote:

Originally Posted by AMahrla (Post 307950)
By the way... Suse 11.4 uses gdb 7.2, isn't it? Is the bug still present?

I am afraid so. On 7.2 it simply freezes. With 6.8 I just can't install breakpoints, but again it might be specific to my system configuration.

AMahrla May 17, 2011 09:12

Hi Robert!

Sorry, that I can't help you. Haven't encountered that kind of problem - possibly as I'm not using openSUSE 11.4 ... But please let me know if you've found out what's wrong.. I'm still interested...

Astrid

yingkun June 8, 2011 21:56

hi,Bruno
I had the same problem,and I try to do what you said "edit the menu, then edit the Eclipse menu item and switch to "Type: Application in Terminal" ",where is the Eclipse menu item?I'm sorry,I'm a newer

wyldckat June 9, 2011 16:31

Greetings yingkun,
Quote:

Originally Posted by yingkun (Post 311161)
hi,Bruno
I had the same problem,and I try to do what you said "edit the menu, then edit the Eclipse menu item and switch to "Type: Application in Terminal" ",where is the Eclipse menu item?I'm sorry,I'm a newer

OK, I can provide some screen shots, but I'll need to know which Ubuntu version or Linux distribution are you using?! Because this look very differently between Ubuntu versions (10.10 vs 11.04) and other Linux distributions, such as openSUSE and Fedora.

Best regards,
Bruno

yingkun June 9, 2011 22:49

Thank you for the reply.
my Ubuntu version is 10.04,and now I can build project,but when running,it shows:
/home/ying/eclipsework/coalChemistryFoam /coalChemistryFoam:error while loading shared libraries:libfiniteVolume.so:cannot open shared object file:No such file or directory.
what's the problem?

wyldckat June 10, 2011 13:43

4 Attachment(s)
Hi yingkun,

It seems like you didn't manage to get things set-up properly. To answer your previous question and hopefully this will fix the current problem, attached are a few images:
  1. On Screenshot01.png it shows you where to right click to get that menu that shows up.
  2. On Screenshot02.png shows where Eclipse is located. After selecting it, click on the button Properties.
  3. On Screenshot03.png shows what the properties window looks like and where to click next. Clicking there will show you Screenshot04.png.
  4. Apply that chosen option of "Application in Terminal" and it should now work as intended.
Best regards,
Bruno

yingkun June 11, 2011 23:22

Hi,Bruno
I follow you with the code

HOME/OpenFOAM/OpenFOAM-1.6/bin/foamExec wmake instesd of wmake,
and I can build project,but I still can't run,it shows:
/home/ying/eclipsework/coalChemistryFoam /coalChemistryFoam:error while
loading shared libraries:libfiniteVolume.so:cannot open shared object
file:No such file or directory.

wyldckat June 12, 2011 12:19

Hi yingkun,
Quote:

Originally Posted by yingkun (Post 311629)
and I can build project,but I still can't run,it shows:
/home/ying/eclipsework/coalChemistryFoam /coalChemistryFoam:error while
loading shared libraries:libfiniteVolume.so:cannot open shared object
file:No such file or directory.

:eek: OK ok, now I finally understand what you mean... On weekends I'm really slooow to understand some things...
Use the same foamExec script, including its path, for launching the solver!

In other words:
  • To launch wmake, use:
    Code:

    $HOME/OpenFOAM/OpenFOAM-1.6/bin/foamExec wmake
    Update OpenFOAM version/path accordingly to your installation.
  • Likewise for launching the built solver; for example, to run icoFoam:
    Code:

    $HOME/OpenFOAM/OpenFOAM-1.6/bin/foamExec icoFoam
    Or even for extended completeness:
    Code:

    $HOME/OpenFOAM/OpenFOAM-1.6/bin/foamExec icoFoam -case $HOME/OpenFOAM/$USER-1.6/mytestcase
    This way it will run on the case "$HOME/OpenFOAM/$USER-1.6/mytestcase".
Best regards,
Bruno

Arnoldinho July 13, 2011 10:56

Hi there,

I have a problem running point 7 from the wiki "Running applications and debugging". Up to this point, everything works. I could load the whole OF package into the workspace, and could compile a test-solver.

Running an imported application ramp (from /tutorials/surfaceTracking/interTrackFoam), I get the following error: In Run -> Run Configurations I chose "ramp" as Project and "/opt/OpenFOAM/OpenFOAM-1.6-ext/applications/solvers/surfaceTracking/interTrackFoam" as Application (from the Browse... menue). But I can't run it as I get
Quote:

Program is not a recognized executable.
Same with Debug Configuration.

I'm using OF 1.6-ext compiled in debug mode on Ubuntu 10.04 64bit. Eclipse is 3.5.2 installed via apt-get.

Arne

AMahrla July 13, 2011 11:45

Hi Arne,

you should look for the compiled binary instead of the source code. Have look in "/opt/OpenFOAM/OpenFOAM-1.6-ext/applications/bin".

Hope, that helps.

Best,

Astrid

Arnoldinho July 13, 2011 12:01

Yup, that definitely makes sense! Shame on me... That must be the muggy weather.

Arnoldinho July 14, 2011 08:24

Like already posted in #16, I also have a problem including paths to be able to jump trough the source code.

A copied a solver (interDyMFoam) to FOAM_USER_APPBIN, renamed (solver01) and compiled it. In solver01.C, when e.g. pointing to #include "fvCFD.H" and pressing F3, I only get
Quote:

Could not find include file 'fvCFD.H' on include paths
although I already included '/opt/OpenFOAM/OpenFOAM-1.6-ext/src/finiteVolume/cfdTools/general/include' (where fvCFD.H is located) and before already tried the whole OpenFOAM-1.6-ext folder in solver01 -> Properties -> Inludes + Library Paths.

Only those files that are directly included in the solver01 folder can be displayed/pointed to.

Any hints?


All times are GMT -4. The time now is 23:15.