Xiangyu-Hu / SPHinXsys

SPHinXsys provides C++ APIs for engineering simulation and optimization. It aims at complex systems driven by fluid, structure, multi-body dynamics and beyond. The multi-physics library is based on a unique and unified computational framework by which strong coupling has been achieved for all involved physics.

Home Page:https://www.sphinxsys.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SPHinXsys build error

hasantahir opened this issue · comments

Host: x64-Linux
Compiler: GNU 11.3.0

After following the instructions on the website, I am unable to build SPHinXsys on Ubuntu 22.04.1. I get the following during the build process:

-- The CXX compiler identification is GNU 11.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test DETECTED_SSE_42
-- Performing Test DETECTED_SSE_42 - Success
-- Performing Test DETECTED_SSE_41
-- Performing Test DETECTED_SSE_41 - Success
-- Performing Test DETECTED_SSE_30
-- Performing Test DETECTED_SSE_30 - Success
-- Performing Test DETECTED_AVX_20
-- Performing Test DETECTED_AVX_20 - Success
-- Performing Test DETECTED_AVX_10
-- Performing Test DETECTED_AVX_10 - Success
-- Performing Test DETECTED_FMA
-- Performing Test DETECTED_FMA - Success
-- Performing Test DETECTED_NEON
-- Performing Test DETECTED_NEON - Failed
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found Boost: /home/hasan/vcpkg/installed/x64-linux/include (found version "1.80.0")  
-- The C compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Python3: /home/hasan/vcpkg/installed/x64-linux/tools/python3/python3.10 (found version "3.10.5") found components: Interpreter Development Development.Module Development.Embed 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hasan/sphinxsys/build

After invoking cmake --build build/, I get the following error:

[ 51%] Building CXX object SPHINXsys/src/CMakeFiles/sphinxsys_3d.dir/for_3D_build/geometries/geometric_shape.cpp.o
[ 51%] Building CXX object SPHINXsys/src/CMakeFiles/sphinxsys_3d.dir/for_3D_build/geometries/image_shape.cpp.o
In file included from /home/hasan/sphinxsys/SPHINXsys/src/shared/common/image_mhd.h:163,
                 from /home/hasan/sphinxsys/SPHINXsys/src/for_3D_build/geometries/image_shape.h:35,
                 from /home/hasan/sphinxsys/SPHINXsys/src/for_3D_build/geometries/image_shape.cpp:3:
/home/hasan/sphinxsys/SPHINXsys/src/shared/common/image_mhd.hpp: In member function ‘SPH::Vec3d SPH::ImageMHD<T, nDims>::findClosestPoint(const Vec3d&) [with T = float; int nDims = 3]’:
/home/hasan/sphinxsys/SPHINXsys/src/shared/common/image_mhd.hpp:385:33: error: ‘this_cell.Eigen::Matrix<int, 3, 1, 0, 3, 1>::<unnamed>.Eigen::PlainObjectBase<Eigen::Matrix<int, 3, 1, 0, 3, 1> >::m_storage.Eigen::DenseStorage<int, 3, 3, 1, 0>::m_data.Eigen::internal::plain_array<int, 3, 0, 0>::array[2]’ may be used uninitialized [-Werror=maybe-uninitialized]
  385 |                 Vec3d p_image = Vec3d(this_cell[0], this_cell[1], this_cell[2]) + n.normalized() * d;
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/hasan/sphinxsys/SPHINXsys/src/shared/common/image_mhd.hpp:367:23: note: ‘this_cell’ declared here
  367 |                 Vec3i this_cell;
      |                       ^~~~~~~~~
/home/hasan/sphinxsys/SPHINXsys/src/shared/common/image_mhd.hpp:385:33: error: ‘*(__vector(2) int*)((char*)&this_cell + offsetof(Eigen::Vec3i, Eigen::Matrix<int, 3, 1, 0, 3, 1>::<unnamed>.Eigen::PlainObjectBase<Eigen::Matrix<int, 3, 1, 0, 3, 1> >::<unnamed>.Eigen::MatrixBase<Eigen::Matrix<int, 3, 1, 0, 3, 1> >::<unnamed>.Eigen::DenseBase<Eigen::Matrix<int, 3, 1, 0, 3, 1> >::<unnamed>.Eigen::DenseCoeffsBase<Eigen::Matrix<int, 3, 1, 0, 3, 1>, 3>::<unnamed>.Eigen::DenseCoeffsBase<Eigen::Matrix<int, 3, 1, 0, 3, 1>, 1>::<unnamed>.Eigen::DenseCoeffsBase<Eigen::Matrix<int, 3, 1, 0, 3, 1>, 0>::<unnamed>))’ may be used uninitialized [-Werror=maybe-uninitialized]
  385 |                 Vec3d p_image = Vec3d(this_cell[0], this_cell[1], this_cell[2]) + n.normalized() * d;
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/hasan/sphinxsys/SPHINXsys/src/shared/common/image_mhd.hpp:367:23: note: ‘this_cell’ declared here
  367 |                 Vec3i this_cell;
      |                       ^~~~~~~~~
cc1plus: all warnings being treated as errors
gmake[2]: *** [SPHINXsys/src/CMakeFiles/sphinxsys_3d.dir/build.make:1182: SPHINXsys/src/CMakeFiles/sphinxsys_3d.dir/for_3D_build/geometries/image_shape.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1800: SPHINXsys/src/CMakeFiles/sphinxsys_3d.dir/all] Error 2
gmake: *** [Makefile:101: all] Error 2

Any suggestions on how to get over the errors will be appreciated.

Thanks,
Hasan

I was able to successfully build and run the test cases on a Windows machine. Followed the same set of instructions on the Installation tutorial page. Thanks.

I am facing the exact same build error in Ubuntu Linux, how do I solve this issue? It seems like this_cell has not been initialized on line 367,and I don't know what value I should initialize it with.

Merge of the update to support 22.04 is pending: #197 One can checkout, reproduce or cherry pick the commit easily until merged.

Thanks @FabienPean-Virtonomy. Hoping your commit be merged soon.