CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Installation (
-   -   Compiler problem? (

kamakura117 April 10, 2011 02:08

Compiler problem?
Hello kind folks,

I am experiencing an issue that it fairly irritating, and I have been unable to resolve it after clearing out all my libraries and completely reinstalling the system compilers. I am using Ubuntu 10.10, and have previously installed openFOAM just fine on another machine. Even further, openFOAM actually runs just fine - at least with the tutorials and simple problems that I am currently learning on. Now, the problem that I am having is the following:

When I open up the terminal, I get this error:

/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status

It indicates to me, that the main() function is not being called properly; however, I can't find much information on what crt1.o is in the first place. Also, if I remove the openFOAM related commands in the .bashrc, I am free of this problem.

Any help would be appreciated. While I am successfully running openFOAM, it is very annoying to know that there is some hidden incompatibility.

Many thanks in advance.

wyldckat April 10, 2011 04:55

Greetings Jesse,

That is very odd. OK, lets try and debug this:
  1. Are you 100% certain that this error occurs as soon as you start the terminal? Or is it when you run a command?
  2. The file "crt1.o" is an object that is prepended to an executable being built. Basically that error message usually occurs if a person tries to build an OpenFOAM library using:

    instead of

    wmake libso
  3. Quote:

    Also, if I remove the openFOAM related commands in the .bashrc, I am free of this problem.
    :confused: You have more than one command? What exactly do you have in ".bashrc" that is related to OpenFOAM? Or in other words, what commands, other than sourcing OpenFOAM's "bashrc" (the line that start with dot-space or the command source), do you have in ".bashrc" that is related to OpenFOAM?

To be clearer on point 3, the only command line I expect to be in ".bashrc" is something like this:

. /opt/openfoam171/etc/bashrc
(notice the dot-space before '/') - or this:

source /opt/openfoam171/etc/bashrc
Best regards,

kamakura117 April 10, 2011 09:52

Hi Bruno,

1. I am absolutely sure that it is when I open the terminal window.
2. Right, and that's what is confusing. I am not building anything; however, I did have this error when I both installed the Debian package and built it myself.
3. I am sourcing the bash file and setting the environmental variables that were required for running openFoam, since I preferred installing it elsewhere. Now, I reverted back to the Debian package installer, since I imagine that is the convention.

The dot has been noticed. :p Again, openFoam actually operates just fine on this machine; it's just that I have this terminal error - induced only by the bashrc source.

Many thanks,

wyldckat April 10, 2011 13:38

Hi Jesse,

This feels familiar... it seems similar to this thread:

The only thing I can think of doing next would be to use a divide-and-conquer strategy for isolating which command inside bashrc or (sourced by bashrc) at the OpenFOAM folder is triggering that error.

Wait, now thank I think about, the only executable that I know that is called from is mpicc, if you are using the SYSTEMOPENMPI option. It's used to figure out where are the libraries and include folders for OpenMPI. They are:

mpicc --showme:compile
mpicc --showme:link

The other possibility is the script "openfoam-*/etc/apps/paraview3/bashrc", where it tries to verify if ParaView is installed where it's expected.

Other than these, you'll have to isolate by hand where the problem is. I usually use commands to print location messages, like these:

echo "Got here 01"
(some code)
echo "Got here 02"

Best regards and good luck!

kamakura117 April 10, 2011 16:51

Alright, I will give it a go with a different MPI package and see how that goes. One of my machines use MPICH2 and the other MPI-LAM.

If that's not the case, I'll just continue debugging or eventually just image the other HDD. :-)



All times are GMT -4. The time now is 03:57.