ssrg-vt / popcorn-chameleon

Secure Popcorn Linux runtime state transformation framework
GNU General Public License v3.0
4 stars 1 forks source link

chameleon compilation error #2

Open xjtuwxg opened 5 years ago

xjtuwxg commented 5 years ago

When compiling chameleon, there is a "C++11 requires a space between literal and string macro" error.

chameleon/popcorn-chameleon/build$ make
... ...
[ 46%] Building CXX object src/CMakeFiles/chameleon.dir/parasite.cpp.o
In file included from /home/xgwang/extdisk/chameleon/install.dir/include/compel/infect.h:6:0,
                 from /home/xgwang/extdisk/chameleon/install.dir/include/compel/compel.h:12,
                 from /home/xgwang/extdisk/chameleon/popcorn-chameleon/src/parasite.cpp:6:
/home/xgwang/extdisk/chameleon/install.dir/include/compel/asm/sigframe.h:161:8: error: invalid suffix on literal; C++11 requires a space between literal and string macro [-Werror=literal-suffix]
        "movl $"__stringify(__NR_rt_sigreturn)", %%eax \n" \
        ^
/home/xgwang/extdisk/chameleon/install.dir/include/compel/asm/sigframe.h:168:3: error: invalid suffix on literal; C++11 requires a space between literal and string macro [-Werror=literal-suffix]
   "pushq $"__stringify(USER32_CS)"  \n" \
   ^
/home/xgwang/extdisk/chameleon/install.dir/include/compel/asm/sigframe.h:174:3: error: invalid suffix on literal; C++11 requires a space between literal and string macro [-Werror=literal-suffix]
   "movl $"__stringify(__NR32_rt_sigreturn)",%%eax \n" \
   ^

I modified the sigframe.h file and added the space between " and __stringify like "movl $" __stringify(__NR_rt_sigreturn)", %%eax \n"

rlyerly commented 5 years ago

I don't see that error on my build - what compiler/compiler version are you using? Please add the output when run with -v, e.g., /usr/bin/c++ -v

Chameleon is set to convert warnings to errors and it looks like this is a warning we can ignore (I don't think the CRIU/compel developers tested their headers with C++). We can probably add a pragma to make the compiler ignore the warning before the compel header include on line 6:

#pragma GCC diagnostic ignored "-Wliteral-suffix"
#include <compel/compel.h>

Can you test to see if this makes the issue disappear?

xjtuwxg commented 5 years ago

Yes, that's true. It seems to be a warning from C++11 standard. Here is the c++ version I used.

$ /usr/bin/c++ --version
c++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
rlyerly commented 5 years ago

Right, we specify the C++ 11 standard in the target compile options for Chameleon in src/CMakeLists.txt.

That's strange, I'm running the same compiler, don't know why I didn't see those errors.

xjtuwxg commented 5 years ago

That is strange. This warning still happens on my environment. Here is a similar issue report in other projects: https://github.com/konstantinmiller/dashp2p/issues/3