Cyan4973 / xxHash

Extremely fast non-cryptographic hash algorithm
http://www.xxhash.com/
Other
8.93k stars 770 forks source link

XXH3 doesn't compile with MSVC #179

Closed mgieseki closed 5 years ago

mgieseki commented 5 years ago

First of all thanks for adding XXH3. It's an awesome addition to xxHash. While the recent sources build fine with MinGW, they failed to compile with MSVC (version19.16.27027, Visual Studio 2017 15.9.9) due to some unsupported #pragma and __attribute__ constructs. Here's the compiler output (sorry, I've only the German locale installed at the moment):

xxh3.h(148): error C2156: Pragma muss außerhalb der Funktion liegen
xxh3.h(616): error C2143: Syntaxfehler: Es fehlt ")" vor "("
xxh3.h(616): error C2059: Syntaxfehler: ")"
xxh3.h(617): error C2143: Syntaxfehler: Es fehlt ")" vor "Typ"
xxh3.h(617): error C2091: Funktionsergebnis ist eine Funktion
xxh3.h(618): error C2085: "XXH3_hashLong_64b": Nicht in der formalen Parameterliste enthalten
xxh3.h(618): error C2143: Syntaxfehler: Es fehlt ";" vor "{"
xxh3.h(619): error C2065: "seed": nichtdeklarierter Bezeichner
xxh3.h(621): error C2065: "data": nichtdeklarierter Bezeichner
xxh3.h(621): warning C4022: "XXH3_hashLong": Zeigertyp für übergebenen Parameter 2 stimmt nicht mit dem deklarierten Zeigertyp überein
xxh3.h(621): error C2065: "len": nichtdeklarierter Bezeichner
xxh3.h(625): error C2065: "len": nichtdeklarierter Bezeichner
xxh3.h(625): warning C4047: "return": Anzahl der Dereferenzierungen bei "int (__cdecl *)()" und "XXH64_hash_t" unterschiedlich
xxh3.h(741): error C2143: Syntaxfehler: Es fehlt ")" vor "("
xxh3.h(741): error C2059: Syntaxfehler: ")"
xxh3.h(742): error C2143: Syntaxfehler: Es fehlt ")" vor "Typ"
xxh3.h(742): error C2091: Funktionsergebnis ist eine Funktion
xxh3.h(742): error C2084: Funktion "int (__cdecl *__attribute__())()" hat bereits einen Funktionsrumpf
xxh3.h(616): note: Siehe vorherige Definition von "__attribute__"
xxh3.h(743): error C2085: "XXH3_hashLong_128b": Nicht in der formalen Parameterliste enthalten
xxh3.h(743): error C2143: Syntaxfehler: Es fehlt ";" vor "{"
xxh3.h(744): error C2065: "seed": nichtdeklarierter Bezeichner
xxh3.h(747): error C2065: "data": nichtdeklarierter Bezeichner
xxh3.h(747): warning C4022: "XXH3_hashLong": Zeigertyp für übergebenen Parameter 2 stimmt nicht mit dem deklarierten Zeigertyp überein
xxh3.h(747): error C2065: "len": nichtdeklarierter Bezeichner
xxh3.h(751): error C2065: "len": nichtdeklarierter Bezeichner
xxh3.h(752): error C2065: "len": nichtdeklarierter Bezeichner
xxh3.h(753): error C2440: "return": "XXH128_hash_t" kann nicht in "int (__cdecl *)()" konvertiert werden
xxh3.h(769): error C2440: "return": "int" kann nicht in "XXH128_hash_t" konvertiert werden
ifduyue commented 5 years ago

Same here https://ci.appveyor.com/project/duyue/python-xxhash/build/job/aruc62wqgfg4x5kn

Cyan4973 commented 5 years ago

Thanks for the report, yes I'm aware of these issues with Visual, and just built a Windows VM to debug them.

LambdAurora commented 5 years ago

I have some build issues too with MSVC.

When trying to build with cmake and BUILD_SHARED_LIBS=OFF, I got errors and some with the dllimport I added a while ago. I think I will try to look what's causing the issue.

And here's some of the logs:


"D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj" (cible par défaut) (3) ->
(ClCompile cible) ->
  D:\workspace\c\xxHash\xxHash\xxhash.c(254): error C2491: 'XXH_versionNumber' : définition de fonction dllimport non autori
sée [D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(431): error C2491: 'XXH32' : définition de fonction dllimport non autorisée [D:\work
space\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(455): error C2491: 'XXH32_createState' : définition de fonction dllimport non autori
sée [D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(459): error C2491: 'XXH32_freeState' : définition de fonction dllimport non autorisé
e [D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(465): error C2491: 'XXH32_copyState' : définition de fonction dllimport non autorisé
e [D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(470): error C2491: 'XXH32_reset' : définition de fonction dllimport non autorisée [D
:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(485): error C2491: 'XXH32_update' : définition de fonction dllimport non autorisée [
D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(548): error C2491: 'XXH32_digest' : définition de fonction dllimport non autorisée [
D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(575): error C2491: 'XXH32_canonicalFromHash' : définition de fonction dllimport non
autorisée [D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(582): error C2491: 'XXH32_hashFromCanonical' : définition de fonction dllimport non
autorisée [D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(864): error C2491: 'XXH64' : définition de fonction dllimport non autorisée [D:\work
space\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(887): error C2491: 'XXH64_createState' : définition de fonction dllimport non autori
sée [D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(891): error C2491: 'XXH64_freeState' : définition de fonction dllimport non autorisé
e [D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(897): error C2491: 'XXH64_copyState' : définition de fonction dllimport non autorisé
e [D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(902): error C2491: 'XXH64_reset' : définition de fonction dllimport non autorisée [D
:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(916): error C2491: 'XXH64_update' : définition de fonction dllimport non autorisée [
D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(976): error C2491: 'XXH64_digest' : définition de fonction dllimport non autorisée [
D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(1003): error C2491: 'XXH64_canonicalFromHash' : définition de fonction dllimport non
 autorisée [D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  D:\workspace\c\xxHash\xxHash\xxhash.c(1010): error C2491: 'XXH64_hashFromCanonical' : définition de fonction dllimport non
 autorisée [D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  d:\workspace\c\xxhash\xxhash\xxh3.h(635): error C2491: 'XXH3_64bits_withSeed' : définition de fonction dllimport non autor
isée [D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  d:\workspace\c\xxhash\xxhash\xxh3.h(669): error C2491: 'XXH3_64bits' : définition de fonction dllimport non autorisée [D:\
workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  d:\workspace\c\xxhash\xxhash\xxh3.h(769): error C2491: 'XXH3_128bits_withSeed' : définition de fonction dllimport non auto
risée [D:\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  d:\workspace\c\xxhash\xxhash\xxh3.h(807): error C2491: 'XXH3_128bits' : définition de fonction dllimport non autorisée [D:
\workspace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]
  d:\workspace\c\xxhash\xxhash\xxh3.h(813): error C2491: 'XXH128' : définition de fonction dllimport non autorisée [D:\works
pace\c\xxHash\xxHash\cmake_unofficial\build\xxhash.vcxproj]```
(And sorry, I only have the French locale installed.)
LambdAurora commented 5 years ago

Hello again, I made a fix for this issue: #181. Now it compiles fine with MSVC (Visual Studio 15 2017 v15.9.21).

Cyan4973 commented 5 years ago

Thanks @LambdAurora ,

compilation errors under Visual should be fixed by now.