martinus / robin-hood-hashing

Fast & memory efficient hashtable based on robin hood hashing for C++11/14/17/20
https://gitter.im/martinus/robin-hood-hashing
MIT License
1.5k stars 142 forks source link

_tzcnt_u32(unsigned int) target specific option mismatch #98

Closed Aivean closed 3 years ago

Aivean commented 3 years ago

Hi, I'm trying to adopt your map implementation in the Catalysm-DDA project (btw, thank you for your work, so far the performance improvement looks impressive).

However, I'm getting the following error when cross-compiling to Windows using i686-w64-mingw32.static-g++ (gcc 5.4.0 , Ubuntu 5.4.0-6ubuntu1~16.04.12):

error log ``` In file included from /usr/lib/mxe/usr/lib/gcc/i686-w64-mingw32.static/5.5.0/include/immintrin.h:75:0, from /usr/lib/mxe/usr/lib/gcc/i686-w64-mingw32.static/5.5.0/include/x86intrin.h:46, from /usr/lib/mxe/usr/lib/gcc/i686-w64-mingw32.static/5.5.0/include/c++/i686-w64-mingw32.static/bits/opt_random.h:33, from /usr/lib/mxe/usr/lib/gcc/i686-w64-mingw32.static/5.5.0/include/c++/random:50, from pch/main-pch.hpp:41: /usr/lib/mxe/usr/lib/gcc/i686-w64-mingw32.static/5.5.0/include/bmiintrin.h: In member function 'void robin_hood::detail::Table::Iter::fastForward() [with bool IsConst = false; bool IsFlat = false; unsigned int MaxLoadFactor100 = 80u; Key = std::__cxx11::basic_string; T = tile_type; Hash = robin_hood::hash >; KeyEqual = std::equal_to >]': /usr/lib/mxe/usr/lib/gcc/i686-w64-mingw32.static/5.5.0/include/bmiintrin.h:104:1: error: inlining failed in call to always_inline 'unsigned int _tzcnt_u32(unsigned int)': target specific option mismatch _tzcnt_u32 (unsigned int __X) ^ In file included from src/cata_tiles.h:23:0, from src/cata_tiles.cpp:2: src/robin_hood.h:1327:42: error: called from here auto inc = ROBIN_HOOD_COUNT_TRAILING_ZEROES( n ) / 8; ^ In file included from /usr/lib/mxe/usr/lib/gcc/i686-w64-mingw32.static/5.5.0/include/immintrin.h:75:0, from /usr/lib/mxe/usr/lib/gcc/i686-w64-mingw32.static/5.5.0/include/x86intrin.h:46, from /usr/lib/mxe/usr/lib/gcc/i686-w64-mingw32.static/5.5.0/include/c++/i686-w64-mingw32.static/bits/opt_random.h:33, from /usr/lib/mxe/usr/lib/gcc/i686-w64-mingw32.static/5.5.0/include/c++/random:50, from pch/main-pch.hpp:41: /usr/lib/mxe/usr/lib/gcc/i686-w64-mingw32.static/5.5.0/include/bmiintrin.h:104:1: error: inlining failed in call to always_inline 'unsigned int _tzcnt_u32(unsigned int)': target specific option mismatch _tzcnt_u32 (unsigned int __X) ^ In file included from src/cata_tiles.h:23:0, from src/cata_tiles.cpp:2: src/robin_hood.h:1327:42: error: called from here auto inc = ROBIN_HOOD_COUNT_TRAILING_ZEROES( n ) / 8; ^ ```

Here's the full build log.

Is this the result of the incorrect bitness detection because of the cross-compiling setup?

martinus commented 3 years ago

Hi Aivean! Can you give the latest version a try: https://raw.githubusercontent.com/martinus/robin-hood-hashing/master/src/include/robin_hood.h

If that alone doesn't work, you can try to #define ROBIN_HOOD_DISABLE_INTRINSICS 1 before including robin_hood.h

Aivean commented 3 years ago

Thank you! I'll try both suggestions and report the results back.

Aivean commented 3 years ago

The last version compiled without the problems. Thank you!