hzxie / voj

A cross-platform online judge system based on Spring MVC framework and ActiveMQ.
https://verwandlung.org
GNU General Public License v3.0
569 stars 121 forks source link

linux下无法编译 #27

Closed Ray-Eldath closed 7 years ago

Ray-Eldath commented 7 years ago

错误信息:

ray-eldath@Ray-Eldath:/var/judger$ make
mkdir -p target/cpp
g++ -c -std=c++11 -Wall -fPIC -I "/etc/jdk1.8.0_131/include" -I "/etc/jdk1.8.0_131/include/linux" src/main/cpp/unix/Judger.Core.Runner.cpp -o target/cpp/Judger.Core.Runner.o
src/main/cpp/unix/Judger.Core.Runner.cpp: In function ‘int runProcess(pid_t, sigset_t, const string&, int, int, int&, int&)’:
src/main/cpp/unix/Judger.Core.Runner.cpp:220:24: error: ‘PTRACE_GETREGS’ was not declared in this scope
                 ptrace(PTRACE_GETREGS, pid, NULL, &regs);
                        ^
src/main/cpp/unix/Judger.Core.Runner.cpp:34:22: error: ‘struct user_regs_struct’ has no member named ‘orig_rax’
 #define REG(reg) reg.orig_rax
                      ^
src/main/cpp/unix/Judger.Core.Runner.cpp:221:22: note: in expansion of macro ‘REG’
                 if ( REG(regs) >= 0 && REG(regs) <= 328 &&
                      ^
src/main/cpp/unix/Judger.Core.Runner.cpp:34:22: error: ‘struct user_regs_struct’ has no member named ‘orig_rax’
 #define REG(reg) reg.orig_rax
                      ^
src/main/cpp/unix/Judger.Core.Runner.cpp:221:40: note: in expansion of macro ‘REG’
                 if ( REG(regs) >= 0 && REG(regs) <= 328 &&
                                        ^
src/main/cpp/unix/Judger.Core.Runner.cpp:34:22: error: ‘struct user_regs_struct’ has no member named ‘orig_rax’
 #define REG(reg) reg.orig_rax
                      ^
src/main/cpp/unix/Judger.Core.Runner.cpp:222:43: note: in expansion of macro ‘REG’
                     !isAllowedSystemCalls(REG(regs)) ) {
                                           ^
src/main/cpp/unix/Judger.Core.Runner.cpp:34:22: error: ‘struct user_regs_struct’ has no member named ‘orig_rax’
 #define REG(reg) reg.orig_rax
                      ^
src/main/cpp/unix/Judger.Core.Runner.cpp:223:60: note: in expansion of macro ‘REG’
                     std::cout << "[DEBUG] System call " << REG(regs) << " is detected." << std::endl;
                                                            ^
Makefile:30: recipe for target 'target/cpp/Judger.Core.Runner.o' failed
make: *** [target/cpp/Judger.Core.Runner.o] Error 1

如何解决? 另外,以下是gcc -v的返回:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/4.9/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian/Linaro 4.9.2-10' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libsanitizer --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-arm64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-arm64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-arm64 --with-arch-directory=arm64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-multiarch --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
gcc version 4.9.2 (Debian/Linaro 4.9.2-10)
hzxie commented 7 years ago

感觉是Debian上的Bug: 请参见: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=419699

hzxie commented 7 years ago

我之前的有一个版本是没有使用ptrace的。 请参见: https://github.com/hzxie/voj/tree/9849f0bd9c30328a063e6ead4bea357b5350be69

Ray-Eldath commented 7 years ago

好的,我再看看。 感激不尽。