0

In the Vc project, OptimizeForArchitecture.cmake is used to optimize compilation for specific architectures.

In my project, I used the old version of the above file. After I update it to the newest version, the compilation flags in flags.make files have the following flags seperated by semicolons:

-march=broadwell;-msse2;-msse3;-mssse3;-msse4.1;-msse4.2;-mavx;-mfma;-mbmi2;-mavx2

which accouts for the following errors when compiling:

/bin/sh: 1: -msse2: not found
/bin/sh: 1: -msse3: not found
/bin/sh: 1: -mssse3: not found
/bin/sh: 1: -msse4.1: not found
/bin/sh: 1: -msse4.2: not found
/bin/sh: 1: -mavx: not found
/bin/sh: 1: -mfma: not found
/bin/sh: 1: -mbmi2: not found
/bin/sh: 1: -mavx2: not found

While when compiling the Vc project, there are no semicolons between the flags.

What's the possible reason of this problem?

A flags.make file example: build/release/CMakeFiles/tungsten.dir/flags.make

CXX_FLAGS =  -std=c++0x -march=broadwell;-msse2;-msse3;-mssse3;-msse4.1;-msse4.2;-mavx;-mfma;-mbmi2;-mavx2 -mno-sse4a -mno-xop -mno-fma4 -mno-avx512f -mno-avx512vl -mno-avx512pf -mno-avx512er -mno-avx512cd -mno-avx512dq -mno-avx512bw -mno-avx512ifma -mno-avx512vbmi -Wall -Wextra -Wpointer-arith -Wcast-align -fstrict-aliasing -Wno-unused-local-typedefs -Wno-misleading-indentation -Wno-maybe-uninitialized -Wno-int-in-bool-context -Wno-implicit-fallthrough -fvisibility-inlines-hidden -O3 -DNDEBUG
chaosink
  • 1,329
  • 13
  • 27
  • In CMake semicolon (`;`) separates elements of a list variable. However, error `/bin/sh: 1: -msse2: not found` suggests that you pass a flag as a separate command instead of the option to the linker/compiler. – Tsyvarev Oct 15 '17 at 12:15
  • @Tsyvarev Yes. It's because CMake generates semicolons in the `flags.make` files. `-march=broadwell;-msse2;-msse3;-mssse3;-msse4.1;-msse4.2;-mavx;-mfma;-mbmi2;-mavx2` should be `-march=broadwell -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mfma -mbmi2 -mavx2`, which is the `Vc` project case. Why would CMake generate these semicolons? – chaosink Oct 15 '17 at 12:33
  • @Tsyvarev A `flags.make` file example is added. – chaosink Oct 15 '17 at 12:42
  • Compiler flags (*CXX_FLAGS* property) should be **space-separated**, not *semicolon-separated* (as list). Looks like the project adds some flags incorrectly. According to `flags.make` content, only `-m...` flags are added incorrectly, other flags (including `-mno-..`) are correct. – Tsyvarev Oct 15 '17 at 15:17
  • @Tsyvarev Yes. Don't know the reason. – chaosink Oct 16 '17 at 16:06

0 Answers0