jermp / sshash

A compressed, associative, exact, and weighted dictionary for k-mers.
MIT License
84 stars 17 forks source link

Error: inlining failed in call to ‘always_inline’ #1

Closed yifangt closed 2 years ago

yifangt commented 2 years ago

I tried to compile the package to give it a try but met a problem at compiling:

/usr/lib/gcc/x86_64-linux-gnu/11/include/popcntintrin.h: In function ‘uint64_t pthash::util::popcount(uint64_t)’:
/usr/lib/gcc/x86_64-linux-gnu/11/include/popcntintrin.h:42:1: error: inlining failed in call to ‘always_inline’ ‘long long int _mm_popcnt_u64(long long unsigned int)’: target specific option mismatch
   42 | _mm_popcnt_u64 (unsigned long long __X)
      | ^~~~~~~~~~~~~~

Googled for a while and found out the the problem is related to the -mpopcnt option, but I am not familiar with the cmake and the _mm_popcnt_u64() function.
My system is Linux 5.13.0-24-generic #24-Ubuntu-21.10 I appreciate any help to resolve this issue.

yifangt commented 2 years ago

Manually add the -mpopcnt option in the CMakeLists.txt: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt") which seems to have fixed the error. Please confirm if this is the correct way to fix the bug.

jermp commented 2 years ago

Hi there, I never got this compiler error and I've been always using popcnt :) If you fixed that by adding a compilation flag, it means that your CPU has not automatic support for popcnt. Very strange because popcnt is available since SSE 4.2. Yes, you can either add set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt") or set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2")

By the way, what version of gcc are you using?

yifangt commented 2 years ago

Thanks! My gcc version is: gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0

jermp commented 2 years ago

Actually, I just noted that also in PTHash, I've used:

# For hardware popcount and pdep
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mbmi2 -msse4.2")

I've added them now. Can you try if now compiles on your end?

yifangt commented 2 years ago

I still have the same issue and have to manually add this line after your update: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt")

However, when I switched to another computer to compile, I did not have this problem, even without the line for PTHash you mentioned.

So, the issue seems to be an exception on my desktop with Ubuntu 21.10. Thanks a lot again!

jermp commented 2 years ago

Ok. Thank you for reporting! Closing this issue then.