0

我已经使用 GCC 8.1.0 和 Boost 1.6.7 在 CentOS 7.5 上构建了 Casablanca (之前都从源代码构建)。

git clone https://github.com/Microsoft/cpprestsdk.git casablanca
cd casablanca/Release
mkdir build.debug
cd build.debug
cmake3  .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/local/bin/gcc -DCMAKE_CXX_COMPILER=/usr/local/bin/g++ -DWERROR=OFF
make

但是测试失败:

cd Binaries
./test_runner *_test.so
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)

检查strace我看到

mmap(NULL, 140728712380416, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory)
brk(NULL)                               = 0x134e000
brk(0x7ffdf61f8000)                     = 0x134e000
mmap(NULL, 140728712511488, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory)
mmap(NULL, 134217728, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x7fb46b842000
munmap(0x7fb46b842000, 8118272)         = 0
munmap(0x7fb470000000, 58990592)        = 0
mprotect(0x7fb46c000000, 135168, PROT_READ|PROT_WRITE) = 0
mmap(NULL, 140728712380416, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory)
futex(0x7fb47d8d91a0, FUTEX_WAKE_PRIVATE, 2147483647) = 0

的第二个参数mmap()是 a size_t,但它很大,127Tb!为什么会这样,我该如何解决?我想我在编译过程中出了点问题?

4

1 回答 1

1

当代操作系统:casablanca 可以使用 → 1。PCLinuxOS 2018,升压 -1.64,g++ -7.3。... 2 . Fedora 28,提升 -1.66,g++ -7.3。... 3 . Ubuntu 18.04,升压 -1.65,g++ -7.3。

Fedora 27、Debian 9 Stretch 失败:

cpprestsdk/Release/libs/websocketpp/websocketpp/transport/asio/security/tls.hpp:315:39: error: could not convert ‘boost::asio::ssl::error::make_error_code((boost::asio::ssl::error::stream_errors)1)’ from ‘boost::system::error_code’ to ‘std::error_code

CentOS 7.5:g++ -4.8,-5.3 不可用。使用 g++ -6.3 构建:测试显示“分段错误”。

CentOS 7.5:# yum install devtoolset-7-gcc-c++→ gcc / g++ -7.3.0

升压 1.66 (gcc-6.3.0):$ echo "using gcc : 63 : /usr/bin/g++63 ; " >> tools/build/src/user-config.jam && ./bootstrap.sh && ./b2

$ cd casablanca/Release/build/
$ scl enable devtoolset-7 bash && cmake3 ..
$ make
$ cd Binaries/
$ ./test_runner *_test.so 2>&1 | tee casablanca-test.log.txt
.
All test cases PASSED
Finished running all 790 tests

1600 行:casablanca-test.log.txt https://www.dropbox.com/s/m9ohuws0b0r700j/casablanca-test.log.txt?dl=0

于 2018-06-12T19:52:58.363 回答