Error compiling Boost.Log

0

I am trying to compile the boost log library and I keep getting this error from the dump_avx2.cpp file

error: always_inline function '_mm256_set1_epi32' requires target feature 'sse4.2', but would be inlined into function 'dump_data_avx2' that is compiled without support for 'sse4.2'
boost/boost/libs/log/src/dump_avx2.cpp:71:31: note: expanded from macro 'BOOST_LOG_AUX_MM_CONSTANTS'
    const __m256i mm_char_0 = _mm256_set1_epi32(0x30303030);\
                              ^

I get a lot of errors that are very similar to the one above, all of them have the same error message but different locations in the file where they occur, for reference I am on the commit hash 68701167a1020b0b4c47b76e31d3a3da9e2faf3f for the Boost.Log submodule as fetched from the github repo (https://github.com/boostorg/boost)

Does anyone know how I can go about resolving this issue? I am building with a C++14 compiler and this is what I get when I type g++ --version

Apple LLVM version 8.0.0 (clang-800.0.42.1)

Thanks!

Note I should clarify that in this context it is required that I compile this library separately.

Note There seem to be two related source files dump_ssse3.cpp and the mentioned dump_avx2.cpp file, do I have to compile only one of them? I cannot make out what to do from the Jamfile in the build folder :(

c++
boost
compiler-errors
boost-log
asked on Stack Overflow Jan 1, 2017 by Curious • edited Jan 1, 2017 by ildjarn

1 Answer

1

That looks like a bug in clang (LLVM). First, the intrinsic belongs to AVX2, not SSE4.2. Second, the whole dump_avx2.cpp file is compiled with -mavx2, so the required extensions are enabled. You can see the compiler switches in the error message from b2. And no, both dump_ssse3.cpp and dump_avx2.cpp should be compiled. The library does runtime detection of the available instructions in the CPU and selects the proper implementation.

answered on Stack Overflow Jan 1, 2017 by Andrey Semashev

User contributions licensed under CC BY-SA 3.0