Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building fails with Boost 1.67 because of old yaml-cpp #18

Closed
avidalto opened this issue Apr 25, 2018 · 17 comments
Closed

Building fails with Boost 1.67 because of old yaml-cpp #18

avidalto opened this issue Apr 25, 2018 · 17 comments

Comments

@avidalto
Copy link

avidalto commented Apr 25, 2018

Hello,

I am trying to build the OpenFOAM adapter to run the tutorial https://github.com/precice/precice/wiki/Tutorial-for-CHT-with-OpenFOAM-and-CalculiX. I am doing this from a docker container with ubuntu16.04. I successfully installed:

  1. OpenFOAM under /opt/OpenFOAM/
  2. CalculiX
  3. Precice under /opt/precice-1.1.1

And I successfully made the CalculiX adapter ccx_preCICE.

I installed yaml with apt-get install libyaml-cpp-dev and also building it manually, which worked for the CalculiX adapter.

However, when I run ./Allwmake I get the following error in the wmake.log file:

 wmake libso .
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=64 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3  -DNoRepository -ftemplate-depth-100 -I/opt/OpenFOAM/OpenFOAM-5.x/src/finiteVolume/lnInclude -I/opt/OpenFOAM/OpenFOAM-5.x/src/meshTools/lnInclude -I/opt/OpenFOAM/OpenFOAM-5.x/src/transportModels/ -I/opt/OpenFOAM/OpenFOAM-5.x/src/transportModels/compressible/lnInclude -I/opt/OpenFOAM/OpenFOAM-5.x/src/thermophysicalModels/basic/lnInclude -I/opt/OpenFOAM/OpenFOAM-5.x/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/OpenFOAM/OpenFOAM-5.x/src/TurbulenceModels/compressible/lnInclude -I/opt/OpenFOAM/OpenFOAM-5.x/src/TurbulenceModels/incompressible/lnInclude -I/usr/include/eigen3  -I/opt/precice-1.1.1/src/precice -I../ -DADAPTER_DEBUG_MODE -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-5.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-5.x/src/OSspecific/POSIX/lnInclude   -fPIC -c CHT/CHT.C -o Make/linux64GccDPInt64Opt/CHT/CHT.o
In file included from /usr/include/yaml-cpp/node/iterator.h:13:0,
                 from /usr/include/yaml-cpp/node/impl.h:11,
                 from /usr/include/yaml-cpp/yaml.h:17,
                 from CHT/CHT.H:14,
                 from CHT/CHT.C:1:
/usr/include/yaml-cpp/node/detail/iterator.h: In member function 'void YAML::detail::iterator_base<V>::increment()':
/usr/include/yaml-cpp/node/detail/iterator.h:48:47: error: 'next' is not a member of 'boost'
   void increment() { this->base_reference() = boost::next(this->base()); }
                                               ^
/usr/include/yaml-cpp/node/detail/iterator.h:48:47: note: suggested alternatives:
In file included from /usr/include/c++/5/bits/stl_algobase.h:66:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/string:40,
                 from lnInclude/Interface.H:4,
                 from CHT/CHT.H:4,
                 from CHT/CHT.C:1:
/usr/include/c++/5/bits/stl_iterator_base_funcs.h:184:5: note:   'std::next'
     next(_ForwardIterator __x, typename
     ^
In file included from /usr/local/include/boost/mpl/next.hpp:17:0,
                 from /usr/local/include/boost/mpl/bind.hpp:25,
                 from /usr/local/include/boost/mpl/lambda.hpp:18,
                 from /usr/local/include/boost/mpl/apply.hpp:25,
                 from /usr/local/include/boost/iterator/iterator_facade.hpp:36,
                 from /usr/include/yaml-cpp/node/detail/node_iterator.h:12,
                 from /usr/include/yaml-cpp/node/detail/iterator.h:12,
                 from /usr/include/yaml-cpp/node/iterator.h:13,
                 from /usr/include/yaml-cpp/node/impl.h:11,
                 from /usr/include/yaml-cpp/yaml.h:17,
                 from CHT/CHT.H:14,
                 from CHT/CHT.C:1:
/usr/local/include/boost/mpl/next_prior.hpp:29:8: note:   'boost::mpl::next'
 struct next
        ^
/opt/OpenFOAM/OpenFOAM-5.x/wmake/rules/General/transform:25: recipe for target 'Make/linux64GccDPInt64Opt/CHT/CHT.o' failed
make: *** [Make/linux64GccDPInt64Opt/CHT/CHT.o] Error 1in the 

The standard output when I run ./Allwmake is:

Building the OpenFOAM adapter for preCICE...
Make sure that all the required dependencies (mainly yaml-cpp and preCICE) are installed.
Using the following environment variables:
  ADAPTER_PRECICE_ROOT  = /opt/precice-1.1.1
      preCICE dependencies: not specified (ok if preCICE is built as a shared library)
  ADAPTER_PREP_FLAGS    = -DADAPTER_DEBUG_MODE
  ADAPTER_TARGET_DIR    = /opt/OpenFOAM/OpenFOAM-5.x/platforms/linux64GccDPInt64Opt/lib
  ADAPTER_WMAKE_OPTIONS = 
  ADAPTER_GLOBAL_CPLUS_INC_PATHS  = -I/usr/include/eigen3 
  ADAPTER_GLOBAL_LD_LIBRARY_PATHS = -L/opt/precice-1.1.1/build/last/ 
  ADAPTER_GLOBAL_LIBRARY_PATHS    = 
  WM_PROJECT_VERSION = 5.x

Building with WMake (see the wmake.log log file)...

Building failed. See wmake.log for more.

Could you please give me a hint as to what is going wrong?

Thank you very much!

@MakisH
Copy link
Member

MakisH commented Apr 25, 2018

Hi @avidalto,

what version of Boost are you using?

@avidalto
Copy link
Author

Thank you very much for the quick response. I am using boost_1_67_0 from https://www.boost.org/users/download/ following option 2 in https://github.com/precice/precice/wiki/Dependencies#boost

@avidalto
Copy link
Author

When I use the debug branch I get this fatal error message:

fatal error: yaml-cpp/yaml.h: No such file or directory

This happens when making CHT.o, however, SinkTemperature.o, HeatFlux.o KappaEffective.o and some other where compiled correctly.

@MakisH
Copy link
Member

MakisH commented Apr 26, 2018

Oh, then probably there is some incompatibility between yaml-cpp and Boost. How did you install yaml-cpp? Boost tends to change frequently, so you may need to build a previous version (for sure Boost 1.65.1 works, that's what I use).

Could you please upload your Dockerfile (or a minimal working example of it)? It would be much easier for me to help you then! :-)

@MakisH
Copy link
Member

MakisH commented Apr 26, 2018

Or maybe build the very latest yaml-cpp from source, I guess this requires less work, as you only need to rebeuild the adapter then.

@MakisH
Copy link
Member

MakisH commented Apr 26, 2018

There are also some experimental Dockerfiles in this repository. I am not sure about their state at the moment, but you could get some ideas. However, I am interested in debugging this.

I will test Boost 1.67 now.

@avidalto
Copy link
Author

avidalto commented Apr 26, 2018

Thanks!

  1. I installed yaml-cpp from source:
cd /opt
git clone https://github.com/jbeder/yaml-cpp.git
cd yaml-cpp
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=ON ..
make

This worked for calculix but I then used...

apt-get install libyaml-cpp-dev
apt-get install libyaml-cpp0.3-dev

... This changed the error from...

fatal error: yaml-cpp/yaml.h: No such file or directory

...to the one on my first post.

  1. I will now try Boost 1.65.1.

  2. I did not make a docker yet but I am using this container avidalto/openfoam5_calculix_precice:v4 where everything is installed under /opt.

These are more or less the commands I used:

# sudo docker run -it -v `pwd`:`pwd` -w `pwd` ubuntu:16.04 /bin/bash
# From http://openfoamwiki.net/index.php/Installation/Linux/OpenFOAM-5.x/Ubuntu
# Necessary
apt-get update
apt-get install -y git-core
apt-get install -y build-essential
apt-get install -y cmake
apt-get install -y flex
apt-get install -y bison
apt-get install -y zlib1g-dev
apt-get install -y qt4-dev-tools
apt-get install -y libqt4-dev
apt-get install -y libqtwebkit-dev
apt-get install -y gnuplot
apt-get install -y libreadline-dev
apt-get install -y libncurses-dev
apt-get install -y libxt-dev
apt-get install -y aplibopenmpi-dev
apt-get install -y openmpi-bin
apt-get install -y libboost-system-dev
apt-get install -y libboost-thread-dev
apt-get install -y libgmp-dev
apt-get install -y libmpfr-dev
apt-get install -y python
apt-get install -y python-dev
apt-get install -y libcgal-dev
# Should also be installed in some cases
apt-get install -y libglu1-mesa-dev
apt-get install -y libqt4-opengl-dev
#
cd /opt
mkdir OpenFOAM
cd OpenFOAM
git clone https://github.com/OpenFOAM/OpenFOAM-5.x.git
git clone https://github.com/OpenFOAM/ThirdParty-5.x.git
# optional: Did not work. 
ln -s /usr/bin/mpicc.openmpi OpenFOAM-5.x/bin/mpicc
ln -s /usr/bin/mpirun.openmpi OpenFOAM-5.x/bin/mpirun
# run uname -m --> x86_64
# for x# 86_64
# For building with the normal 64-bit integer support (maximum 9.22×1018 cells, faces or points):
source /opt/OpenFOAM/OpenFOAM-5.x/etc/bashrc WM_LABEL_SIZE=64 FOAMY_HEX_MESH=yes #--> Error

apt-get purge openmpi-bin libopenmpi-dev
apt-get install openmpi-bin libopenmpi-dev
rm OpenFOAM-5.x/bin/mpicc
rm OpenFOAM-5.x/bin/mpirun

ln -s /usr/bin/mpicc.openmpi OpenFOAM-5.x/bin/mpicc
ln -s /usr/bin/mpirun.openmpi OpenFOAM-5.x/bin/mpirun
source /opt/OpenFOAM/OpenFOAM-5.x/etc/bashrc WM_LABEL_SIZE=64 FOAMY_HEX_MESH=yes
# Save alias
echo "alias of5x='source /opt/OpenFOAM/OpenFOAM-5.x/etc/bashrc $FOAM_SETTINGS'" >> ~/.bashrc
source ~/.bashrc
of5x

cp ccx-212-patch-PW.tgz /opt
tar -zxf ccx-212-patch-PW.tgz
rm ccx-212-patch-PW.tgz

apt-get install -y --no-install-recommends gfortran
apt-get install -y --no-install-recommends make
apt-get install -y --no-install-recommends f2c 
apt-get install -y --no-install-recommends liblapack3
apt-get install -y --no-install-recommends liblapack-dev
apt-get install -y --no-install-recommends libexodusii-dev
apt-get install -y --no-install-recommends libgl1-mesa-dev
apt-get install -y --no-install-recommends libglu1-mesa-dev
apt-get install -y --no-install-recommends libxi-dev
apt-get install -y --no-install-recommends libxmu-dev
apt-get install -y --no-install-recommends time
apt-get install -y --no-install-recommends python-minimal
apt-get install -y --no-install-recommends python
apt-get install -y --no-install-recommends python-pip
pip install --upgrade pip

cd /opt/ccx-212-patch-PW/spooles.2.2/
make lib
cd MT/src/
make
cd /opt/ccx-212-patch-PW/ARPACK/
make lib

# make clean # Maybe later
cd /opt/ccx-212-patch-PW/src
make
mkdir /opt/CalculiX-2.12-executables/
cp /opt/ccx-212-patch-PW/src/ccx_2.12_MT /opt/CalculiX-2.12-executables/
cd /opt

# PATH !!
export PATH="/opt/CalculiX-2.12-executables:${PATH}"

# Install precice dependencies
apt update
apt install -y build-essential
apt install -y scons
apt install -y libeigen3-dev
apt install -y libxml2-dev
apt install -y petsc-dev
apt install -y python-dev
apt install -y python-numpy

cp boost_1_67_0.tar.gz /opt
cd /opt
tar -xvzf boost_1_67_0.tar.gz
cd boost_1_67_0
./bootstrap.sh --with-libraries=log,thread,system,filesystem,program_options,test --prefix=/usr/local
./b2 install
#rm -r boost**
ldconfig

echo export CPLUS_INCLUDE_PATH=\"/usr/include/eigen3:\$CPLUS_INCLUDE_PATH\" >> ~/.bashrc
echo export PETSC_DIR=/usr/lib/petscdir/3.6.2/ >> ~/.bashrc
echo export PETSC_ARCH=x86_64-linux-gnu-real >> ~/.bashrc


# Install precice. FAILS WITH VERSION 1.0.0 !!!
cd /opt
apt-get install -y wget
# replace 1.1.1 with actual version
wget https://github.com/precice/precice/archive/v1.1.1.tar.gz
tar -xzvf v1.1.1.tar.gz
cd precice-1.1.1
echo export PRECICE_ROOT=`pwd` >> ~/.bashrc
source ~/.bashrc

# When running SCons to build preCICE, don't build the tests target. For example, run it like this (specified targets, but only solib and symlink):
scons compiler=mpic++  petsc=yes python=no -j 4 solib symlink 


# Recommended
# Run tests
#./tools/compileAndTest.py -t # Only for the tests you need python 3
#apt-get install -y python3
#./tools/compileAndTest.py -t # Cant run as root need to add: --allow-run-as-root
#./tools/compileAndTest.py -t --allow-run-as-root # Doesn't work either
#sed -i -- 's/{mpirun}/{mpirun}\ --allow-run-as-root/g' ./tools/compileAndTest.py # Error:
# mpirun was unable to launch the specified application as it could not access
# or execute an executable:
# Executable: ../build/last/testprecice
#rm /opt/v1.1.1.tar.gz

# Add $PRECICE_ROOT/build/last to your dynamic library path
# As a dynamic library: Add $PRECICE_ROOT/build/last/ to your dynamic library path
echo export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$PRECICE_ROOT/build/last/ >> ~/.bashrc

# Try to build yaml manually
cd /opt
#mkdir yaml
git clone https://github.com/jbeder/yaml-cpp.git
cd yaml-cpp
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=ON ..
# Need to do make now!!!!!!!!!!!!!!!! Uncomment below
make
cd ..
#rm -r build


# Lets try with the calculix adapter 
cd /opt
git clone https://github.com/precice/calculix-adapter.git
cd calculix-adapter
git checkout -b v2.12 origin/v2.12
sed -i -- 's|\$(HOME)/PathTo/yaml-cpp|/opt/yaml-cpp|g' Makefile
sed -i -- 's|\$(HOME)/PathTo/preCICE|/opt/precice-1.1.1|g' Makefile
sed -i -- 's|\$(HOME)/PathTo/ARPACK|/opt/ccx-212-patch-PW/ARPACK|g' Makefile
sed -i -- 's|\$(HOME)/PathTo/SPOOLES|/opt/ccx-212-patch-PW/spooles.2.2|g' Makefile
sed -i -- 's|\$(HOME)/PathTo/CalculiX/ccx_2.12/src|/opt/ccx-212-patch-PW/src|g' Makefile
make
# Fails but ...
cd /opt/ccx-212-patch-PW/ARPACK
cp libarpack_linux.a libarpack_INTEL.a
cd /opt/calculix-adapter
make
# Works


# Building openfoam adapter
cd /opt
mkdir openfoam-adapter
cd openfoam-adapter
git clone https://github.com/precice/openfoam-adapter.git .
apt-get install -y libyaml-cpp-dev
./Allwmake
# Error:
#/opt/OpenFOAM/OpenFOAM-5.x/wmake/rules/General/transform:25: recipe for target 'Make/linux64GccDPInt64Opt/CHT/CHT.o' failed
#make: *** [Make/linux64GccDPInt64Opt/CHT/CHT.o] Error 1
source ~/.bashrc

I also tried similar steps with the dev and FSI branches.

Thank you for the docker files. I will take a look at them to see if a figure out another way of building the openfoam adapter.

@MakisH
Copy link
Member

MakisH commented Apr 26, 2018

I can also reproduce this issue with Boost 1.67.0 and yaml-cpp 0.5.3, [as well as 0.6.2] (wrong). Looking on this.

@MakisH MakisH changed the title Building failed Building fails with Boost 1.67 because of yaml-cpp Apr 26, 2018
@MakisH
Copy link
Member

MakisH commented Apr 26, 2018

So... I was wrong before, it works with yaml-cpp 0.6.x, which removed the Boost dependency. I added this in the building instructions of the adapter and of preCICE. You definitely need yaml-cpp 0.5.x or newer eitherways, because they changed the API in that version. I also added this in the instructions.

Thank you for reporting this!

Two side notes:

  1. As a user, you should only use the master branch. The debug-building was not needed anymore and I deleted it.
  2. It is useful if you post blocks of code using markdown's three backticks format. Just keep it in mind for the next issues! ;)

Pleae tell me if it also works for you. Just keep Boost 1.67 and upgrade yaml-cpp to 0.6.x.

@MakisH MakisH changed the title Building fails with Boost 1.67 because of yaml-cpp Building fails with Boost 1.67 because of old yaml-cpp Apr 26, 2018
@avidalto
Copy link
Author

avidalto commented Apr 26, 2018

Thank you very much! I used version 1.65.1 and it worked. Here is a copy of the steps:

# Restarting from the OpenFOAM container in a directory with:
# 1: boost_1_65_1.tar.gz
# 2: ccx-212-patch-PW.tgz
cp ** /opt
cd /opt

# Install precice dependencies
apt update
apt install -y build-essential
apt install -y scons
apt install -y libeigen3-dev
apt install -y libxml2-dev
apt install -y petsc-dev
apt install -y python-dev
apt install -y python-numpy

tar -xvzf boost_1_65_1.tar.gz
cd boost_1_65_1
./bootstrap.sh --with-libraries=log,thread,system,filesystem,program_options,test --prefix=/usr/local
./b2 install
rm -r boost**
ldconfig
echo export CPLUS_INCLUDE_PATH=\"/usr/include/eigen3:\$CPLUS_INCLUDE_PATH\" >> ~/.bashrc
echo export PETSC_DIR=/usr/lib/petscdir/3.6.2/ >> ~/.bashrc
echo export PETSC_ARCH=x86_64-linux-gnu-real >> ~/.bashrc
source ~/.bashrc

# Install precice.
cd /opt
apt-get install -y wget
# replace 1.1.1 with actual version
wget https://github.com/precice/precice/archive/v1.1.1.tar.gz
tar -xzvf v1.1.1.tar.gz
cd precice-1.1.1
echo export PRECICE_ROOT=`pwd` >> ~/.bashrc
source ~/.bashrc
# When running SCons to build preCICE, don't build the tests target. For example, run it like this (specified targets, but only solib and symlink):
scons compiler=mpic++  petsc=yes python=no -j 4 solib symlink 
# Add $PRECICE_ROOT/build/last to your dynamic library path
# As a dynamic library: Add $PRECICE_ROOT/build/last/ to your dynamic library path
echo export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$PRECICE_ROOT/build/last/ >> ~/.bashrc
source  ~/.bashrc

# Building openfoam adapter
cd /opt
mkdir openfoam-adapter
cd openfoam-adapter
git clone https://github.com/precice/openfoam-adapter.git .
apt-get install -y libyaml-cpp-dev #Version 0.5
of5x 
./Allwmake

@MakisH
Copy link
Member

MakisH commented Apr 26, 2018

Great! Feel free to also ask for help in our gitter/mailing list if you need anything.

@MakisH MakisH closed this as completed Apr 26, 2018
@DURAI04
Copy link

DURAI04 commented May 31, 2018

Hi,
I tried these steps but i am getting error. Please have a look.
Image 1 : When i am installing the preCICE its installing but under the build/last test&bin precice are not generating
Image 2 : When i am installing the calculix adapter it shows that boost error.
Image 3 : Finally i tried preCICE V1.0.3 its ruining fine with the fluid but solid its shown in line 60 segmentation error.

PLEASE HELP ME HOW TO SETTLE THIS ERRORS

bin testprecice

fsi1
fs13

@DURAI04
Copy link

DURAI04 commented May 31, 2018

root@DURAI:/home/durai/Desktop//CHT/heat_exchanger/buoyantSimpleFoam-CalculiX# ./Allrun

Setting up the preCICE configuration file for a serial simulation
Preparing the Inner-Fluid participant...
Starting the Inner-Fluid participant...
Preparing the Outer-Fluid participant...
Starting the Outer-Fluid participant...
Starting the Solid participant...
Waiting for the participants to exit...
(you may run 'tail -f Inner-Fluid.log' in another terminal to check the progress)

./Allrun: line 60: 8901 Segmentation fault (core dumped) ${Solver3} -i ${Participant3}/solid -precice-participant ${Participant3} > ${Participant3}.log 2>&1

Something went wrong... See the log files for more.
root@DURAI:/home/durai/Desktop/Final_FSI/tutorials-master/CHT/heat_exchanger/buoyantSimpleFoam-CalculiX#

How to rectify this error

@MakisH
Copy link
Member

MakisH commented Jun 1, 2018

Dear @DURAI04,

This does not seem related to the OpenFOAM adapter. It may actually be that you have more than one problems. Let's continue this discussion on Gitter.

Best,
Makis

@nithinadidela
Copy link

@MakisH
Hello. My name is Nithin.
This discussion really helped me configure my openfoam-adapter.
But when I run an fsi simulation, the solid part of the simulation which should run on CalculiX isn't working.
The fluid part of the simulation is working fine.
I am an undergraduate working on my graduation thesis...
I'd really be grateful if you can aid me in this process.

@MakisH
Copy link
Member

MakisH commented Oct 29, 2019

Hi @nithinadidela,
I understand that your issue now is different than Boost and yaml-cpp. Let's continue the discussion on Discourse! Please add more details there, such as log files, how you built preCICE, etc.

@nithinadidela
Copy link

nithinadidela commented Oct 29, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants