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

cannot find -ltirpc: No such file or directory #1164

Open
wangtao-work opened this issue Jul 10, 2024 · 1 comment
Open

cannot find -ltirpc: No such file or directory #1164

wangtao-work opened this issue Jul 10, 2024 · 1 comment

Comments

@wangtao-work
Copy link

wangtao-work commented Jul 10, 2024

I use cross-compile aarch64-none-linux-gnu-gcc version 9.2.1 to compile without any problem, but when I use version 11.4 to compile, an error will be reported. The error is as follows:

CC testcases/network/rpc/rpc-tirpc/tests_pack/lib/librpc-tirpc.o
AR librpc-tirpc.a
RANLIB librpc-tirpc.a
CC testcases/network/rpc/basic_tests/rpc01/lib/librpc01.o
AR librpc01.a
RANLIB librpc01.a
rpc1.c: In function ‘main’:
rpc_server.c: In function ‘service_request’:
rpc1.c:96:56: warning: argument to ‘sizeof’ in ‘memcpy’ call is the same expression as the source; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
96 | memcpy(&server_sin.sin_addr, hp->h_addr, sizeof(hp->h_addr));
| ^
rpc_server.c:94:39: warning: cast between incompatible function types from ‘bool_t ()(void)’ {aka ‘int ()(void)’} to ‘bool_t (*)(XDR , ...)’ {aka ‘int ()(struct __rpc_xdr *, ...)’} [-Wcast-function-type]
94 | svc_sendreply(transp, (xdrproc_t)xdr_void, NULL);
| ^
/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: cannot find -ltirpc: No such file or directory
collect2: error: ld returned 1 exit status

Question
1、-ltirpc or -lrpc-tirpc? how to specify?
2、Why do different compilers differ?

@pevik
Copy link
Member

pevik commented Jul 10, 2024

If you compile the old version as make V=1 you will see what was specified to get rpc. Because LTP supports libtirpc, but also glibc rpc (sunrpc implementation, which was removed in glibc 2.26), see https://github.com/linux-test-project/ltp/blob/master/m4/ltp-tirpc.m4.

Or, you can inspect generated include/mk/config.mk for LIBTIRPC_CFLAGS and LIBTIRPC_LIBS values.

I suspect you don't have libtirpc development headers installed for the toolchain and the old toolchain had glibc < 2.26, thus with their sunrpc implementation.

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