CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Compiling with exe option

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 2, 2007, 09:18
Default I tried to recompile icoFoam w
  #1
Senior Member
 
Maka Mohu
Join Date: Mar 2009
Posts: 305
Rep Power: 18
maka is on a distinguished road
I tried to recompile icoFoam with: wmake exe to generate a single executable file that does not depend on the dynamically linked libraries.

I got the following error:
-------------------------
wmake exe
make: Nothing to be done for `allFiles'.
make: `Make/linuxAMD64Gcc4DPOpt/dependencies' is up to date.
exe
/data/maka/OpenFOAM/OpenFOAM-1.3/wmake/bashScripts/mkObjectDir a.out
g++ -m64 -DlinuxAMD64 -DDP -Wall -W -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -DNoRepository -ftemplate-depth-30 -I/data/maka/OpenFOAM/OpenFOAM-1.3/src/finiteVolume/lnInclude -I/data/maka/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude -IlnInclude -I. -fPIC Make/linuxAMD64Gcc4DPOpt/icoFoam.o -lfiniteVolume \
-liberty -o a.out
/usr/bin/ld: cannot find -lfiniteVolume
collect2: ld returned 1 exit status
make: *** [a.out] Error 1
------------------------------

This was motivated by the fact that I have very limited account space on the cluster which I run on.

I understand that copying the necessary dynamically linked objects together with the normal executable (generated by wmake) will work but it is still too big. Also using shared object saves space if I'm going to copy lots of solvers but this is not the case.

I wonder if there is a way to generate a single executable file for a solver?

Thanks,
Maka
maka is offline   Reply With Quote

Old   January 2, 2007, 17:18
Default you might want to 'strip' the
  #2
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
you might want to 'strip' the libraries. E.g. libOpenFOAM.so went down from 4204464 to 3553312 bytes in my case.

Or maybe you are allowed to run on a bigger local partition (/usr/tmp?) and can create a local installation there on every node.
mattijs is offline   Reply With Quote

Old   February 27, 2008, 04:18
Default wmake exe is used to create an
  #3
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
wmake exe is used to create an executable which is independent of the Foam libraries, i.e. does not need any Foam functionality.

What you want to do instead is to created static libraries (.a) versions of all the OpenFOAM libraries ('wmake lib' instead of 'wmake libso') and then build the executable without -shared (not sure if that is an option in wmake).

Much easier is just to run a tool like statifier to convert executable and libraries into a single standalone executable.
mattijs is offline   Reply With Quote

Old   September 17, 2010, 06:30
Default
  #4
Senior Member
 
Pawel Sosnowski
Join Date: Mar 2009
Location: Munich, Germany
Posts: 105
Rep Power: 18
psosnows is on a distinguished road
Hello,

similarly to Maka, I would like to compile my solver and create single executable file. I would like to be able to copy that "exe" file to a machine (cluster) which does not have OF installed.

While using "wmake exe" I get the same error:

/usr/bin/ld: cannot find -lfiniteVolume
collect2: ld returned 1 exit status
make: *** [a.out] Error 1

I understand that this is some problem with linking everything together.
Right now I am running on OF-1.7.1, installed as default in /opt/ folder.
Running sole "wmake" works properly.

I kindly ask for some hints.
Best,
Pawel
psosnows is offline   Reply With Quote

Old   September 17, 2010, 20:59
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Pawel,

AFAIK: the current version of OpenFOAM has some dependencies on the etc folder available in OpenFOAM's version folder (e.g. OpenFOAM-1.7.1). So, even if you wanted a fully stand-alone binary of a solver from OpenFOAM, that simply can't be done without some re-engineering of the code.
So, I think the simplest thing you could do is to run:
Code:
cd $FOAM_APPBIN
ldd solver
This will output the list of libraries that your desired solver needs. Then use this list for copying both the solver binary and those select few libraries into a single folder, and "ship-it" along with OpenFOAM's etc folder. Keep in mind that some of OpenFOAM's environment variables are still necessary, even it you stuff everything into the same folder .

I think this solution is the quickest nonetheless and is the one with the smallest disk space footprint, if you only need one or two solvers. Because if you build all applications in static mode, you binary folder will jump from 0.5-1 MB per binary, to 20-30 MB per binary!


Now, if you still want to build static executables of OpenFOAM applications, then I suggest that you study the solution I implemented on the patches for cross-compiling OpenFOAM in Linux for Windows, available here. In the section "Profiling OpenFOAM applications with mingw cross-compiled version" of that page, you will find a short explanation of why I implemented this solution and where you can find the necessary changes for making static builds of OpenFOAM applications. Keep in mind that these changes are strictly adapted to compiling with mingw and in Profiling mode. In other words, Profiling mode for Linux will not give you the same static builds as with mingw! But changing it to work with Optimized version for Linux should be pretty easy!!


Additionally, you can also search OpenFOAM's forums for "static builds for Cray" (if I'm not mistaken), because there have been some people that needed to build static executables, due to some of Cray's limitations or the compiler's limitations, I'm not sure...

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   September 18, 2010, 07:20
Default
  #6
Senior Member
 
Pawel Sosnowski
Join Date: Mar 2009
Location: Munich, Germany
Posts: 105
Rep Power: 18
psosnows is on a distinguished road
Hello Bruno,

thank you very much for your fast and comprehensive replay! Finally I am out of a black alley. Will give a feedback on the results as soon as I obtain them (hopefully on Monday).

Best,
Pawel
psosnows is offline   Reply With Quote

Old   September 14, 2011, 11:41
Default
  #7
Member
 
Join Date: Aug 2011
Posts: 33
Rep Power: 15
seboxx is on a distinguished road
Hi Pawel,

is there any news related to this topic?
I have the same situation, I want to use a cluster that has no OpenFOAM environment installed. And I do think the best solution is a stand-alone binary.
I haven't found any solution yet and am happy about any hint.

Best regards,
sebastian
seboxx is offline   Reply With Quote

Old   September 14, 2011, 12:10
Default
  #8
Senior Member
 
Pawel Sosnowski
Join Date: Mar 2009
Location: Munich, Germany
Posts: 105
Rep Power: 18
psosnows is on a distinguished road
Hello Sebastian,

In the end I followed Bruno's advice (some posts above) and took the libraries "with me" to the cluster, without creating one, big exe. It worked but required quite a lot of digging, to bring the right lib* files.

Later on we moved to another cluster with OF installed, so the problem varnished.

Hope you will fight the way through!
Best,
Pawel
psosnows is offline   Reply With Quote

Old   September 14, 2011, 12:54
Default
  #9
Member
 
Join Date: Aug 2011
Posts: 33
Rep Power: 15
seboxx is on a distinguished road
Well thanks for the quick reply

Not that I didnt try it... but I keep on getting this error message:

error while loading shared libraries: libfiniteVolume.so: cannot open shared object file: No such file or directory
seboxx is offline   Reply With Quote

Old   September 16, 2011, 19:54
Default
  #10
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all,

Just to let you all and anyone else know that the subject on this thread has been continued on another thread: http://www.cfd-online.com/Forums/ope...le-solver.html

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
LES option in DES H, Chattopadhyay FLUENT 0 November 27, 2008 12:17
tef numerics option Felix CFX 2 September 25, 2008 10:45
GLM option guang ai Siemens 3 December 3, 2004 06:20
g77 compiling option Dario Main CFD Forum 1 November 25, 2004 10:02
????Compiling a udf with the "COMPILE" option ? ROOZBEH FLUENT 3 May 20, 2003 06:52


All times are GMT -4. The time now is 08:36.