Skip to content

Windows x86-64 Clang compiler fails to compile because of lacking -mavx2 #658

Open
@Rt39

Description

@Rt39

I'm compileing flac on Windows x86-64 with Clang version 17.0.1 and targeting at x86_64-pc-windows-msvc with Visual Studio 2022 installed. This is the command I used to configure:

cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DWITH_OGG=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DBUILD_DOCS=OFF -DINSTALL_MANPAGES=OFF -DINSTALL_PKGCONFIG_MODULES=OFF -DCMAKE_INSTALL_PREFIX="D:\flac"

and I got the error

C:/Users/Administrator/Downloads/Compressed/flac-master/src/libFLAC/stream_encoder_intrin_avx2.c:65:5: error: use of undeclared identifier '__m256i'
   65 |                                 __m256i sum256 = _mm256_setzero_si256();
      |                                 ^
C:/Users/Administrator/Downloads/Compressed/flac-master/src/libFLAC/stream_encoder_intrin_avx2.c:70:6: error: use of undeclared identifier '__m256i'
   70 |                                         __m256i res256 = _mm256_abs_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(residual+residual_sample)));
      |

It seems you need to add compile flag -mavx2 to the compiler, where I add the -DCMAKE_CXX_FLAGS="-mavx2" -DCMAKE_C_FLAGS="-mavx2" to the command and everthing works well.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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