Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

rdma/verbs.h: sign-conversion error #1166

Open
yangx-jy opened this issue Jul 28, 2021 · 6 comments
Open

rdma/verbs.h: sign-conversion error #1166

yangx-jy opened this issue Jul 28, 2021 · 6 comments
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@yangx-jy
Copy link
Contributor

yangx-jy commented Jul 28, 2021

@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.

@yangx-jy yangx-jy changed the title How to build rpma based on the lastest rdma-core successfully? How to build rpma based on the latest rdma-core successfully? Jul 28, 2021
@ldorau
Copy link
Member

ldorau commented Aug 18, 2021

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"

@yangx-jy
Copy link
Contributor Author

yangx-jy commented Aug 18, 2021

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.

@ldorau
Copy link
Member

ldorau commented Aug 18, 2021

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.

@janekmi
Copy link

janekmi commented Sep 30, 2021

@yangx-jy do you know if the issue still exists?

@janekmi janekmi changed the title How to build rpma based on the latest rdma-core successfully? rdma/verbs.h: sign-conversion error Sep 30, 2021
@janekmi janekmi added the bug Something isn't working label Sep 30, 2021
@janekmi
Copy link

janekmi commented Sep 30, 2021

The issue was introduced by the PR referenced below. I think it has to be fixed in the verbs.h file.

Ref: linux-rdma/rdma-core#660

@janekmi janekmi added the wontfix This will not be worked on label Sep 30, 2021
@yangx-jy
Copy link
Contributor Author

@yangx-jy do you know if the issue still exists?

Yes, the issue still exists on the latest version.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants