ISO C++17 does not allow 'register'

-2

Was trying to build osquery on ubuntu vm. User the followed instruction: https://osquery.readthedocs.io/en/stable/development/building/

While building there is an error:

/home/user/osquery/osquery/sql/sqlite_string.cpp:234:55: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
      sqlite3_result_int64(context, (__extension__ ({ register unsigned int __v, __x = (in4->sin_addr.s_addr); if (__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; })));
                                                      ^~~~~~~~~
/home/user/osquery/osquery/sql/sqlite_string.cpp:234:55: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
      sqlite3_result_int64(context, (__extension__ ({ register unsigned int __v, __x = (in4->sin_addr.s_addr); if (__builtin_constant_p (__x)) __v = ((((__x) & 0xff000000) >> 24) | (((__x) & 0x00ff0000) >> 8) | (((__x) & 0x0000ff00) << 8) | (((__x) & 0x000000ff) << 24)); else __asm__ ("bswap %0" : "=r" (__v) : "0" (__x)); __v; })));
                                                      ^~~~~~~~~

2 errors generated.
osquery/sql/CMakeFiles/osquery_sql.dir/build.make:211: recipe for target «osquery/sql/CMakeFiles/osquery_sql.dir/sqlite_string.cpp.o» failed
make[2]: *** [osquery/sql/CMakeFiles/osquery_sql.dir/sqlite_string.cpp.o] Error 1
CMakeFiles/Makefile2:7324: recipe for target «osquery/sql/CMakeFiles/osquery_sql.dir/all» failed
make[1]: *** [osquery/sql/CMakeFiles/osquery_sql.dir/all] Error 2

Found, that C++17 is no longer support "register" as class specifier, so it should be removed in tergeted file.

By looking into sqlite_string.cpp, there is only one match: "void registerStringExtensions(sqlite3* db)", and no no specified lines.

There is line 234 followed file sqlite3_result_int64(context, ntohl(in4->sin_addr.s_addr));

How can i fix this?

Thank you!

c++
ubuntu
cmake
virtual-machine
osquery
asked on Stack Overflow Oct 31, 2020 by WAPTAP • edited Oct 31, 2020 by WAPTAP

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0