Today I tried to compile the StructuralMechanics Application in my mac (after some weeks of not doing so), and got the following compilation error:
Scanning dependencies of target KratosStructuralMechanicsCore
[ 46%] Building CXX object applications/StructuralMechanicsApplication/CMakeFiles/KratosStructuralMechanicsCore.dir/structural_mechanics_application.cpp.o
[ 46%] Building CXX object applications/SolidMechanicsApplication/CMakeFiles/KratosSolidMechanicsCore.dir/custom_elements/beam_elements/geometrically_exact_rod_element.cpp.o
In file included from /Users/ipouplana/Kratos/applications/StructuralMechanicsApplication/structural_mechanics_application.cpp:20:
In file included from /Users/ipouplana/Kratos/applications/StructuralMechanicsApplication/structural_mechanics_application_variables.h:22:
In file included from /Users/ipouplana/Kratos/applications/StructuralMechanicsApplication/custom_utilities/shell_cross_section.hpp:23:
/Users/ipouplana/Kratos/kratos/includes/serializer.h:549:17: error: no member
named 'save' in 'std::__1::__bit_const_reference<std::__1::vector<bool,
std::__1::allocator<bool> > >'
rObject.save(*this);
~~~~~~~ ^
/Users/ipouplana/Kratos/kratos/includes/serializer.h:502:13: note: in
instantiation of function template specialization
'Kratos::Serializer::save<std::__1::__bit_const_reference<std::__1::vector<bool,
std::__1::allocator<bool> > > >' requested here
save("E", rObject[i]);
^
/Users/ipouplana/Kratos/applications/StructuralMechanicsApplication/custom_constitutive/truss_plasticity_constitutive_law.h:252:21: note:
in instantiation of function template specialization
'Kratos::Serializer::save<bool>' requested here
rSerializer.save("InelasticFlag", this->mInElasticFlagVector);
^
1 error generated.
make[2]: *** [applications/StructuralMechanicsApplication/CMakeFiles/KratosStructuralMechanicsCore.dir/structural_mechanics_application.cpp.o] Error 1
make[1]: *** [applications/StructuralMechanicsApplication/CMakeFiles/KratosStructuralMechanicsCore.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
I got this error in the current version of the 'master' branch (commit 6400624e867cbf76b7268f3a4abdabc1f2d87eff) and I have the following configuration:
-- The C compiler identification is Clang 7.0.1
-- The CXX compiler identification is Clang 7.0.1
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Deprecation Warning at CMakeLists.txt:8 (cmake_policy):
The OLD behavior for policy CMP0054 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- Found Git: /usr/bin/git (found version "2.17.2 (Apple Git-113)")
KRATOS_BUILD_TESTING not defined. Setting to ON
-- Found PythonInterp: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 (found version "3.6.6")
-- Found PythonLibs: /Library/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6m.dylib
-- Performing Test HAS_CPP14_FLAG
-- Performing Test HAS_CPP14_FLAG - Success
-- OpenMP included
-- Found OpenMP_C: -fopenmp=libomp (found version "3.1")
-- Found OpenMP_CXX: -fopenmp=libomp (found version "3.1")
-- Found OpenMP: TRUE (found version "3.1")
-- Boost version: 1.67.0
-- Boost Include: /Users/ipouplana/boost_1_67_0
-- Boost Linkdir:
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Found BLAS: /usr/lib/libblas.dylib
linker flags with blas =
BLA_VENDOR = All
-- Found BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
-- A library with LAPACK API found.
LAPACK = /usr/lib/liblapack.dylib
LAPACK modified = /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.11")
-- AMatrix not found. Please define the AMATRIX_DIR pointing to the AMatrix root directory.
CMAKE_BUILD_TYPE ........ Release
WARNING: YOUR GIDPOST IS BEING COMPILED WITHOUT DEBUG (ALL ASSERTS WILL BE AVOIDED)
-- Performing Test HAS_FLTO_THIN
-- Performing Test HAS_FLTO_THIN - Success
-- LTO enabled
***** LIST OF KRATOS APPLICATIONS THAT ARE GOING TO BE COMPILED: *****
CONVECTION_DIFFUSION_APPLICATION - ON
STRUCTURAL_MECHANICS_APPLICATION - ON
SOLID_MECHANICS_APPLICATION - ON
CONSTITUTIVE_MODELS_APPLICATION - ON
POROMECHANICS_APPLICATION - ON
DAM_APPLICATION - ON
FLUID_DYNAMICS_APPLICATION - ON
EXTERNAL_SOLVERS_APPLICATION - ON
**********************************************************************
****** LIST OF KRATOS APPLICATIONS THAT ARE SET TO OFF: **************
MESH_MOVING_APPLICATION - OFF
FSI_APPLICATION - OFF
MIXED_ELEMENT_APPLICATION - OFF
PFEM_FLUID_DYNAMICS_APPLICATION - OFF
DEM_APPLICATION - OFF
SWIMMING_DEM_APPLICATION - OFF
TRILINOS_APPLICATION - OFF
METIS_APPLICATION - OFF
MESHING_APPLICATION - OFF
SHAPE_OPTIMIZATION_APPLICATION - OFF
TOPOLOGY_OPTIMIZATION_APPLICATION - OFF
DELAUNAY_MESHING_APPLICATION - OFF
**********************************************************************
**** Configuring KratosExternalSolversApplication ****
**** configuring KratosConstitutiveModelsApplication ****
**** configuring KratosSolidMechanicsApplication ****
**** configuring KratosConvectionDiffusionApplication ****
**** configuring KratosStructuralMechanicsApplication ****
**** configuring KratosFluidDynamicsApplication ****
**** configuring KratosPoromechanicsApplication ****
**** configuring KratosDamApplication ****
-- triangle : /Users/ipouplana/Kratos/external_libraries/triangle
python libraries to be installed are: /Library/Frameworks/Python.framework/Versions/3.6/Python
-- Standard install dir /Users/ipouplana/Kratos
installed blas = /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
installed lapack = /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
-- Configuring done
The strange thing is that I did not get this error when compiling the same code using GCC 7.3.0 in Ubuntu 18.04...
Maybe I'm doing something wrong, but I don't know what is happening. Does someone have a clue on why I get the compilation error ?
Thanks in advance.
I will refer to @KlausBSautter
I have honestly no idea about mac. This is the first time I see this problem. It seems that it does not like std::vector<bool>.
@loumalouomega do you think a std::vector<int> with 0&1 instead of std::vector<bool> with False&True fixes this?. I cant check it as I dont have a mac
Hi @KlausBSautter , although I got this error in mac, I am not sure if this has anything to do with the OS system. Some weeks ago I successfully compiled the StructuralMechanicsApplication using the same macOS and Kratos configuration... Maybe the error appears in this Clang version (if I'm not mistaken, the Clang version of the nightly build is 3.8.0)
Hi @KlausBSautter , although I got this error in mac, I am not sure if this has anything to do with the OS system. Some weeks ago I successfully compiled the StructuralMechanicsApplication using the same macOS and Kratos configuration... Maybe the error appears in this Clang version (if I'm not mistaken, the Clang version of the nightly build is 3.8.0)
I would ask to @roigcarlo about Clang versions
I have honestly no idea about mac. This is the first time I see this problem. It seems that it does not like
std::vector<bool>.
@loumalouomega do you think astd::vector<int>with 0&1 instead ofstd::vector<bool>with False&True fixes this?. I cant check it as I dont have a mac
I would avoid that if possible
clang was working last time i check (this morning).
I know that @jcotela has some problems with Save and Load. Maybe its the same?
nightly build (last night) also worked
nightly build (last night) also worked
Yes... what I don't know is if the error appears because of the difference between Clang versions (mine->7.0.1 vs nightly build->3.8.0), or if it appears because macOS can't stand saving objects of std::vector\
std vector bool is a strange beast...however it occupies MUCH less memory (1/64) than a vector of ints (or 1/8 of vector of chars)
hm if it really is such a problem then I guess we can refactor ...
=> tmr @KlausBSautter
Seems that we should specialize the save and load also for vector<bool>. As @RiccardoRossi says, this vector has a completely different implementation which making it some how incompatible in this compilation.
@ipouplana can you try this a99a0600c07e7b9564246b1fcc471ceafe67ed23 ?
Ok, I鈥檒l try it asap
I just tried the master branch cherrypicking a99a0600c07e7b9564246b1fcc471ceafe67ed23 and it compiled! :D
I just tried the master branch cherrypicking a99a060 and it compiled! :D
then I'll create a pr
Thanks @KlausBSautter
Then I guess we can close this issue