thelfer / MFrontGenericInterfaceSupport

This project aims at providing support for MFront generic behaviours. This project can be embedded in open-source and propriary sofware
35 stars 34 forks source link

Installation - problem with std::optional #79

Closed felipefr closed 2 years ago

felipefr commented 2 years ago

Even the CMakeLists requiring C++17, I'm facing the compilation problem below. Has anyone had a similar problem? (Using Ubuntu 20 btw)

[ 1%] Building CXX object src/CMakeFiles/MFrontGenericInterface.dir/ThreadPool.cxx.o In file included from /home/felipe/local/codes/mgis/include/MGIS/ThreadPool.hxx:32, from /home/felipe/local/codes/mgis/src/ThreadPool.cxx:17: /home/felipe/local/codes/mgis/include/MGIS/ThreadedTaskResult.hxx:90:10: error: ‘optional’ in namespace ‘std’ does not name a template type 90 | std::optional result; | ^~~~ /home/felipe/local/codes/mgis/include/MGIS/ThreadedTaskResult.hxx:90:5: note: ‘std::optional’ is only available from C++17 onwards 90 | std::optional result; | ^~~ In file included from /home/felipe/local/codes/mgis/include/MGIS/ThreadedTaskResult.hxx:125, from /home/felipe/local/codes/mgis/include/MGIS/ThreadPool.hxx:32, from /home/felipe/local/codes/mgis/src/ThreadPool.cxx:17: /home/felipe/local/codes/mgis/include/MGIS/ThreadedTaskResult.ixx: In constructor ‘mgis::ThreadedTaskResult::ThreadedTaskResult(Args&& ...)’: /home/felipe/local/codes/mgis/include/MGIS/ThreadedTaskResult.ixx:29:9: error: class ‘mgis::ThreadedTaskResult’ does not have any field named ‘result’ 29 | : result(args...) {} // end of ThreadedTaskResult | ^~ make[2]: [src/CMakeFiles/MFrontGenericInterface.dir/build.make:76: src/CMakeFiles/MFrontGenericInterface.dir/ThreadPool.cxx.o] Error 1 make[1]: [CMakeFiles/Makefile2:517: src/CMakeFiles/MFrontGenericInterface.dir/all] Error 2 make: *** [Makefile:141: all] Error 2

thelfer commented 2 years ago

Hi @felipefr, Thanks for your interest for mgis. I just tried on Ubuntu 20.10 and it works nicely with the default compiler. I am downloading 20.04 just to give it a try. I'll let you informed. Best,

felipefr commented 2 years ago

Thanks for the quick answer. Indeed 20.04 is my version. I will check here later. If works for you I will try a virgin version tomorrow.

thelfer commented 2 years ago

Hi @felipefr,

I had no problem to install mgis on a fresh Ubuntu 20.04.

You may want to give spack a try as it shall be as simple as:

$ spack install mgis@master + python 
$ spack load mgis@master

Otherwise, you may want to try the attached script:

  1. You must install the packages using the instructions at the beginning of the script
  2. You may want to change the PREFIX variable to match your needs.
  3. You may want to remove the installation of tfel-plot and tfel-editor

Once install, you can run:

$ source $PREFIX/codes/mgis/master/install/env.sh

install.zip

thelfer commented 2 years ago

Concerning spack, there is a small issue fixed by this PR: spack/spack#28502

felipefr commented 2 years ago

Should I also install tfel with too? like: spack install tfel+python_bindings ?

thelfer commented 2 years ago

In spack, I makde tfel a dependency of the mgis package. So it will be automatically installed. spack load mgis@master will automatically load tfel@master.

thelfer commented 2 years ago

@felipefr The PR was merged. So installation shall work smoothly now.

felipefr commented 2 years ago

Thanks. Indeed now I managed to install with the standard script using cmake. I took me some time to discover how to link mgis with my anaconda environment. But now is working the example with fenics by Bleyer.

I will give a try to spack later.

thelfer commented 2 years ago

In my experience, anaconda is very good at providing a ready-to-use environment, but a poor build environment upon which one can compile things. In particular, anaconda can be a pain for coupling fenics, mfront and MGIS ( mostly because of boost-python).

To build mgis.fenics (don't know if you considered this module developped by Jérémy or his previous tutorials), I mostly use:

  1. spack when I want complete control on the compiler and dependency.
  2. the fenics ppa (see "FEniCS on Ubuntu" in https://fenicsproject.org/download/) when I do want to have something rapidly working based on the native compiler and environment

As 2) is much easier, you truly shall consider it.

felipefr commented 2 years ago

Yes, I experienced problems with boost-python. I compiled tfel and mgis in the native python. I only used anaconda to use my working environment with fenics and all the stuff. To recognise the libraries, I've run source env.sh with the desired environement activate. Temporary solution though.

I shall consider moving to spack, surely a better platform, at least opensource. Thanks again.