facebookexperimental / libunifex

Unified Executors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile failed In Default Setting

lxp521123 opened this issue · comments

The environment on my computer consists of Ubuntu 20.04 with gcc11, and I executed the command.

cmake -G Ninja -H. -Bbuild  -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++  -DCMAKE_CXX_STANDARD:STRING=20

and

ninja

, And then I get errors:

FAILED: examples/CMakeFiles/http_server_io_uring_test.dir/linux/http_server_io_uring_test.cpp.o 
/usr/bin/g++  -I../include -Iinclude -Wall -Wextra -pedantic -Werror -std=gnu++2a -MD -MT examples/CMakeFiles/http_server_io_uring_test.dir/linux/http_server_io_uring_test.cpp.o -MF examples/CMakeFiles/http_server_io_uring_test.dir/linux/http_server_io_uring_test.cpp.o.d -o examples/CMakeFiles/http_server_io_uring_test.dir/linux/http_server_io_uring_test.cpp.o -c ../examples/linux/http_server_io_uring_test.cpp
In file included from ../examples/linux/http_server_io_uring_test.cpp:20:
../include/unifex/linux/io_uring_context.hpp: In lambda function:
../include/unifex/linux/io_uring_context.hpp:486:22: error: ‘IORING_OP_ASYNC_CANCEL’ was not declared in this scope; did you mean ‘IORING_OP_FSYNC’?
  486 |         sqe.opcode = IORING_OP_ASYNC_CANCEL;
      |                      ^~~~~~~~~~~~~~~~~~~~~~
      |                      IORING_OP_FSYNC
../include/unifex/linux/io_uring_context.hpp: In lambda function:
../include/unifex/linux/io_uring_context.hpp:684:22: error: ‘IORING_OP_ASYNC_CANCEL’ was not declared in this scope; did you mean ‘IORING_OP_FSYNC’?
  684 |         sqe.opcode = IORING_OP_ASYNC_CANCEL;
      |                      ^~~~~~~~~~~~~~~~~~~~~~
      |                      IORING_OP_FSYNC
../include/unifex/linux/io_uring_context.hpp: In lambda function:
../include/unifex/linux/io_uring_context.hpp:1157:22: error: ‘IORING_OP_ACCEPT’ was not declared in this scope; did you mean ‘IORING_OP_TIMEOUT’?
 1157 |         sqe.opcode = IORING_OP_ACCEPT;
      |                      ^~~~~~~~~~~~~~~~
      |                      IORING_OP_TIMEOUT
../include/unifex/linux/io_uring_context.hpp:1158:13: error: ‘struct io_uring_sqe’ has no member named ‘accept_flags’
 1158 |         sqe.accept_flags = SOCK_NONBLOCK;
      |             ^~~~~~~~~~~~
../include/unifex/linux/io_uring_context.hpp: In lambda function:
../include/unifex/linux/io_uring_context.hpp:1190:22: error: ‘IORING_OP_ASYNC_CANCEL’ was not declared in this scope; did you mean ‘IORING_OP_FSYNC’?
 1190 |         sqe.opcode = IORING_OP_ASYNC_CANCEL;
      |                      ^~~~~~~~~~~~~~~~~~~~~~
      |                      IORING_OP_FSYNC
ninja: build stopped: subcommand failed

How can i fix it?

Please check your Linux kernel version. IIRC Ubuntu 20.04 ships with a kernel that is too old for IORING_OP_ASYNC_CANCEL.

Citation from the Readme

The io_uring support on Linux requires a recent kernel version (5.6 or later).

Ubuntu 20.04 comes with an old liburing header. That's why our CI uses a manual step to install a stable version of liburing.

Alternatively you could disable it via UNIFEX_NO_LIBURING.

Thank you very much! It compiled successfully.