I'm trying to build this project: https://github.com/utelle/SQLite3MultipleCiphers
Specifically the amalgamation files found at: https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v1.2.5
I'm getting this error from the _mm_aesimc_si128
function:
/usr/lib/gcc/x86_64-linux-gnu/9/include/wmmintrin.
h:77: error: inlining failed in call to always_inline ‘_mm_aesimc_si128’: target specific option mismatch
In file included from ../sqlite3mc/sqlite3mc_amalgamation.c:250494:
../sqlite3mc/sqlite3mc_amalgamation.c: In function ‘aesGenKeyDecrypt’:
/usr/lib/gcc/x86_64-linux-gnu/9/include/wmmintrin.h:77:1: error: inlining failed in call to always_inline ‘_mm_aesimc_si128’: target specific option mismatch
77 | _mm_aesimc_si128 (__m128i __X)
| ^~~~~~~~~~~~~~~~
../sqlite3mc/sqlite3mc_amalgamation.c:250589:26: note: called from here
I understand from other questions that my CPU needs to support these intrinsic functions and that I need to pass in compiler flags to enable them. I think I need AES and SSE4.2 for this, since the Makefile.am from the Github code has -msse4.2 -maes
for x86.
I'm using QtCreator and qmake because I'm trying to integrate this into a existing Qt project, but I'm just trying to get it to work with a new project for now.
This is my .pro file, I'm passing in the -march=native
flag (I also tried -msse4.2 -maes
with the same results):
TEMPLATE = app
CONFIG += console c++17
CONFIG -= app_bundle qt debug_and_release
SOURCES += \
main.cpp \
sqlite3mc_amalgamation.c
HEADERS += \
sqlite3.h \
sqlite3ext.h \
sqlite3mc_amalgamation.h
QMAKE_CXXFLAGS += -march=native
Checking the enabled flags for my architecture, and searching for aes and sse gives me:
g++ -Q --help=target -march=native | egrep "(msse)|(maes)"
-maes [enabled]
-msse [enabled]
-msse2 [enabled]
-msse2avx [disabled]
-msse3 [enabled]
-msse4 [enabled]
-msse4.1 [enabled]
-msse4.2 [enabled]
-msse4a [disabled]
-msse5
-msseregparm [disabled]
Checking my CPU's available extensions and searching for sse and aes:
lscpu | egrep "(sse)|(aes)"
Flags: sse sse2 ssse3 sse4_1 sse4_2 aes <many other flags>
So SSE4.2 and AES are both enabled by -march=native
and are supported by my CPU, but I'm still getting the error.
What can I do to get past this error (and hopefully get the whole thing to build)?
Since the amalgamation file is a C file it should be:
QMAKE_CFLAGS += -march=native
not
QMAKE_CXXFLAGS += -march=native
Additionally, sqlite3mc uses pthread and ldl so these libraries must be linked:
LIBS += -pthread -ldl
After making these changes it builds successfully.