Compiler Error: target specific option mismatch
Dabendorf opened this issue · 1 comments
Dabendorf commented
When compiling on Linux, I get the following errors:
In file included from /usr/lib64/gcc/x86_64-suse-linux/7/include/immintrin.h:79:0,
from /usr/lib64/gcc/x86_64-suse-linux/7/include/x86intrin.h:48,
from /vol/fob-vol4/nebenf17/schraluk/Masterarbeit/ALEX/src/core/alex_base.h:28,
from /vol/fob-vol4/nebenf17/schraluk/Masterarbeit/ALEX/src/core/alex.h:38,
from /vol/fob-vol4/nebenf17/schraluk/Masterarbeit/ALEX/test/unittest_alex.h:6,
from /vol/fob-vol4/nebenf17/schraluk/Masterarbeit/ALEX/test/unittest_main.cpp:7:
/usr/lib64/gcc/x86_64-suse-linux/7/include/lzcntintrin.h:64:1: error: inlining failed in call to always_inline ‘long long unsigned int _lzcnt_u64(long long unsigned int)’: target specific option mismatch
_lzcnt_u64 (unsigned long long __X)
^~~~~~~~~~
In file included from /vol/fob-vol4/nebenf17/schraluk/Masterarbeit/ALEX/src/core/alex_fanout_tree.h:13:0,
from /vol/fob-vol4/nebenf17/schraluk/Masterarbeit/ALEX/src/core/alex.h:39,
from /vol/fob-vol4/nebenf17/schraluk/Masterarbeit/ALEX/test/unittest_alex.h:6,
from /vol/fob-vol4/nebenf17/schraluk/Masterarbeit/ALEX/test/unittest_main.cpp:7:
/vol/fob-vol4/nebenf17/schraluk/Masterarbeit/ALEX/src/core/alex_nodes.h:2062:56: note: called from here
bit_pos - (63 - static_cast<int>(_lzcnt_u64(bitmap_left_gaps)));
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/lib64/gcc/x86_64-suse-linux/7/include/immintrin.h:79:0,
from /usr/lib64/gcc/x86_64-suse-linux/7/include/x86intrin.h:48,
from /vol/fob-vol4/nebenf17/schraluk/Masterarbeit/ALEX/src/core/alex_base.h:28,
from /vol/fob-vol4/nebenf17/schraluk/Masterarbeit/ALEX/src/core/alex.h:38,
from /vol/fob-vol4/nebenf17/schraluk/Masterarbeit/ALEX/test/unittest_alex.h:6,
from /vol/fob-vol4/nebenf17/schraluk/Masterarbeit/ALEX/test/unittest_main.cpp:7:
/usr/lib64/gcc/x86_64-suse-linux/7/include/lzcntintrin.h:64:1: error: inlining failed in call to always_inline ‘long long unsigned int _lzcnt_u64(long long unsigned int)’: target specific option mismatch
_lzcnt_u64 (unsigned long long __X)
This is in fact the same as stated in that issue here: #13
The problem is, the flags named in the solution are already in the CMakeLists.txt file, so I cant add them to solve the issue?
Or am I doing something wrong?
cmake_minimum_required(VERSION 3.12)
project(alex)
set(CMAKE_CXX_STANDARD 14)
# Define the macro ‘DEBUG' in the debug mode
if(CMAKE_BUILD_TYPE STREQUAL Debug)
ADD_DEFINITIONS(-DDEBUG)
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "/O2 /arch:AVX2 /W1 /EHsc")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(CMAKE_CXX_FLAGS "-O3 -xHost")
else()
# clang and gcc
set(CMAKE_CXX_FLAGS "-O3 -march=native -Wall -Wextra")
endif()
include_directories(src/core)
add_executable(example src/examples/main.cpp)
add_executable(benchmark src/benchmark/main.cpp)
set(DOCTEST_DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/doctest)
file(DOWNLOAD
https://raw.githubusercontent.com/onqtam/doctest/2.4.6/doctest/doctest.h
${DOCTEST_DOWNLOAD_DIR}/doctest.h
EXPECTED_HASH SHA1=40728d2bed7f074e80cb095844820114e7d16ce0
)
add_executable(test_alex test/unittest_main.cpp)
target_include_directories(test_alex PRIVATE ${DOCTEST_DOWNLOAD_DIR})
enable_testing()
add_test(test_alex test_alex)
wc222 commented
Just my experience, I succeed to compile the project with changing the compile option from -march=native
to -march=skylake-avx512
/-march=cascadelake
/-march=cooperlake
.
I get the same error when I set it as sandybridge
. I guess it is too old to support some AVX instructions.
By the way, I get another error "no such instruction: vpopcntq (%rax),%ymm0" when I set it as native (sapphirerapids) or tigerlake.