Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With '--build-static' enabled, rdma-core is failed to probe by configure #1801

Closed
1 task done
HuangShumin opened this issue Aug 9, 2024 · 2 comments
Closed
1 task done

Comments

@HuangShumin
Copy link
Contributor

Please acknowledge the following before creating a ticket

Description of the bug:
fio-3.37 cannot be built with static rdma engine, even with libibverbs-dev/librdmacm-dev static libraries installed.

Environment: Debian 12.5

fio version: fio-3.37

Reproduction steps

apt install build-essential devscripts dpkg-dev equivs fakeroot lintian quilt
mk-build-deps -i -r fio
apt install libnl-3-dev libnl-route-3-dev libibverbs-dev librdmacm-dev
tar xzvf fio-3.37.tar.gz && cd fio-fio-3.37
./configure --build-static && make -j $(nproc) && ./fio --enghelp | grep rdma
# shoud output rdma engine here

Troubleshooting
After I modify configure script contents as below:

##########################################
# See if we need to build a static build
if test "$build_static" = "yes" ; then
  CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
  LDFLAGS="$LDFLAGS -lnl-3 -lnl-route-3 -libverbs -lrdmacm -lrpma -static -Wl,--gc-sections"
else
  build_static="no"
fi
print_config "Static build" "$build_static"

configure is able to probe static library of rdma, but it's reported with undefined errors by gcc ld as

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/librdmacm.a(cma.c.o): in function `check_abi_version_nl_cb':
(.text+0x4fb): undefined reference to `nlmsg_hdr'
/usr/bin/ld: (.text+0x514): undefined reference to `nlmsg_parse'
/usr/bin/ld: (.text+0x54c): undefined reference to `nla_get_u64'
/usr/bin/ld: (.text+0x562): undefined reference to `nla_get_string'
/usr/bin/ld: (.text+0x594): undefined reference to `nla_get_u64'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/librdmacm.a(cma.c.o): in function `ucma_query_route':
(.text+0x1255): undefined reference to `ibv_copy_path_rec_from_kern'
...

Anyone who cares about this issue? I would like building a static and portable fio that's indepent to Linux distro.

Best Regards,

@HuangShumin
Copy link
Contributor Author

I just figure out this issue by static probe the libiberbs/librdmacm/librpma library, as below:

if test "$disable_rdma" != "yes" && compile_prog "" "-libverbs -lnl-3 -lnl-route-3" "libverbs" ; then
    libverbs="yes"
    LIBS="-libverbs -lnl-3 -lnl-route-3 $LIBS"
fi

File#configure#Line#1008

if test "$disable_rdma" != "yes" && compile_prog "" "-lrdmacm -lnl-3 -lnl-route-3" "rdma"; then
    rdmacm="yes"
    LIBS="-lrdmacm $LIBS"
fi

File#configure#Line#1027

if test "$disable_rdma" != "yes" && compile_prog "" "$(pkg-config --static --libs librpma)" "rpma"; then
    librpma="yes"
    LIBS="$(pkg-config --static --libs librpma) $LIBS"

File#configure#Line#1047

And I have pulled a request #1806 to fix this static build problem.

HuangShumin added a commit to HuangShumin/fio that referenced this issue Sep 24, 2024
…1801

Fix configure with --build-static option which enables static RDMA in Issue axboe#1801

This pull request to probe static libibverbs/librdmacm library. It's neccessary to enable static RDMA engine build with netlink libnl-3 and libnl-route-3.

Signed-off-by: Huang Shumin longway68@qq.com
HuangShumin added a commit to HuangShumin/fio that referenced this issue Sep 24, 2024
…1801

Fix configure with --build-static option which enables static RDMA in Issue axboe#1801

This pull request to probe static libibverbs/librdmacm library. It's neccessary to enable static RDMA engine build with netlink libnl-3 and libnl-route-3.

Signed-off-by: Huang Shumin longway68@qq.com
@vincentkfu
Copy link
Collaborator

Fixed by #1818

axboe pushed a commit that referenced this issue Sep 26, 2024
* 'master' of https://github.com/HuangShumin/fio:
  Fix configure with --build-static which enables static RDMA in #1801
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants