-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows x86-64 Clang compiler fails to compile because of lacking -mavx2 #658
Comments
This is not really a solution, because adding -mavx2 breaks runtime detection. The resulting binary will probably not work on any system that does not have AVX2. This bit of configuration should handle this: flac/src/libFLAC/CMakeLists.txt Lines 21 to 23 in 72787c3
But perhaps that code does not work with Clang+MSVC? I have no clue how that hybrid is supposed to work. Could you perhaps share a the CMakeCache.txt file that your configuration produces, and the cmake console output? |
It seems everything go well in the cmake console output
Here is the CMakeCache.txt Also, I found out that if a user choose to pre-build libogg, you will encounter errors. If I choose to build with ogg
And use flac linking to this pre-built library by assigning there positon:
You will get linker errors, complaining symbols not found. It turns out that it might be some mistakes in CMakeLists.txt: You can't simply judge whether |
I can't seem to figure out what the problem is. There is a lot if-then-else stuff that assumes a compiler is either clang or msvc, not both, so there is probably something going wrong there. I'm currently not able to investigate this any further.
There is nothing wrong with that, those files belong to FLAC, not to ogg.
WITH_OGG will look for a subdirectory called ogg. If it is there, it will include it as a subdirectory and build from source. If it doesn't find that directory, it will look for headers and binary libraries. |
Okay, I finally looked into this. Why are you selecting Ninja as generator when building with CMake for Visual Studio? It seems to me you should be using Visual Studio's own build system? If I use |
Thank you for your patience. Well, I don't think it's related to building systems. I think I could use any generator, no matter it is Ninja, mingw32-make or nmake and the result would not change. The reason I'm not using Visual Studio building system is that I'm having nothing to do ;-) and be struck on a whim trying to build this awesome program with other compilers. Just in case someone as bored as me is going to build it with clang or gcc on Windows? After through testing with To build with |
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:
and I got the error
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.The text was updated successfully, but these errors were encountered: