Topic: oofem under windows

Hi,

I am trying to setup OOFem under Windows. I managed to run it under Cygwin. Now, I am using MinGW, with Eclipse. There is one system header (sys/resource.h) that does not exist under MinGW. What is the best option to fix this behaviour?

On one hand, this is a general question somewhat beyond OOFem, since it touches upon portability between Linux and MinGW. On the other hand, the particular solution for OOFem may be not the same (and perhaps simpler) as for other packages, depending on why is sys/resource.h needed.


Trial and error led me to copying cygwin/usr/include/sys/resource.h into MinGW/include/sys/resource.h, commenting out lines 76 and 77:

/*int getpriority (int which, id_t who);
int setpriority (int which, id_t who, int value);*/

which apparently only leave the problem at linkage time:

undefined reference to `getrusage'


These are some URLs that relate to the issue (I post them simply for reference, perhaps they are relevant/useful).

http://gcc.gnu.org/ml/gcc-bugs/2001-01/msg00925.html
http://gcc.gnu.org/ml/gcc-bugs/2007-06/msg02151.html
http://www.opengroup.org/onlinepubs/009 … rce.h.html

Thanks

sas

Re: oofem under windows

Hi,

Now I went even backwards, trying to recompile both Ckit and Elixir under MinGW. Ckit compiled smoothly. Elixir does not pass ./configure, with the following error

checking build system type... configure: error: cannot guess build type; you must specify one

Is there any set of instructions that allows for healthy building of Ckit/Elixir/oofem?

Thanks

sas

Re: oofem under windows

Hi,

One more: I found in the Wiki a reference to DevC++. Did anyone get a working version under DevC++?

Thanks

Santiago

4

Re: oofem under windows

Hi Santiago,

the portable timing is an issue. Unfortunately, my access to windows is quite limited, but the problem obviously comes from the fact, that getrusage function is not available on win platform. The purpose of this function is to return a structure "rusage" which contains information about current resource usage. This is used to report user time. If you can live without this, then simple solution is to comment out the getrusage call (and corresponding include <sys/resource.h>). Better is to replace it with wall clock time reporting to get printed some reasonable values. On the other hand, I am pretty sure, that similar function exist in win to report user time consumed.

Concerning compilation of Elixir under MinGW, I am not sure, whether this compiler comes with X-win libraries (as cygwin does). If this is not the case, then don't try to compile Elixir, it could not succeed, unless you have X-win libs on your system. So basically without X-win libs you could compile only the solver. Visualization is still possible using vtk tools. If you have them, then if configure could not guess your system, you can specify it manually (./configure --help) or you can try to get new config.sub and config.guess files (part of autoconf).

I used DevC++ when helping someone with oofem installation  on windows, and we were quite happy with it. It comes with useful IDE - so we have created a single project, containing all relevant files from oofemlib, sm, tm, directories (do not try to include all *.C and *.h files - some of them contribute only to oofeg or parallel versions, follow makefiles). I think that we have faced similar issues with getrusage (and we solved them exactly as I have written). 

Hope that this will help
Borek

Re: oofem under windows

Hi Borek,

Thanks for the answer. As always, your brief explanations about purpose of functions, etc., help a lot with understanding the ins and outs of OOFem, sometimes allowing for user-made solutions to problems.

I will try what you proposed about the time functions.

Regarding Elixir, I tried to please config.sub and config.guess but none of their options represent my system (MinGW). Perhaps it is possible to generate new config.sub and config.guess with autoconf (and automake?), but I have never used these tools. Is the only functionality of Ckit/Elixir related to visualization with OOFem? If so, I will settle for VTK only and not worry anymore, for the time being.

Regarding DevC++, should I include all files from oofemlib, sm, tm? You referred to "all relevant files from oofemlib, sm, tm, directories", but I do not know what does this exactly mean. What about the main, iml, dss, fm, tools directories? How can I decide what to include and what not?

Cheers,

Santiago

6

Re: oofem under windows

Hi Santiago,

the Elixir and Ckit libraries are needed only for built-in oofem visualization using X-windows. You do not need them to compile oofem solver. So, if you want to use vtk visualization, then there is no need to install these libraries.

On the other hand, the usage of autoconf is pretty simple. Install autoconf package (I assume that package is available, otherwise you have to compile it from sources). Then go to oofem top directory and run "autoconf". This will create new configure script from template (configure.in). Then replace config.sub and config.guess files by newer one from autoconf.

Concerning DevC++: in each source directory (main/src, oofemlib/src, sm/src, tm,src, fm/src), you can find "makefile.in" file. If you open this file, look for line beginning with "oofem_src=". It will look similar to this:
"oofem_src=$(srcs0) $(srcs2) "
which means that oofem (here means solver) sources in this directory consist of files assigned to srcs0 and srcs1 variables. In the same file, a few lines above, you can find which files belong to srcs0 and srcs1. All files that are finally assigned to oofem_src variable (in all source directories) have to be included in the project.

You also have to define following symbols for compilation:
"__OOFEMLIB_MODULE, __SM_MODULE, __TM_MODULE, __FM_MODULE". Look for compiler settings in DevC++.
If you want to add iml support, add "__IML_MODULE" symbol and add all files in iml directory.
Similarly for dss (sparse direct solver), add "__DSS_MODULE" symbol and include all files from "dss/src" directory.

If you find my answers too brief and you need more detailed description, do not hesitate to ask for it.

Borek.

Re: oofem under windows

Hi Borek,

Thanks again (BTW, by "brief" I meant concise, going straight to the point in question).

I managed to get Eclipse CDT + OOFem (no Ckit/Elixir) + MinGW/Msys working. I also tried Eclipse CDT + OOFem + Cygwin on a different machine and it worked. As of now, I think I won't need autoconf, but thanks anyway, I'll keep it under my sleeve.

Regards,

Santiago