ltp
ltp copied to clipboard
cannot find -ltirpc: No such file or directory
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?
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.
I suppose the problem was that previous toolchain had bundled glibc RPC which was later removed in glibc 2.32: https://sourceware.org/git/?p=glibc.git;a=commit;h=5500cdba4018ddbda7909bc7f4f9718610b43cf0 https://lists.gnu.org/archive/html/info-gnu/2020-08/msg00002.html
Does the problem still persists?
Feel free to reopen with additional information.