Compilation of deal.II fails due to conversion error from std::complex<double> to double

52 views
Skip to first unread message

develo...@googlemail.com

unread,
Oct 14, 2023, 1:01:53 PM10/14/23
to deal.II User Group
Hei,
I'm currently trying to compile deal.II on my local machine, but encounter the following compilation error:

[  0%] Built target expand_instantiations_exe
[  0%] Built target doxygen_headers
[  0%] Built target object_arborx_inst
[  0%] Built target object_arborx_debug
[  4%] Built target object_numerics_inst
Consolidate compiler generated dependencies of target object_numerics_debug
[  4%] Building CXX object source/numerics/CMakeFiles/object_numerics_debug.dir/unity_0.cc.o
In file included from /home/user/Downloads/git-files/dealii/build/source/numerics/unity_0.cc:5:
In file included from /home/user/Downloads/git-files/dealii/source/numerics/data_out.cc:16:
In file included from /home/user/Downloads/git-files/dealii/include/deal.II/base/work_stream.h:20:
In file included from /home/user/Downloads/git-files/dealii/build/include/deal.II/base/config.h:584:
/home/user/Downloads/git-files/dealii/include/deal.II/base/numbers.h:533:12: warning: explicit comparison with NaN in fast floating point mode [-Wtautological-constant-compare]
    return std::isnan(x);
           ^~~~~~~~~~~~~
In file included from /home/user/Downloads/git-files/dealii/build/source/numerics/unity_0.cc:10:
In file included from /home/user/Downloads/git-files/dealii/source/numerics/dof_output_operator.cc:23:
In file included from /home/user/Downloads/git-files/dealii/include/deal.II/lac/petsc_block_vector.h:27:
In file included from /home/user/Downloads/git-files/dealii/include/deal.II/lac/petsc_vector.h:29:
/home/user/Downloads/git-files/dealii/include/deal.II/lac/petsc_vector_base.h:1324:55: error: no matching constructor for initialization of 'boost::serialization::array_wrapper<const double>'
    boost::serialization::array_wrapper<const double> wrapper(
                                                      ^
/media/storage/local_opt/boost/include/boost/serialization/array_wrapper.hpp:46:5: note: candidate constructor not viable: no known conversion from 'const PetscScalar *' (aka 'const complex<double> *') to 'const double *' for 1st argument
    array_wrapper(T * t, std::size_t s) :
    ^
/media/storage/local_opt/boost/include/boost/serialization/array_wrapper.hpp:41:5: note: candidate constructor not viable: requires single argument 'rhs', but 2 arguments were provided
    array_wrapper(const array_wrapper & rhs) :
    ^
In file included from /home/user/Downloads/git-files/dealii/build/source/numerics/unity_0.cc:10:
In file included from /home/user/Downloads/git-files/dealii/source/numerics/dof_output_operator.cc:23:
In file included from /home/user/Downloads/git-files/dealii/include/deal.II/lac/petsc_block_vector.h:27:
In file included from /home/user/Downloads/git-files/dealii/include/deal.II/lac/petsc_vector.h:29:
/home/user/Downloads/git-files/dealii/include/deal.II/lac/petsc_vector_base.h:1363:49: error: no matching constructor for initialization of 'boost::serialization::array_wrapper<double>'
    boost::serialization::array_wrapper<double> velocity_wrapper(
                                                ^
/media/storage/local_opt/boost/include/boost/serialization/array_wrapper.hpp:46:5: note: candidate constructor not viable: no known conversion from 'PetscScalar *' (aka 'complex<double> *') to 'double *' for 1st argument
    array_wrapper(T * t, std::size_t s) :
    ^
/media/storage/local_opt/boost/include/boost/serialization/array_wrapper.hpp:41:5: note: candidate constructor not viable: requires single argument 'rhs', but 2 arguments were provided
    array_wrapper(const array_wrapper & rhs) :
    ^
1 warning and 2 errors generated.
make[2]: *** [source/numerics/CMakeFiles/object_numerics_debug.dir/build.make:76: source/numerics/CMakeFiles/object_numerics_debug.dir/unity_0.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1805: source/numerics/CMakeFiles/object_numerics_debug.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

PETSc was configured to use complex values. The same for deal.II, but I still get that error. CMakeCache is attached, but how can I fix that problem?
Thanks!
Regards,
Roland Richter
CMakeCache.txt

Daniel Arndt

unread,
Oct 15, 2023, 12:05:02 PM10/15/23
to dea...@googlegroups.com
Roland,

Using PETSc with complex values is pretty niche and there isn't much CI in place for this case.
It looks like

  boost::serialization::array_wrapper<const double> wrapper(

should be replaced with

  boost::serialization::array_wrapper<const PetscScalar> wrapper(

and similarly in VectorBase::load.

Best,
Daniel

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/ddde2d6a-3423-4d56-88ff-dfe7473236e1n%40googlegroups.com.

Wolfgang Bangerth

unread,
Oct 15, 2023, 2:00:27 PM10/15/23
to dea...@googlegroups.com
On 10/15/23 10:04, Daniel Arndt wrote:
>
> Using PETSc with complex values is pretty niche and there isn't much CI in
> place for this case.
> It looks like
>
>   boost::serialization::array_wrapper<const double> wrapper(
>
> should be replaced with
>
>   boost::serialization::array_wrapper<const PetscScalar> wrapper(
>
> and similarly in VectorBase::load.

Now also here:
https://github.com/dealii/dealii/issues/16146
Patches are, as always, very much welcome!

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


develo...@googlemail.com

unread,
Oct 16, 2023, 2:14:31 AM10/16/23
to deal.II User Group
And it's already fixed, thanks for the fast help! I was already wondering what had changed, as this configuration had worked for me before.
Thanks!
Regards,
Roland
Reply all
Reply to author
Forward
0 new messages