ermig1979 / Simd

C++ image processing and machine learning library with using of SIMD: SSE, AVX, AVX-512, AMX for x86/x64, VMX(Altivec) and VSX(Power7) for PowerPC, NEON for ARM.
http://ermig1979.github.io/Simd
MIT License
2.01k stars 407 forks source link

Build error on windows with clang #258

Closed fspindle closed 8 months ago

fspindle commented 12 months ago

I'm unable to build the project on windows with clang coming with Visual Studio 2022.

To reproduce the build error:

$ git clone https://github.com/ermig1979/Simd
$ cd Simd
$ mkdir build
$ cd build
$ cmake ..\prj\cmake -G "Visual Studio 17 2022" -T "ClangCl" -A "x64"
$ cmake --build . --config Release

It produces the following error:

clang-cl : warning : unknown argument ignored in clang-cl: '-fPIC' [-Wunknown-argument] [C:\temp\Simd\build\Simd.vcxpro
j]
clang-cl : warning : unknown argument ignored in clang-cl: '-std=c++11' [-Wunknown-argument] [C:\temp\Simd\build\Simd.v
cxproj]
clang-cl : warning : argument unused during compilation: '-O3' [-Wunused-command-line-argument] [C:\temp\Simd\build\Sim
d.vcxproj]
  In file included from C:\temp\Simd\src\Simd\SimdLib.cpp:55:
C:\temp\Simd\prj\cmake\..\..\src\Simd/SimdLib.h(2992,14): error : an attribute list cannot appear here [C:\temp\Simd\bu
ild\Simd.vcxproj]
C:\temp\Simd\prj\cmake\..\..\src\Simd/SimdLib.h(81,25): message : expanded from macro 'SIMD_DEPRECATED' [C:\temp\Simd\b
uild\Simd.vcxproj]
C:\temp\Simd\prj\cmake\..\..\src\Simd/SimdLib.h(3021,14): error : an attribute list cannot appear here [C:\temp\Simd\bu
ild\Simd.vcxproj]
C:\temp\Simd\prj\cmake\..\..\src\Simd/SimdLib.h(81,25): message : expanded from macro 'SIMD_DEPRECATED' [C:\temp\Simd\b
uild\Simd.vcxproj]
C:\temp\Simd\prj\cmake\..\..\src\Simd/SimdLib.h(3052,14): error : an attribute list cannot appear here [C:\temp\Simd\bu
ild\Simd.vcxproj]
C:\temp\Simd\prj\cmake\..\..\src\Simd/SimdLib.h(81,25): message : expanded from macro 'SIMD_DEPRECATED' [C:\temp\Simd\b
uild\Simd.vcxproj]
C:\temp\Simd\prj\cmake\..\..\src\Simd/SimdLib.h(3084,14): error : an attribute list cannot appear here [C:\temp\Simd\bu
ild\Simd.vcxproj]
C:\temp\Simd\prj\cmake\..\..\src\Simd/SimdLib.h(81,25): message : expanded from macro 'SIMD_DEPRECATED' [C:\temp\Simd\b
uild\Simd.vcxproj]
C:\temp\Simd\prj\cmake\..\..\src\Simd/SimdLib.h(3121,14): error : an attribute list cannot appear here [C:\temp\Simd\bu
ild\Simd.vcxproj]
C:\temp\Simd\prj\cmake\..\..\src\Simd/SimdLib.h(81,25): message : expanded from macro 'SIMD_DEPRECATED' [C:\temp\Simd\b
uild\Simd.vcxproj]
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
ermig1979 commented 12 months ago

Hi!

There is no possibility to compile Simd sach way yet.

fwsGonzo commented 11 months ago

I fixed it by moving the deprecated macro to before the inline macro.

razaqq commented 8 months ago

Yes please change the macro order from SIMD_API SIMD_DEPRECATED to SIMD_DEPRECATED SIMD_API. The standard says explicitly In declarations, attributes may appear both before the whole declaration and directly after the name of the entity that is declared, in which case they are combined.

ermig1979 commented 8 months ago

Hi. I chenged the macro order from SIMD_API SIMD_DEPRECATED to SIMD_DEPRECATED SIMD_API.

razaqq commented 8 months ago

Perfect, you can close this then