CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Compilation error for openfoam - 1.6 (http://www.cfd-online.com/Forums/openfoam/69915-compilation-error-openfoam-1-6-a.html)

misakagan November 9, 2009 10:08

Compilation error for openfoam - 1.6
 
Hi,

I am trying to compile the OpenFOAM v. 1.6 for the first time for a new user application and getting the error message described below:



Making dependency list for source file icoFoam.C SOURCE=icoFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/user/leuven/300/vsc30098/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -IlnInclude -I. -I/user/leuven/300/vsc30098/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/user/leuven/300/vsc30098/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/icoFoam.o
g++ -m64 -Dlinux64 -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/user/leuven/300/vsc30098/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -IlnInclude -I. -I/user/leuven/300/vsc30098/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/user/leuven/300/vsc30098/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC Make/linux64GccDPOpt/icoFoam.o -L/user/leuven/300/vsc30098/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt \
-lfiniteVolume -lOpenFOAM -liberty -ldl -lm -o /user/leuven/300/vsc30098/OpenFOAM/vsc30098-1.6/applications/bin/linux64GccDPOpt/myicoFoam
/user/leuven/300/vsc30098/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libfiniteVolume.so: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make: *** [/user/leuven/300/vsc30098/OpenFOAM/vsc30098-1.6/applications/bin/linux64GccDPOpt/myicoFoam] Error 1









Does someone have any idea to solve this linking error?


Thx in advance.

beretti_a December 11, 2009 12:41

Error compiling new solvers and ParaFoam
 
Hello folks,
I'm having a very similar problem as misakagan while compiling both new solvers and paraFoam. I'm working with SLES 10.

That is the the printout of my problem.
/home/andrea/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libsampling.so: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make: *** [/home/andrea/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/financialFoam] Error 1

Does anybody have an idea of how to fix this error?
Thanks
AB

wyldckat December 11, 2009 14:18

Hello Andrea,

Did you unpack the binary packages of OpenFOAM? If so, that might be the reason for the linking issue. The gcc versions might be incompatible. Try:
Code:

rm -rf /home/andrea/OpenFOAM/OpenFOAM-1.6/lib/*
rm -rf /home/andrea/OpenFOAM/OpenFOAM-1.6/applications/bin/*

It will erase the binaries from inside those folders.

Then redo ./Allwmake from the folder OpenFOAM-1.6.

Hope it works.

Best regards,
Bruno

beretti_a December 14, 2009 09:31

Still problems compiling OpenFOAM 1.6 on SLES 10
 
Thank you Bruno for your reply.

Unfortunately your hint doesnt fix the problem. Durign re-compiling we still realize the same errors as posted previously about collect2:

*** file not recognized: File format not recognized
collect2: ld returned 1 exit status

Consequently the compilation failed.

I'm a newbie but it seems that there are problems with the linkage between OpenFoam libraries and SLES libraries. Do you have other hints?

Does anybody know if there is an incompatibility between SLES 10 and OpenFOAM 1.6? That's because I tried to install OpenFOAM in my private laptop which use DEBIAN as OS and I didnt realize any problem.

For my project I have to compare the resaults of Fluent12 and OpenFOAM and on my server machine I must install either SLES 10 or RedHat Enterprise 4/5 which support Fluent12.
Does anybody had problems installing OpenFOAM 1.6 on RedHat Enteprise 4 or 5?

With regards.
AB

wyldckat December 14, 2009 10:15

Hello Andrea,

Are you using the system compiler (did you change the file OpenFOAM-1.6/etc/settings.sh)?
Or the are you using gcc-4.3.3 that comes in the ThirdParty Folder?

To build the packed gcc-4.3.3, in a terminal/console, go to the ThirdParty folder and do:
Code:

./makeGcc gcc-4.3.3
This will build the whole version. Edit the OpenFOAM-1.6/etc/settings.sh file and change back to OpenFOAM were you have changed to System...

Open a new terminal again (assuming you already have OpenFOAM-1.6/etc/bashrc in your ~/.bashrc), and you shouldn't see any errors.

Also, try searching for SLES on this forum... and/or the full OS name. There have been some other issues with the more recent compilers that come with the latest Linux distros.

Best regards,
Bruno

beretti_a December 14, 2009 10:36

Hello Bruno,
I tried to use both system compiler and OpenFOAM compiler by changing the setting.sh file but I realized exactly the same errors.

The Gcc package was already installed and this is the printout:

Building on 4 cores
gmp already built.
mprf already built.
gcc already built.

I followed step by step all the procedures according to the userguide but I really do not understand how to go forward.

I even tried to look for other posts in this forum, whitout results. I really think it may be an incompatibilty problem between OepnFOAM and my linux distribution.

Best regards,
AB

wyldckat December 14, 2009 10:47

Quote:

The Gcc package was already installed and this is the printout:

Building on 4 cores
gmp already built.
mprf already built.
gcc already built.
Ah HA, then that is one of the problems... you are using the pre-built version that comes with the ThirdParty packages.

If you can, try starting from scratch again, and unpack only the source code files, namely the ".General.tar.gz" packages. Then build the gcc that comes with the ThirdParty folder. And then you build OpenFOAM.
NOTE: if you don't want to start from scratch, remove the contents of the folder gcc-4.3.3/platforms.

Additionally, there are several packages that you should install in your SLES. The names in Ubuntu are: flex git git-core build-essential python-dev libqt4-dev libreadline5-dev wget zlib1g-dev texinfo byacc bison cmake.You'll also need gcc-multilib if you want to build the 32 version.
Some of these names should be the same, but others may be under other names.

Hope you can do it this time!
Bruno

beretti_a December 14, 2009 11:41

Bruno, I really appreciate your help

I followed up your instructions but I had problems while compiling Gcc:

Building on 4 cores
make: *** No rule to make target `distclean'. Stop.
Finished building gmp.
make: *** No rule to make target `distclean'. Stop.
Finished building mpfr.
make: *** No rule to make target `distclean'. Stop.
Finished building gcc.

Do you have an idea of what does it mean? Probably I'm forgetting something...

Furthermore I'm looking for the other packages to be added.

Regards,
AB

wyldckat December 14, 2009 12:25

Quote:

make: *** No rule to make target `distclean'. Stop.
Ah, the infamous "no target"... just to be on the safe side, remove the folders build and platforms from the folders:
gcc-4.3.3
mpfr-2.4.1
gmp-4.2.4
If it still gives you the same warning/error, then edit the makeGcc script and remove the 3 lines that say:
Code:

&& if [ -e Makefile ]; then make distclean; fi \
I wonder if it's this time you get lucky :)

beretti_a December 14, 2009 12:49

Sorry Bruno,
I'm getting a little bit confused.

I unpacked just the two "*.General.tar.gz" packages in order to compile everything from scratch. Inside the following folders

gcc-4.3.3
mpfr-2.4.1
gmp-4.2.4

I cannot find neither the Platform folder nor the build folder, so I could not delete anything.

Furthermore, I cannot find the 3 lines to be removed inside the makeGcc script. How could it be possible?


Thanks in advance.
AB

wyldckat December 14, 2009 13:24

OH, I thought you didn't do a clean deploy just now... OK, let me think... ah, now I remember, I tweaked the makeGcc script... sorry.

I guess it's easier this way... Here is my tweaked version of makeGcc:
Code:

#---------------------------------*- sh -*-------------------------------------
# =========                |
# \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
#  \\    /  O peration    |
#  \\  /    A nd          | Copyright (C) 1991-2009 OpenCFD Ltd.
#    \\/    M anipulation  |
#------------------------------------------------------------------------------
# License
#    This file is part of OpenFOAM.
#
#    OpenFOAM is free software; you can redistribute it and/or modify it
#    under the terms of the GNU General Public License as published by the
#    Free Software Foundation; either version 2 of the License, or (at your
#    option) any later version.
#
#    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
#    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
#    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
#    for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with OpenFOAM; if not, write to the Free Software Foundation,
#    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
#    makeGcc
#
# Description
#    Build script for gmp, mpfr and gcc-4.3.? and gcc-4.4.?
#
#------------------------------------------------------------------------------
usage() {
    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
    cat<<USAGE

usage: ${0##*/} <gcc-4.?.?> ...

* build gmp, mpfr and gcc-4.3.? and gcc-4.4.?

USAGE
    exit 1
}

if [ $# -ne 1 ]
then
    usage "gcc version not provided"
fi


#
# Set the number of cores to build on
#
WM_NCOMPPROCS=1

if [ -r /proc/cpuinfo ]
then
    WM_NCOMPPROCS=$(egrep "^processor" /proc/cpuinfo | wc -l)
    [ $WM_NCOMPPROCS -le 8 ] || WM_NCOMPPROCS=8
fi

echo "Building on " $WM_NCOMPPROCS " cores"

GMP_DIR=$WM_THIRD_PARTY_DIR/gmp-4.2.4
MPFR_DIR=$WM_THIRD_PARTY_DIR/mpfr-2.4.1
GCC_DIR=$WM_THIRD_PARTY_DIR/$1

GMPROOT=${GMP_DIR}/platforms/$WM_ARCH$WM_COMPILER$WM_COMPILER_ARCH
MPFRROOT=${MPFR_DIR}/platforms/$WM_ARCH$WM_COMPILER$WM_COMPILER_ARCH
GCCROOT=${GCC_DIR}/platforms/$WM_ARCH$WM_COMPILER$WM_COMPILER_ARCH

#
# Build GMP
#
if [ ! -d $GMPROOT ]
then
    (
      if [ ! -d "$GMP_DIR/build" ]; then mkdir $GMP_DIR/build; fi \
    && cd $GMP_DIR/build \
    && if [ -e Makefile ]; then make distclean; fi \
    && ../configure ABI=$ABI --prefix=$GMPROOT \
    && make -j $WM_NCOMPPROCS \
    && make install
    )
    echo "    Finished building gmp."
else
    echo "    gmp already built."
fi

export LD_LIBRARY_PATH="$GMPROOT/lib:$LD_LIBRARY_PATH"

#
# Build MPFR
#
if [ ! -d $MPFRROOT ]
then
    (
      if [ ! -d "$MPFR_DIR/build" ]; then mkdir $MPFR_DIR/build; fi \
    && cd $MPFR_DIR/build \
    && if [ -e Makefile ]; then make distclean; fi \
    && ../configure ABI=$ABI --prefix=$MPFRROOT --with-gmp=$GMPROOT \
    && make -j $WM_NCOMPPROCS  \
    && make install
    )
    echo "    Finished building mpfr."
else
    echo "    mprf already built."
fi

export LD_LIBRARY_PATH="$MPFRROOT/lib:$LD_LIBRARY_PATH"

#
# Build GCC
#
if [ ! -d $GCCROOT ]
then
    (
      if [ ! -d "$GCC_DIR/build" ]; then mkdir $GCC_DIR/build; fi \
    && cd $GCC_DIR/build \
    && if [ -e Makefile ]; then make distclean; fi \
    && ../configure --enable-languages=c,c++ --with-pkgversion='OpenFOAM' \
      --enable-__cxa_atexit --enable-libstdcxx-allocator=new \
      --with-system-zlib --prefix=$GCCROOT \
      --with-mpfr=$MPFRROOT --with-gmp=$GMPROOT \
    && make -j $WM_NCOMPPROCS \
    && make install
    )
    echo "    Finished building gcc."
else
    echo "    gcc already built."
fi

# ----------------------------------------------------------------- end-of-file

It takes into account some things that the original version didn't take into account.

I hope that now you can get it to work!

beretti_a December 15, 2009 12:38

1 Attachment(s)
Hello Bruno, thank you again for trying to help me.

Unfortunately, also the last solution proposed doesnt work. Now the compilation start correctly (at least as it seems) but cannot be completed.
I attach here the log file hoping you may better understand the problem.

Attachment 1779

wyldckat December 15, 2009 12:58

1 Attachment(s)
Hello Andrea,

Well, lucky you! I've already come across this problem too :) "log1p.c not found"
And I've also already reported on this forum here:
Quote:

The mpfr-2.4.1 folder that comes with the ThirdParty-1.6 package is missing 3 files from the original mpfr-2.4.1 package: log2.c, log1p.c and log10.c.
Attached is a patch file. To use it, unpack the patchMPFR.zip to the base folder of OpenFOAM (were you might have the other downloaded OpenFOAM packages). Then do:
Code:

cd ThirdParty-1.6
patch -p1 < ../patchMPFR

The p1 switch defines that you are 1 level already in the folder structure (you're in ThirdParty-1.6) in order to apply the patch. This should create the missing 3 files.
If you don't trust my patch (or something else goes wrong), then download and unpack the official version of mpfr-2.4.1!

Remember, victory will likely only happen if you keep going on fighting, no matter how many battles you loose ;) Of course that might also lead to the wrong battles being fought :rolleyes:

Best regards,
Bruno

beretti_a December 17, 2009 07:13

Still problems with gcc compilation from scratch
 
1 Attachment(s)
Hello Bruno.
Honestly, I'm not used to throw in the sponge so quickly.

Nevertheless I'm still obtaining errors while compiling Gcc even using the patchMPFR file. I send you the log file

Attachment 1806

In the meantime, I asked to my system administrator for the installation of the additional packages according to your previous post but I'm still waiting for.
I wonder if the problems I realized may be concerned to this lack.
Next steps are trying to install previous versions of OpenFOAM or better change the machine using a different linux distribution.

However, from tomorrow I'm on holiday, so I'll think about it next year... :cool: :cool: :cool:

Really all the best and happy new year in advance.
Andrea

wyldckat December 17, 2009 07:20

Greetings Andrea,

Well, now here is something I mentioned before... you're missing the multilib package.
Code:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory
I know there is a command for configure for gcc, but I'm going to have to do a little research first.

I'll edit this post later...

best,
Bruno

beretti_a December 17, 2009 09:27

Bruno,
I confirm you that the file stubs-32.h is missing.

The folder /usr/include/gnu/ contains only the following files:
- stubs-64.h
- stubs.h
- libc-version.h
- lib-names.h

Please consider I'm working on a 64-bit machine.
Best Regards,
Andrea

polychrome December 29, 2009 09:58

regarding stubs32.h
 
Hello,

i am getting the same errors on a 64-bit machine trying to compile gcc. As far as i can tell you are missing the 32-bit glibc-headers. Please install them from your distro (in Ubuntu the package is called: libc6-dev-i386)

In my opinion the makeGcc-script and the overall documentation regarding this toolchain (compiling your own gcc) really needs some polishing.

with kind regards,
Steffen

wyldckat December 29, 2009 15:08

Ah, it was multilib...
 
Greetings Steffen and welcome to the forum!

Your way works well, but Andrea has a minor limitation: he doesn't have administrative permissions over his working machine... so it might take a while for the admin to install the missing packages.

So, Andrea and Steffen, if you only want to build 64bit versions of OpenFOAM, then by adding "--disable-multilib" to the configure line in the makeGcc script, you can disable the multilib functionality of gcc. In other words, while the original version can build 32 and 64 executables, this disabled multilib version will only allow building 64bit applications. If you were building in 32 bit Linux, then only 32bit would be available.

The whole script is as follows:
Code:

#---------------------------------*- sh -*-------------------------------------
# =========                |
# \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
#  \\    /  O peration    |
#  \\  /    A nd          | Copyright (C) 1991-2009 OpenCFD Ltd.
#    \\/    M anipulation  |
#------------------------------------------------------------------------------
# License
#    This file is part of OpenFOAM.
#
#    OpenFOAM is free software; you can redistribute it and/or modify it
#    under the terms of the GNU General Public License as published by the
#    Free Software Foundation; either version 2 of the License, or (at your
#    option) any later version.
#
#    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
#    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
#    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
#    for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with OpenFOAM; if not, write to the Free Software Foundation,
#    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
#    makeGcc
#
# Description
#    Build script for gmp, mpfr and gcc-4.3.? and gcc-4.4.?
#
#------------------------------------------------------------------------------
usage() {
    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
    cat<<USAGE

usage: ${0##*/} <gcc-4.?.?> ...

* build gmp, mpfr and gcc-4.3.? and gcc-4.4.?

USAGE
    exit 1
}

if [ $# -ne 1 ]
then
    usage "gcc version not provided"
fi


#
# Set the number of cores to build on
#
WM_NCOMPPROCS=1

if [ -r /proc/cpuinfo ]
then
    WM_NCOMPPROCS=$(egrep "^processor" /proc/cpuinfo | wc -l)
    [ $WM_NCOMPPROCS -le 8 ] || WM_NCOMPPROCS=8
fi

echo "Building on " $WM_NCOMPPROCS " cores"

GMP_DIR=$WM_THIRD_PARTY_DIR/gmp-4.2.4
MPFR_DIR=$WM_THIRD_PARTY_DIR/mpfr-2.4.1
GCC_DIR=$WM_THIRD_PARTY_DIR/$1

GMPROOT=${GMP_DIR}/platforms/$WM_ARCH$WM_COMPILER_ARCH
MPFRROOT=${MPFR_DIR}/platforms/$WM_ARCH$WM_COMPILER_ARCH
GCCROOT=${GCC_DIR}/platforms/$WM_ARCH$WM_COMPILER_ARCH

#
# Build GMP
#
if [ ! -d $GMPROOT ]
then
    (
      if [ ! -d "$GMP_DIR/build" ]; then mkdir $GMP_DIR/build; fi \
    && cd $GMP_DIR/build \
    && if [ -e Makefile ]; then make distclean; fi \
    && ../configure ABI=$ABI --prefix=$GMPROOT \
    && make -j $WM_NCOMPPROCS \
    && make install
    )
    echo "    Finished building gmp."
else
    echo "    gmp already built."
fi

export LD_LIBRARY_PATH="$GMPROOT/lib:$LD_LIBRARY_PATH"

#
# Build MPFR
#
if [ ! -d $MPFRROOT ]
then
    (
      if [ ! -d "$MPFR_DIR/build" ]; then mkdir $MPFR_DIR/build; fi \
    && cd $MPFR_DIR/build \
    && if [ -e Makefile ]; then make distclean; fi \
    && ../configure ABI=$ABI --prefix=$MPFRROOT --with-gmp=$GMPROOT \
    && make -j $WM_NCOMPPROCS  \
    && make install
    )
    echo "    Finished building mpfr."
else
    echo "    mprf already built."
fi

export LD_LIBRARY_PATH="$MPFRROOT/lib:$LD_LIBRARY_PATH"

#
# Build GCC
#
if [ ! -d $GCCROOT ]
then
    (
      if [ ! -d "$GCC_DIR/build" ]; then mkdir $GCC_DIR/build; fi \
    && cd $GCC_DIR/build \
    && if [ -e Makefile ]; then make distclean; fi \
    && ../configure --enable-languages=c,c++ --with-pkgversion='OpenFOAM' \
      --enable-__cxa_atexit --enable-libstdcxx-allocator=new \
      --with-system-zlib --prefix=$GCCROOT \
      --with-mpfr=$MPFRROOT --with-gmp=$GMPROOT --disable-multilib \
    && make -j $WM_NCOMPPROCS \
    && make install
    )
    echo "    Finished building gcc."
else
    echo "    gcc already built."
fi

# ----------------------------------------------------------------- end-of-file

Sorry for the lazy post, but I did go to the trouble of testing this script in a new installation of OpenSUSE 11.2 x86_64 :) I only installed additionally these packages:
Code:

gcc flex bison m4 git-core build make texinfo
Although "git-core" is only necessary for getting the git version of OpenFOAM...

Oh, by the way Andrea, the script I previously posted here had a slight incompatibility with the original OpenFOAM-1.6 distribution... I added "$WM_COMPILER" to the folder paths of gcc, gmp and mpfr. Now it's fixed... I think. So it should work out of the box now :)

And Steffen:
Quote:

In my opinion the makeGcc-script and the overall documentation regarding this toolchain (compiling your own gcc) really needs some polishing.
Well, gcc is in the ThirdParty tools, so I think any documentation about those tools should be look for in the respective places. And if I remember correctly, OpenFOAM 1.5 didn't even come with one of these easy to use scripts for building gcc!

Additionally, the OpenFOAM 1.6.x git version should build properly with the more recent gcc versions (4.4.1 and up to 4.5.x), so "yast/zypper/apt-get/synaptic" (and others, depending on your distro) should do the trick pretty well ;)

Best regards and I hope it works now!
Bruno

beretti_a January 26, 2010 11:45

OpenFOAM compiling problems
 
Greatings Bruno,
first of all my apologies if I didnt reply you before. I've tried the last solution you posted here but I'm still having problems while compiling. Probably I'm still missing some additional packages that should be installed.

In the meantime I asked for a brand new machine and installing Debian as OS all works fine.
So, even if I havent fix the problem thanks for your kind help. I hope your hints may help others foamers.

With best regards,
Andrea

megacrout February 21, 2012 11:36

Quote:

Originally Posted by wyldckat (Post 240307)
Greetings Andrea,

Well, now here is something I mentioned before... you're missing the multilib package.
Code:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory

That just deleted 99.9% of the error messages I was getting. Thanks so much, I looked for that answer much longer than I wanted to!

Tibo


Edit: ok, actually "only" about 80% is gone. Anyway, Im on the right way =D


All times are GMT -4. The time now is 09:20.