Skip to content

Building FVS binaries on Linux

David Diaz edited this page Mar 15, 2016 · 18 revisions

If you are doing a fresh install of FVS, first get your dependencies covered:

sudo apt-get install gfortran cmake unixodbc-dev subversion
cd /usr/local/src

Then check-out the open-fvs source-code:

svn checkout https://svn.code.sf.net/p/open-fvs/code open-fvs

If you already have open-fvs installed and just need to update the source code, use:

svn update open-fvs

Now move into the directory where the FVS binaries are to create the makefiles:

cd open-fvs/trunk/bin

Optional: EDIT makefile Add -O2 for optimizations; http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

# export FFLAGS = $(PIC) -g -Wall -ffpe-trap=invalid,zero -O2

Set to build all variants in CMakeLists.txt

file(GLOB tobuild FVS*_sourceList.txt)

Build the makefiles

rm -rf *_CmakeDir
cmake -G"Unix Makefiles" .

Compile


# THIS SHOULD WORK BUT THE RESULTING BINARIES BEHAVE POORLY and crash in odd places
# The only difference is that the cmake technique is linked to shared libs
cd FVSwcc_CmakeDir && make -j32 && sudo cp FVS*c /usr/local/bin && cd ..
cd FVSpnc_CmakeDir && make -j32 && sudo cp FVS*c /usr/local/bin && cd ..
cd FVSbmc_CmakeDir && make -j32 && sudo cp FVS*c /usr/local/bin && cd ..
cd FVScac_CmakeDir && make -j32 && sudo cp FVS*c /usr/local/bin && cd ..
cd FVSncc_CmakeDir && make -j32 && sudo cp FVS*c /usr/local/bin && cd ..
cd FVSsoc_CmakeDir && make -j32 && sudo cp FVS*c /usr/local/bin && cd ..
cd FVSecc_CmakeDir && make -j32 && sudo cp FVS*c /usr/local/bin && cd ..

# DO THIS INSTEAD
# using the traditional makefile builds them with static linked libs
# this works better for whatever reason
make -j 32 && sudo cp FVS*c /usr/local/bin/

Another helpful technique:

#!/bin/bash
variants="wc pn ec so nc bm"

for v in $variants; do
  rm /usr/local/bin/FVS${v}c
  cd FVS${v}c_CmakeDir
  make clean
  make -j8
  ln -s $(pwd)/FVS${v}c /usr/local/bin/FVS${v}c
  cd ..
done
Clone this wiki locally