velox icon indicating copy to clipboard operation
velox copied to clipboard

build error - use of deleted function 'std::hash<__int128>::hash()'

Open ZJie1 opened this issue 3 years ago • 3 comments

Hi all, I was trying to build the code and got the below error message. Does anyone met the similar error before or know why this happens and how to fix? Thank you very much!

velox/./velox/type/UnscaledLongDecimal.h: In member function 'std::size_t std::hash<facebook::velox::UnscaledLongDecimal>::operator()(const facebook::velox::UnscaledLongDecimal&) const':
velox/./velox/type/UnscaledLongDecimal.h:199:29: error: use of deleted function 'std::hash<__int128>::hash()'
  199 |     return hash<__int128_t>()(val.unscaledValue());
      |                             ^
In file included from /usr/include/c++/9/string_view:43,
                 from /usr/include/c++/9/bits/basic_string.h:48,
                 from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/stdexcept:39,
                 from /usr/include/c++/9/array:39,
                 from /velox/common/memory/MappedMemory.h:19,
                 from /velox/common/memory/AllocationPool.h:18,
                 from /velox/common/memory/AllocationPool.cpp:16:
/usr/include/c++/9/bits/functional_hash.h:101:12: note: 'std::hash<__int128>::hash()' is implicitly deleted because the default definition would be ill-formed:
  101 |     struct hash : __hash_enum<_Tp>
      |            ^~~~
/usr/include/c++/9/bits/functional_hash.h:101:12: error: no matching function for call to 'std::__hash_enum<__int128, false>::__hash_enum()'
/usr/include/c++/9/bits/functional_hash.h:82:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = __int128; bool <anonymous> = false]'
   82 |       __hash_enum(__hash_enum&&);
      |       ^~~~~~~~~~~
/usr/include/c++/9/bits/functional_hash.h:82:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/9/bits/functional_hash.h:101:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = __int128; bool <anonymous> = false]' is private within this context
  101 |     struct hash : __hash_enum<_Tp>
      |            ^~~~
/usr/include/c++/9/bits/functional_hash.h:83:7: note: declared private here
   83 |       ~__hash_enum();

ZJie1 avatar Oct 19 '22 09:10 ZJie1

CC: @kgpai @raulcd

mbasmanova avatar Oct 19 '22 12:10 mbasmanova

CC: @karteekmurthys @majetideepak

mbasmanova avatar Oct 19 '22 12:10 mbasmanova

hi @ZJie1 ! Could you share more details on architecture and OS where you are building and what are the steps that you followed? I can see /usr/include/c++/9, could you share the version of gcc you are using?

raulcd avatar Oct 20 '22 11:10 raulcd

Hi raulcd, the architecture is x86_64 , and I build the code in the docker. Actually, we use the velox as submodule when we met this error. Below is the gcc version and os version.

 > gcc --version            
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"

ZJie1 avatar Oct 21 '22 09:10 ZJie1

Thanks for your response, when you say you are using Docker do you mean our provided docker-compose: https://github.com/facebookincubator/velox#building-velox-with-docker-compose and our Dockerfile: https://github.com/facebookincubator/velox/blob/main/scripts/ubuntu-22.04-cpp.dockerfile or did you use your own Dockerfile? If you are using your own, could you share a minimal Dockerfile, it should be reproducible on Docker and I could try to investigate there.

raulcd avatar Oct 21 '22 09:10 raulcd

Hi raulcd, thanks for your help. We use our own Dockerfile and solve this by setting CMAKE_CXX_EXTENSIONS = ON.

ZJie1 avatar Oct 24 '22 03:10 ZJie1

Hi @ZJie1 ! Thanks for your answer! I understand that this is solved then? Should we solve the issue? From what I understand you were using your own CMake file and not using the provided setup shell scripts provided? Trying to understand how to solve possible future issues for people facing the same problem in the future. Thanks for answering!

raulcd avatar Oct 24 '22 09:10 raulcd

Yes, It's solved. I will close it. Yes, we have our own cmake files.

Hi @ZJie1 ! Thanks for your answer! I understand that this is solved then? Should we solve the issue? From what I understand you were using your own CMake file and not using the provided setup shell scripts provided? Trying to understand how to solve possible future issues for people facing the same problem in the future. Thanks for answering!

ZJie1 avatar Oct 24 '22 09:10 ZJie1