expected string-literal before ‘)’ when using static_assert in c++17 - c++11

So when I try to build my c++ application I get compile-time error in the following piece of code
static_assert(sizeof(int32_t) == 4)
This is the error that I get expected string-literal before ‘)’
On some investigation I found out that static_assert required a message param in c++11 which was eliminated in c++17. So does it look like my application is being compiled for c++11?
In my CMakeLists.txt file I have the following lines
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Shouldn't the above lines build my application for c++17?
Thanks!
Update1 -- Full Error trace
In file included from <project_root>/src/include/buffer/buffer_pool_manager.h:22:0,
from <project_root>/src/include/catalog/simple_catalog.h:8,
from <project_root>/src/include/catalog/table_generator.h:6,
from <project_root>/src/catalog/table_generator.cpp:1:
<project_root>/src/include/storage/page/page.h:70:39: error: expected ‘,’ before ‘)’ token
static_assert(sizeof(page_id_t) == 4);
^
<project_root>/src/include/storage/page/page.h:70:39: error: expected string-literal before ‘)’ token
In file included from <project_root>/src/include/buffer/buffer_pool_manager.h:22:0,
from <project_root>/src/buffer/buffer_pool_manager.cpp:13:
<project_root>/src/include/storage/page/page.h:70:39: error: expected ‘,’ before ‘)’ token
static_assert(sizeof(page_id_t) == 4);
^
<project_root>/src/include/storage/page/page.h:70:39: error: expected string-literal before ‘)’ token
src/CMakeFiles/bustub_shared.dir/build.make:62: recipe for target 'src/CMakeFiles/bustub_shared.dir/buffer/buffer_pool_manager.cpp.o' failed
make[2]: *** [src/CMakeFiles/bustub_shared.dir/buffer/buffer_pool_manager.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
src/CMakeFiles/bustub_shared.dir/build.make:114: recipe for target 'src/CMakeFiles/bustub_shared.dir/catalog/table_generator.cpp.o' failed
make[2]: *** [src/CMakeFiles/bustub_shared.dir/catalog/table_generator.cpp.o] Error 1
CMakeFiles/Makefile2:383: recipe for target 'src/CMakeFiles/bustub_shared.dir/all' failed
make[1]: *** [src/CMakeFiles/bustub_shared.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

I changed it to gcc-7 and g++-7 solved my problem.

Related

fatal error: sys/_types.h: No such file or directory

When I compile Uranus (an SGX project that rewrites JDK), the following error occurs when I execute the make command
Compiling /home/uranus/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp
In file included from /home/uranus/hotspot/src/../enclave/panoply/include/struct/sgx_time_struct.h:4:0,
from /home/uranus/hotspot/src/../enclave/panoply/include/sgx/bits/resource.h:179,
from /home/uranus/hotspot/src/../enclave/panoply/include/sgx/sys/resource.h:24,
from /home/uranus/hotspot/src/../enclave/panoply/include/struct/sgx_sysresource_struct.h:1,
from /home/uranus/hotspot/src/share/vm/em/securecompiler_u.h:39,
from /home/uranus/hotspot/src/share/vm/em/CompilerEnclave.cpp:8:
/home/uranus/hotspot/src/../include/tlibc/time.h:45:24: fatal error: sys/_types.h: No such file or directory
compilation terminated.
/home/uranus/hotspot/make/linux/makefiles/rules.make:149: recipe for target 'CompilerEnclave.o' failed
make[6]: *** [CompilerEnclave.o] Error 1
make[6]: *** Waiting for unfinished jobs....
/home/uranus/hotspot/make/linux/makefiles/top.make:119: recipe for target 'the_vm' failed
make[5]: *** [the_vm] Error 2
/home/uranus/hotspot/make/linux/Makefile:284: recipe for target 'product' failed
make[4]: *** [product] Error 2
Makefile:230: recipe for target 'generic_build2' failed
make[3]: *** [generic_build2] Error 2
Makefile:177: recipe for target 'product' failed
make[2]: *** [product] Error 2
HotspotWrapper.gmk:44: recipe for target '/home/uranus/build/linux-x86_64-normal-server-release/hotspot/_hotspot.timestamp' failed
make[1]: *** [/home/uranus/build/linux-x86_64-normal-server-release/hotspot/_hotspot.timestamp] Error 2
/home/uranus//make/Main.gmk:109: recipe for target 'hotspot-only' failed
make: *** [hotspot-only] Error 2
This gives me a headache. Pay attention to the sys here/_ The types. h file is an underlined _. I can only find sys/types. h header file without underline
I have been troubled for a long time. I hope the question can be answered

fblualib installation in Ubunt16.04

I am trying to install fblualib from this link.
When I run ./install_all.sh inside fblualib, I have errors as
+ echo Building folly
Building folly
+ echo
+ cd /tmp/fblualib-build.zofU4g/folly/folly
+ autoreconf -ivf
autoreconf: 'configure.ac' or 'configure.in' is required
According to last discussion here, there is a discussion as "autotools based build system has been removed from Folly in favor of CMake, so you'll need to build Folly with CMake rather than autotools." so I go to folly folder
/tmp/fblualib-build.zofU4g/folly/build and try to build using `cmake`.
Then I have errors as
[ 36%] Building CXX object CMakeFiles/folly_base.dir/folly/detail/ThreadLocalDetail.cpp.o
In file included from /tmp/fblualib-build.zofU4g/folly/folly/detail/ThreadLocalDetail.h:33:0,
from /tmp/fblualib-build.zofU4g/folly/folly/detail/ThreadLocalDetail.cpp:16:
/tmp/fblualib-build.zofU4g/folly/folly/SharedMutex.h: In static member function ‘static void folly::threadlocal_detail::StaticMetaBase::onThreadExit(void*)’:
/tmp/fblualib-build.zofU4g/folly/folly/SharedMutex.h:457:33: error: ‘*((void*)& rlock +10)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
!tryUnlockSharedDeferred(token.slot_)) {
^
/tmp/fblualib-build.zofU4g/folly/folly/detail/ThreadLocalDetail.cpp:169:31: note: ‘*((void*)& rlock +10)’ was declared here
SharedMutex::ReadHolder rlock(nullptr);
^
cc1plus: all warnings being treated as errors
CMakeFiles/folly_base.dir/build.make:1886: recipe for target 'CMakeFiles/folly_base.dir/folly/detail/ThreadLocalDetail.cpp.o' failed
make[2]: *** [CMakeFiles/folly_base.dir/folly/detail/ThreadLocalDetail.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/folly_base.dir/all' failed
make[1]: *** [CMakeFiles/folly_base.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
The error is happening in SharedMutex.h, what could be worng>

Raspberry Pi V4L2 Compile Error How to Fix

I am using opencv with python on raspberry pi so according to tutorials on the internet I need the V4L2 driver. I'm following this tutorial to install the driver https://www.ics.com/blog/raspberry-pi-camera-module#.VAaCHqM0_YQ
However when I compile I get this error. I don't know what's the problem and have never ran into this problem before. How do I fix this. Thanks.
make[3]: Entering directory '/home/pi/v4l-utils/utils/v4l2-compliance'
CXX v4l2-test-input-output.o
v4l2-test-input-output.cpp: In function ‘int checkInput(node*, const v4l2_input&, unsigned int)’:
v4l2-test-input-output.cpp:368:3: error: expected primary-expression before ‘.’ token
v4l2-test-input-output.cpp:369:3: error: expected primary-expression before ‘.’ token
v4l2-test-input-output.cpp: In function ‘int checkOutput(node*, const v4l2_output&, unsigned int)’:
v4l2-test-input-output.cpp:733:3: error: expected primary-expression before ‘.’ token
v4l2-test-input-output.cpp:734:3: error: expected primary-expression before ‘.’ token
Makefile:438: recipe for target 'v4l2-test-input-output.o' failed
make[3]: *** [v4l2-test-input-output.o] Error 1
make[3]: Leaving directory '/home/pi/v4l-utils/utils/v4l2-compliance'
Makefile:373: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/pi/v4l-utils/utils'
Makefile:470: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/pi/v4l-utils'
Makefile:398: recipe for target 'all' failed
make: *** [all] Error 2
The line numbers have changed somewhat in the 2+ years since this question was posted. It could have easily had more bugs back then with Raspbian 7 Wheezy on a Raspberry Pi 2 or classic Pi.
One correction to the webpage would be that it's better to run ./bootstrap.sh rather than autoreconf. I also write libjpeg-dev to avoid dependency problems with the too-specific libjpeg62-dev. Then the build and installation works fine today on Raspbian 9 Stretch (gcc 6.3):
sudo apt-get install autoconf gettext libtool libjpeg-dev
git clone git://git.linuxtv.org/v4l-utils.git
cd v4l-utils
./bootstrap.sh
./configure
make
sudo make install

Problems compiling Ruby

I am trying to install Gitlab CI on a virtual machine, and I am following this instructions to do so.
The point #2 is about installing and compiling ruby. When I execute the command make I encounter at the end of the process the following error messages:
make[2]: Entering directory `/tmp/ruby/ruby-2.0.0-p353/ext/pty'
compiling pty.c
pty.c: In function ‘chfunc’:
pty.c:143:12: warning: ignoring return value of ‘seteuid’, declared with attribute warn_unused_result [-Wunused-result]
seteuid(getuid());
^
linking shared-object pty.so
installing default pty libraries
make[2]: Leaving directory `/tmp/ruby/ruby-2.0.0-p353/ext/pty'
make[2]: Entering directory `/tmp/ruby/ruby-2.0.0-p353/ext/racc/cparse'
compiling cparse.c
linking shared-object racc/cparse.so
installing default cparse libraries
make[2]: Leaving directory `/tmp/ruby/ruby-2.0.0-p353/ext/racc/cparse'
make[2]: Entering directory `/tmp/ruby/ruby-2.0.0-p353/ext/readline'
compiling readline.c
readline.c: In function ‘Init_readline’:
readline.c:1886:26: error: ‘Function’ undeclared (first use in this function)
rl_pre_input_hook = (Function *)readline_pre_input_hook;
^
readline.c:1886:26: note: each undeclared identifier is reported only once for each function it appears in
readline.c:1886:36: error: expected expression before ‘)’ token
rl_pre_input_hook = (Function *)readline_pre_input_hook;
^
readline.c: At top level:
readline.c:530:1: warning: ‘readline_pre_input_hook’ defined but not used [-Wunused-function]
readline_pre_input_hook(void)
^
make[2]: *** [readline.o] Error 1
make[2]: Leaving directory `/tmp/ruby/ruby-2.0.0-p353/ext/readline'
make[1]: *** [ext/readline/all] Error 2
make[1]: Leaving directory `/tmp/ruby/ruby-2.0.0-p353'
make: *** [build-ext] Error 2
Here is a more long log: http://pastebin.com/m6wzLVd9
What can I do to solve this problem?
It appears to be this bug https://bugs.ruby-lang.org/issues/9578. I think you need the most stable version of ruby.

Error compiling imapfilter 2.4.1 in CentOS 5.6

I am trying to compile imapfilter 2.4.1 ( https://github.com/lefcha/imapfilter ) in CentOS 5.6. I believe I've got all the dependencies sorted but when I run make I get:
make[1]: Entering directory `/home/src/imapfilter-2.4.1/src'
cc -Wall -O -DMAKEFILE_SHAREDIR='"/usr/local/share/imapfilter"' -c -o core.o core.c
core.c:41: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ifcorelib’
core.c: In function ‘ifcore_append’:
core.c:947: warning: implicit declaration of function ‘lua_strlen’
core.c: In function ‘luaopen_ifcore’:
core.c:1162: warning: implicit declaration of function ‘luaL_register’
core.c:1162: error: ‘ifcorelib’ undeclared (first use in this function)
core.c:1162: error: (Each undeclared identifier is reported only once
core.c:1162: error: for each function it appears in.)
make[1]: *** [core.o] Error 1
make[1]: Leaving directory `/home/src/imapfilter-2.4.1/src'
make: *** [all] Error 2
Based on other user comments and file revision dates I am sure this should compile. I am guessing I'm missing a library somewhere. I'll appreciate any help I can get on this.
Starting from first error message:
core.c:41: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ifcorelib’
Line 41 of core.c is:
static const luaL_reg ifcorelib[] = {
Cryptic message from gcc means that it knows nothing about what is the luaL_reg and it thinks that it is variable name. Then it goes into panic when reads second variable name in the same definition/declaration. luaL_reg should be something like struct.
So, it seems that your problems are located in LUA development headers. May be you have too old or even to modern Lua package.
The imapfilter's github's readme says:
Compile time requirements are Lua (version 5.1)
Are you sure that your lua is 5.1 and the lua-devel (or any other package with lua headers) is 5.1 too?

Resources