Compiling OpenFoam from git : problem with ld
Hello !
This is my first post on this forum, so do not hesitate to correct me if i do something wrong ;-) Here is my problem : When compiling OpenFoam (Allwmake) on Kubuntu 12.04 64bit, on 6 cores, i get the following error (this is only the first one, as there is a lot of them after which seem linked with this one) : Code:
Note: ignore spurious warnings about missing mpicxx.h headers Code:
/usr/bin/ld: error: cannot find -lfiniteVolume I am following the tutorial from http://www.openfoam.org/download/git.php, and installed it in my $home/OpenFOAM/OpenFOAM-2.1.x. I compiled ThirdParty-2.1.x without problems ($HOME/OpenFOAM/ThirdParty-2.1.x) Is there somebody who had the same kind of errors, or who have any idea of how resolving these ? Thank you Best regards, Matthieu Borgraeve |
Greetings Matthieu and welcome to the forum!
Mmm... interesting error message. OK, let's try diagnosing this without having me reproduce the same installation in a virtual machine.
Bruno |
More informaiton
1 Attachment(s)
Hi,
Thank you for this short reply !! Here is more informaiton :
Thank you very much ! Best regards, Matthieu Borgraeve |
Yep, it's "export" not "echo" :)
Mmm, Kubuntu in French... On second thought, I'm going to give it a try in a virtual machine, because it's the second time today I see problems with Kubuntu and OpenFOAM. The other one was here: http://www.cfd-online.com/Forums/ope...tml#post375597 And from the "make.log" file you got, it's not clear as to what the specific issue is, although Open-MPI is not built using the same ld commands as OpenFOAM... Like I wrote, I'm going to test this in a virtual machine. In the mean time, do you have any special environment flags for building software? Such as "CFLAGS", "CXXFLAGS" and "LDFLAGS"? |
Yes, i'm franch, so if you nedd me to translate some parts of the make.log, do not hesistate ;-)
I will have a look on this post, thank you ! I dont know what you mean by flags. I did not do anything approaching thant on purpose (i installed kubuntu yesterday on a new drive for testing OpenFoam and gpu computing without making a mess of the company drive disk with drivers, cuda installation and OpenFoam modifications), so unless it has been done automatically by installing NVIDIA drivers, Cuda drivers and developpment kit or installing OpenFoam and relatives, i would say no. I may not be able to test furtermore this afternoon (the computer is needed by somebody else, with the real drive), but i will tomorrow morning at least. Thank you for your help ! Regards, Matthieu |
1 Attachment(s)
Hi Matthieu,
Well, I guess NVidia is the one to be blamed... I finished testing in Kubuntu 12.04 x86_64, fully up-to-date - in both English and French - and had no problems building OpenFOAM 2.1.x. Attached is the environment I got from my virtual machine, without the OpenFOAM environment activated; you can see yours by running: Code:
export Code:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games Code:
unset LD_LIBRARY_PATH Code:
source $HOME/OpenFOAM/OpenFOAM-2.1.x/etc/bashrc Best regards, Bruno |
Hello,
Here is some news : whern compiling cuda applications from the Nvidia sdk examples, i get an error with mpicxx or something like that, but actually i do not manage to reproduce it (yet...), so it can confirm that Cuda & Nvidia stuff may interfer with OpenFOAM. I compared our 'export' data, without Openfoam bashrc sourcing, and almost differences differences concern Cuda, installed on my computer, not on yours. The only other is the PWD variable, with points to my Download folder in my $HOME, as yours go to /home/myusername/OpenFOAM/OpenFOAM-2.1.x. my log is attached if you want to see it. I am trying to uninstall cuda and see if it changes something in compiling OpenFoam after cleaning. After that, i will try to resintall Cuda and recompile to see if it changes something. Another question concerning .bash_profile and .bashrc : i know rc is called while starting a bash window, and profile when starting the computer, but the openfoam's bashrc file is in the .bashrc, as the modifications for sourcing Cuda libs are in the .bash_profile. Can it change something ? (i reboot after each change of bash_profile). Regards, Matthieu |
1 Attachment(s)
sorry for doubleposting, i forget the attached file...
|
Hi Matthieu,
If you can see the changes, then you can isolate them using aliases! Here's an long explanation I wrote sometime ago: Advanced tips for working with the OpenFOAM shell environment Best regards, Bruno |
Hi,
Currently compiling, the problem stays the same : I have two errors : Code:
/usr/bin/ld: error: --add-needed is not supported but is required for libpthread.so.0 in /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/librt.so Code:
SOURCE=fvFieldDecomposer.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/home/matthieu/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude -I/home/matthieu/OpenFOAM/OpenFOAM-2.1.x/src/meshTools/lnInclude -I/home/matthieu/OpenFOAM/OpenFOAM-2.1.x/src/lagrangian/basic/lnInclude -IlnInclude -I. -I/home/matthieu/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude -I/home/matthieu/OpenFOAM/OpenFOAM-2.1.x/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/fvFieldDecomposer.o Code:
matthieu@INOPRO-HPPORT-KUBUNTU:~/OpenFOAM/ThirdParty-2.1.x/openmpi-1.5.3$ ./autogen.sh |
Didn't you follow these instructions: http://www.openfoam.org/download/git.php ?
Check if the necessary packages are installed: Code:
sudo apt-get install build-essential flex bison cmake zlib1g-dev qt4-dev-tools libqt4-dev gnuplot libreadline-dev libncurses-dev libxt-dev |
Yes i did, i just checked, and they are installed :
Code:
matthieu@INOPRO-HPPORT-KUBUNTU:~$ sudo apt-get install build-essential flex bison cmake zlib1g-dev qt4-dev-tools libqt4-dev gnuplot libreadline-dev libncurses-dev libxt-dev |
Mmm... OK, I guess it's best to go hardcore and install Ubuntu's own build of Open-MPI:
|
Hi,
Here are the results : Code:
matthieu@INOPRO-HPPORT-KUBUNTU:~/OpenFOAM/OpenFOAM-2.1.x$ sudo update-alternatives --config mpirun Code:
+ wmake libso meshTools Code:
+ wmake libso edgeMesh EDIT : after cleaning, ThirdParty compile without any error, I am compiling OpenFoam. |
Hi Matthieu,
I hate to have to say this, but either you need to try and rebuild OpenFOAM from scratch, or you might even have to reinstall Kubuntu :( And then build OpenFOAM before installing anything else CUDA related... I don't know what it is, but something messed up your Kubuntu installation, at least when compared to a clean installation. It might have been ld or something else, I don't know and unfortunately I'm unable to diagnose it fast enough... One last attempt - what do these commands output: Code:
gcc --version Code:
$ gcc --version I haven't looked at the environment log you posted before... I'm going to look at it now... maybe something comes to mind... Best regards, Bruno |
Hi,
I think i have all the same than you, except from the probleming ld : Code:
matthieu@INOPRO-HPPORT-KUBUNTU:~/OpenFOAM/OpenFOAM-2.1.x$ ld --version Here are the others versions : Code:
matthieu@INOPRO-HPPORT-KUBUNTU:~/OpenFOAM/OpenFOAM-2.1.x$ gcc --version EDIT2 : it is still compiling, without errors (yet...). I will tell you the state tomorrow morning ;-), and if it still crashes, i will try to reinstall Kubuntu. I am currently doing it on another computer (with a fresh kubuntu installed) also, and it does the same (but i also installed CUDA & drivers before..) I'll keep you informed ! Thank you very much for your help EDIT : just starting to do the same problem missing -lmeshTools or others -lsomething... |
1 Attachment(s)
Hi Matthieu,
I didn't manage to answer you sooner... attached is the full help given by "ld --help". As for more on the ld version: Code:
$ dpkg-query -W binutils Bruno |
Hi,
in mine, there is a line missing in yours comparing to me, as we have (nearly) the same version : Code:
matthieu@INOPRO-HPPORT-KUBUNTU:~/Téléchargements$ dpkg-query -W binutils I will try to reinstall kubuntu, from a fresh downloaded ISO, with a new installation on my usbkey. |
1 Attachment(s)
Hi,
After a clean reinstallation, the problem seems to disapear (without installing nvidia-current-updates, nor CUDA stuff). Code:
matthieu@INOPRO-HPPort:~/OpenFOAM/ThirdParty-2.1.x$ dpkg-query -W binutils I am compiling ThirdParty, and i will compile OpenFoam during lunch time, and keep you informed. I will then try to install first nvidia-current-updates, retest it, and then try cuda. |
Hi Matthieu,
Quote:
My guess is that the CUDA instructions need the older variant of ld, which does a more relaxed linking strategy, while the recent versions use a very strict linking method. Here's a little reading material about this when it was discovered in OpenFOAM: Wait... now that I think of it... aaaarrg... it should have been as easy as removing the string "-Xlinker --add-needed -Xlinker --no-as-needed" from the rule files :( You'll find this string in the following files:
Best regards, Bruno |
1 Attachment(s)
Hi,
Some news i did'nt caught before : there is some errors when Allwmaking Thirdparty (attached, at the begging of the file). I am trying to compile OpenFoam. |
Not much of a problem here... Open-MPI can build without these:
Quote:
|
after a few hours compiling, it does finish, linking the elements which were missing after cuda installation.
I am following the rest of the tutorial, and it works, i manage to run the cavity test. I just notice that before installing cudad, they ask me for installing binutils-gold, which i think is the probleming ld util. I will look at the link ld before and after, and/or try to locate cuda/nvidia conf file for redirecting to ld-gold, and replace lthe original link in every other case. I keep you informed ;-) EDIT1 : Effectively, the link /usr/bin/ld point to /usr/bin/ld.bfd without binutils-gold, but it points to /usr/bin/ld.gold after installing it... I look for a way to alias it or to edit nvidia conf files to solve it. EDIT2 It really seems to be the problem, for now i'm testing compiling C Cuda application with the gold, and then i wxill recompile OpenFoam. Cuda C compilation fails with ld.bfd, which the standard version, but OpenCL does not complain, and the tests applications runned. I think i will have to edit the ld link each time i want to use cuda c compilation : i made an alias alias cuda ='alias ld=/usr/bin/ld.gold', the modification is apparent in a batch, but the make fails anyway. Aliases doesn't seem to interact with make... Have you any idea about how to make it quasi-automatic ? |
alias won't work. You'll have to either use a wrapper script or switch OpenFOAM's build method to the old way.
Wrapper - I haven't tested this so I'm not certain it will work as intended:
The other possibility and possibly the more sane one is to disable the current operational method (edit: this apparently doesn't work :():
|
The second options give me an error, but i'm not sure it concerns OpenFoam :
Code:
make[2]: « /home/matthieu/OpenFOAM/OpenFOAM-2.1.x/platforms/linux64GccSPOpt/bin/expandDictionary » est à jour. I think it will be safer to manually chane the link when compiling Cuda stuff, and then rechange it at the end to retreive the original state |
Try keeping:
Code:
-Xlinker --no-as-needed |
Hi,
Even with keeping this, i got references errors : Code:
g++ -m64 -Dlinux64 -DWM_SP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/home/matthieu/OpenFOAM/OpenFOAM-2.1.x/src/meshTools/lnInclude -I/home/matthieu/OpenFOAM/OpenFOAM-2.1.x/src/dynamicMesh/lnInclude -I/home/matthieu/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/matthieu/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude -I/home/matthieu/OpenFOAM/OpenFOAM-2.1.x/src/OSspecific/POSIX/lnInclude -fPIC -Xlinker --no-as-needed Make/linux64GccSPOpt/PDRMesh.o -L/home/matthieu/OpenFOAM/OpenFOAM-2.1.x/platforms/linux64GccSPOpt/lib \ |
Hi Matthieu,
Strange... very strange... I'll try to test this in the next couple of days... In the mean time, there is a somewhat quick way of switching between ld versions... something like this should get you in the right path: Code:
sudo update-alternatives --config ld Best regards, Bruno |
Hi Matthieu,
I've updated the instructions about creating a wrapper script for ld on post #24: http://www.cfd-online.com/Forums/ope...tml#post376235 As for this command: Code:
sudo update-alternatives --config ld I think the main difference when using the gold one is that all of the library dependencies have to be explicitly declared. This is why tweaking around with "no-as-needed" won't do the trick (although I could be wrong...). This is can be very complicated with OpenFOAM, because it relies on the feature of automatically figuring out certain library dependencies. It would require to edit most of the "Make/options" files and define in them all of the necessary library dependencies. Best regards, Bruno |
I saw this error today. Very strange
|
The error might be because of the GNU gold. It seems GNU gold is still in beta. So use GNU ld instead.
|
Hi Daniel,
I noticed you reported this here: http://www.openfoam.org/mantisbt/view.php?id=685 :) It's not as much of a beta issue, it's more of a decision issue... I think this could have been fixed in OpenFOAM a long time ago, but they kept taking the quickest route, or so it seemed (as seen in post #20): In the comments of bug reports you'll find these two other important links: It basically leads all down to a single paradoxal premise:
Bruno |
Thanks, Bruno.
By saying beta, I was hoping that gnu-gold would someday add a option to tolerate the "--add-needed" option with only a warning. Maybe they are still open to the users' voices in "beta" stage? But anyway, I'm okay with their new philosophy. Is it too troublesome to add twenty to thirty lines in options file for each app? Could the core libs linkage be added in wmake/Makefile (not just -lOpenFOAM)? Thanks again, Bruno, you are so active/energetic everyday. :D |
Quote:
Quote:
Actually this isn't much of a headache, because this work has already been done in the (unofficial) modifications made to OpenFOAM for it to work on Windows, both by Symscape and blueCAPE, because ironically Windows requires explicit indication of which libraries the applications reaaally need for working. Although in Windows it gets even trickier, because in Linux one can tell the linker to add a few libraries into the mix, even if they're not explicitly necessary... But from what I've seen so far, the reasoning is part of OpenFOAM's own coding elegance:
Quote:
|
All times are GMT -4. The time now is 01:07. |