rpma
rpma copied to clipboard
rdma/verbs.h: sign-conversion error
@janekmi @ldorau @osalyk @grom72
I used the following steps to build rpma based on the latest rdma-core:
git clone https://github.com/linux-rdma/rdma-core.git
cd rdma-core
mkdir build && cd build
../build.sh
export CMAKE_PREFIX_PATH="/root/rdma-core/build"
export CPATH="/root/rdma-core/build/include"
export LIBRARY_PATH="/root/rdma-core/build/lib"
export LD_LIBRARY_PATH="/root/rdma-core/build/lib"
git clone https://github.com/pmem/rpma.git
cd rpma
mkdir build && cd build
cmake .. -DDEVELOPER_MODE=ON
make rpma
make rpma
always triggers the following -Werror=sign-conversion
error:
[root@fedora-31-server build]# make rpma
Scanning dependencies of target rpma
[ 0%] Building C object src/CMakeFiles/rpma.dir/conn.c.o
In file included from /root/rpma/src/include/librpma.h:20,
from /root/rpma/src/conn.h:12,
from /root/rpma/src/conn.c:13:
/root/rdma-core/build/include/infiniband/verbs.h: In function ‘__ibv_reg_mr’:
/root/rdma-core/build/include/infiniband/verbs.h:2531:39: error: conversion to ‘int’ from ‘unsigned int’ may change the sign of the result [-Werror=sign-conversion]
2531 | return ibv_reg_mr(pd, addr, length, access);
| ^~~~~~
/root/rdma-core/build/include/infiniband/verbs.h: In function ‘__ibv_reg_mr_iova’:
/root/rdma-core/build/include/infiniband/verbs.h:2554:50: error: conversion to ‘int’ from ‘unsigned int’ may change the sign of the result [-Werror=sign-conversion]
2554 | return ibv_reg_mr_iova(pd, addr, length, iova, access);
| ^~~~~~
/root/rdma-core/build/include/infiniband/verbs.h: In function ‘ibv_create_srq_ex’:
/root/rdma-core/build/include/infiniband/verbs.h:2908:13: error: unsigned conversion from ‘int’ to ‘uint32_t’ {aka ‘unsigned int’} changes value from ‘-4’ to ‘4294967292’ [-Werror=sign-conversion]
2908 | if (!(mask & ~(IBV_SRQ_INIT_ATTR_PD | IBV_SRQ_INIT_ATTR_TYPE)) &&
| ^
/root/rdma-core/build/include/infiniband/verbs.h: In function ‘ibv_is_qpt_supported’:
/root/rdma-core/build/include/infiniband/verbs.h:3425:17: error: conversion to ‘uint32_t’ {aka ‘unsigned int’} from ‘int’ may change the sign of the result [-Werror=sign-conversion]
3425 | return !!(caps & (1 << qpt));
| ^
cc1: all warnings being treated as errors
make[3]: *** [src/CMakeFiles/rpma.dir/build.make:83: src/CMakeFiles/rpma.dir/conn.c.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:1397: src/CMakeFiles/rpma.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1404: src/CMakeFiles/rpma.dir/rule] Error 2
make: *** [Makefile:377: rpma] Error 2
By the way, I didn't see the error when I build rpma based on the released rdma-core packages.
Hi, this is an issue in rdma-core.
A workaround for it could be the following: when building rpma, run cmake with -DCMAKE_C_FLAGS="-Wno-error=sign-conversion"
added:
cmake .. -DCMAKE_C_FLAGS="-Wno-error=sign-conversion"
Hi, this is an issue in rdma-core.
Hi @ldorau
Agreed. But my confusion is why building rpma with rdma-core package doesn't reproduce the error?
A workaround for it could be the following: when building rpma, run cmake with
-DCMAKE_C_FLAGS="-Wno-error=sign-conversion"
added:cmake .. -DCMAKE_C_FLAGS="-Wno-error=sign-conversion"
Yes, this is a workaround.
Agreed. But my confusion is why building rpma with rdma-core package doesn't reproduce the error?
Yes, that's interesting. I do not know yet.
@yangx-jy do you know if the issue still exists?
The issue was introduced by the PR referenced below. I think it has to be fixed in the verbs.h file.
Ref: https://github.com/linux-rdma/rdma-core/pull/660
@yangx-jy do you know if the issue still exists?
Yes, the issue still exists on the latest version.