Skip to content

Build fails due to incomplete type in util.h #6

@ecomaikgolf

Description

@ecomaikgolf

Error message:

In file included from /home/ecomaikgolf/git/hybrid-HE-framework/build/tests/../../ciphers/he_only/plain/../../common_Zp/kats.h:13,
                 from /home/ecomaikgolf/git/hybrid-HE-framework/build/tests/../../ciphers/he_only/plain/testvectors.h:3,
                 from /home/ecomaikgolf/git/hybrid-HE-framework/build/tests/he_only_test.cpp:1:
/home/ecomaikgolf/git/hybrid-HE-framework/build/tests/../../ciphers/he_only/plain/../../common_Zp/../common/utils.h: In member function ‘void utils::SeededRandom::init_shake(std::array<unsigned char, 16>&)’:
/home/ecomaikgolf/git/hybrid-HE-framework/build/tests/../../ciphers/he_only/plain/../../common_Zp/../common/utils.h:130:50: error: invalid use of incomplete type ‘struct std::array<unsigned char, 16>’
  130 |     if (SUCCESS != Keccak_HashUpdate(&shake128_, seed.data(), seed.size() * 8))
      |                                                  ^~~~
In file included from /usr/include/c++/13/bits/memory_resource.h:47,
                 from /usr/include/c++/13/string:58,
                 from /usr/include/c++/13/bits/locale_classes.h:40,
                 from /usr/include/c++/13/bits/ios_base.h:41,
                 from /usr/include/c++/13/streambuf:43,
                 from /usr/include/c++/13/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/13/iterator:66,
                 from /home/ecomaikgolf/git/hybrid-HE-framework/build/tests/../../ciphers/he_only/plain/../../common_Zp/kats.h:6:
/usr/include/c++/13/tuple:2005:45: note: declaration of ‘struct std::array<unsigned char, 16>’
 2005 |   template<typename _Tp, size_t _Nm> struct array;
      |                                             ^~~~~
/home/ecomaikgolf/git/hybrid-HE-framework/build/tests/../../ciphers/he_only/plain/../../common_Zp/../common/utils.h:130:63: error: invalid use of incomplete type ‘struct std::array<unsigned char, 16>’
  130 |     if (SUCCESS != Keccak_HashUpdate(&shake128_, seed.data(), seed.size() * 8))
      |                                                               ^~~~
/usr/include/c++/13/tuple:2005:45: note: declaration of ‘struct std::array<unsigned char, 16>’
 2005 |   template<typename _Tp, size_t _Nm> struct array;
      |                                             ^~~~~
/home/ecomaikgolf/git/hybrid-HE-framework/build/tests/../../ciphers/he_only/plain/../../common_Zp/../common/utils.h: In member function ‘void utils::SeededRandom::init_shake(uint64_t, uint64_t)’:
/home/ecomaikgolf/git/hybrid-HE-framework/build/tests/../../ciphers/he_only/plain/../../common_Zp/../common/utils.h:137:29: error: aggregate ‘std::array<unsigned char, 16> seed’ has incomplete type and cannot be defined
  137 |     std::array<uint8_t, 16> seed;

Compiler version:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04.1' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-aYxV0E/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-aYxV0E/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04.1) 

Fix:

diff --git a/ciphers/common/utils.h b/ciphers/common/utils.h
index ba0445e..cb44bd0 100644
--- a/ciphers/common/utils.h
+++ b/ciphers/common/utils.h
@@ -6,6 +6,7 @@
 #include <iterator>
 #include <random>
 #include <vector>
+#include <array>
 #ifdef _WIN32
 #include <Windows.h>
 #include <bcrypt.h>
diff --git a/thirdparty/HElib b/thirdparty/HElib
--- a/thirdparty/HElib
+++ b/thirdparty/HElib
@@ -1 +1 @@
-Subproject commit d7be6f0dca6fa6cad2b2a0923d024ac27ce2e445
+Subproject commit d7be6f0dca6fa6cad2b2a0923d024ac27ce2e445-dirty

Just including <array> in ciphers/common/utils.h

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions