CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (https://www.cfd-online.com/Forums/openfoam-installation/)
-   -   How can I pass fpermissive to g (https://www.cfd-online.com/Forums/openfoam-installation/57371-how-can-i-pass-fpermissive-g.html)

mirko April 30, 2008 17:44

Hi, I tried today to build
 
Hi,

I tried today to build the OF-dev version with gcc-4.3 (on 64-bit RHEL5). (I am naively following a suggestion to use the newest release -- maybe I am too optimistic).

I did manage to build paraview-2.4.4 (it required tweaks in include statements in three files -- I can send those, but to whome?).

But OF is a different story.

For many files the errors are related to missing declarations of memset, strlen, abs, abort, strcopy.

I tried setting CXXFLAGS to -fpermissive in the .OpenFOAM.../bashrc file (followd by . ~/.bashrc).

But that does not seem to have made it into the build environment: I do not see it on the g++ statements.

echo $CXXFLAGS does show it:
> set | grep CXX
CXX=g++
CXXFLAGS='-m64 -fPIC -fpermissive'

So, again, how to pass that flag to g++.

Thanks,

Mirko

hjasak May 1, 2008 06:18

Sorry about paraview problems
 
Sorry about paraview problems - it is a bit weird that you had to edit the files by hand. It always built for me without much trouble... Sounds like you are missing some basic c headers

If you wish to add more flags to the C++ compiler for OpenFOAM, go to:

OpenFOAM-1.4.1-dev/wmake/rules

and look for your machine - mine is

echo $WM_ARCH$WM_COMPILER

linux64Gcc

Go in there and in the file c++ add the options to your heart's content http://www.cfd-online.com/OpenFOAM_D...part/happy.gif

Enjoy,

Hrv

mirko May 1, 2008 09:18

I think the problem is using g
 
I think the problem is using gcc-4.3 instead of 4.2

The paraview modifications were minor - otherwise I would not have been able to fix them:

DICOMAppHelper.cxx -- had to #include <string.h>
DICOMFile.cxx -- had to replace #include <string> with #include <string.h>
DICOMParser.cxx -- same as DICOMFile.cxx

I found the c++ rules file and added -fpermissive, but that did not help with OF compilation.

I will go back to the gcc-4.2 compiler. I was able to compile OF with that.

Thanks,

Mirko

mbeaudoin May 1, 2008 12:58

Hello Mirko, Looks to me yo
 
Hello Mirko,

Looks to me your installation of gcc-4.3 is incomplete because you should not have to replace #include <string> with #include <string.h>.

How did you install gcc-4.3 on your system?

On your Linux system, do you have any libstdc++ devel packages installed for gcc-4.3?

For instance, what is the output of the following command on your system:

rpm -qa | grep std

You should see something that looks like :

libstdc++43-devel-something

Martin

mirko May 1, 2008 13:16

Martin, I downloaded gcc-4.
 
Martin,

I downloaded gcc-4.3 from the gnu web site and installed it in OF/linux64. Here is what I found there:

> cd linux64/gcc-4.3.0/
> find . -name "libstdc*"
./share/locale/fr/LC_MESSAGES/libstdc++.mo
./share/locale/de/LC_MESSAGES/libstdc++.mo
./lib64/libstdc++.so
./lib64/libstdc++.so.6.0.10
./lib64/libstdc++.so.6
./lib64/libstdc++.la
./lib64/libstdc++.a

Does this tell you anything? I am not a c/c++ programmer. I use prehistoric languages: fortran and lisp :-)

Mirko

mbeaudoin May 1, 2008 13:41

Hi Mirko, So you have compi
 
Hi Mirko,

So you have compiled and installed gcc 4.3 yourself... good!

How did you compile it?

How about the file "string"?

cd linux64/gcc-4.3.0/
find . -name "string"

Finally, just to be sure, what is the output of the command:

which g++

Martin

mirko May 1, 2008 14:34

Martin, I compiled it as Hr
 
Martin,

I compiled it as Hrvoje suggested in his notes.

I checked the installation by running OF-dev/bin/foamInstallationTest. It found the correct compiler (

As for :string":

> find . -name "string*"
./lib/gcc/x86_64-unknown-linux-gnu/4.3.0/include-fixed/bits/string2.h
./lib/gcc/x86_64-unknown-linux-gnu/4.3.0/include/ssp/string.h
./include/c++/4.3.0/bits/stringfwd.h
./include/c++/4.3.0/string
./include/c++/4.3.0/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp .hpp
./include/c++/4.3.0/debug/string

As I said, I am now rebuilding the same OF/paraview sources with 4.2.2

Mirko

chyczewski June 10, 2008 15:41

I ran across this thread while
 
I ran across this thread while trying to build OpenFOAM. I saw the same errors as Mirko using gcc 4.3.0: declaration/usage problems with abs, strlen, memset and abort.

I went back to gcc 4.2.1 as suggested by Mirko. I downloaded the source from GNU and installed it the same way I had 4.3.0 (using the same gmp (4.2.2) and mpfr (2.3.1) libraries, binutils (2.17) etc).

After a couple other hiccups (problems with READLINELINK and some missing X11 files) I was able to get OF to compile properly (I think).

Like Mirko I suspect that there might be an issue with gcc 4.3.0. Has anyone succeeded with this version? If so, can you offer a resolution? If not, maybe an experienced user/developer should take a look.

In case you are interested, here is the first error I see in the screen output during Allwmake:

/home/chyczth/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/stringI.H: In member function 'size_t Foam::string::hash::operator()(const Foam::string&, size_t) const':
/home/chyczth/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/stringI.H:169: error: '::abs' has not been declared

Here is the last set of errors before the build finally dies:

/home/chyczth/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/IOobjectI.H: In static member function 'static void Foam::IOobject::writeBanner(Stream&)':
/home/chyczth/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/IOobjectI.H:39: error: there are no arguments to 'memset' that depend on a template parameter, so a declaration of 'memset' must be available
/home/chyczth/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/IOobjectI.H:39: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/home/chyczth/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/IOobjectI.H:40: error: there are no arguments to 'strlen' that depend on a template parameter, so a declaration of 'strlen' must be available
/home/chyczth/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/IOobjectI.H: In static member function 'static void Foam::IOobject::writeLogBanner(Stream&)':
/home/chyczth/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/IOobjectI.H:63: error: there are no arguments to 'memset' that depend on a template parameter, so a declaration of 'memset' must be available
/home/chyczth/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/IOobjectI.H:64: error: there are no arguments to 'strlen' that depend on a template parameter, so a declaration of 'strlen' must be available
make[2]: *** [Make/linuxGccDPOpt/engineSwirl.o] Error 1

I know very little C/C++ so I don't have more than a superficial understanding of these errors.

Tom


All times are GMT -4. The time now is 11:27.