Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 926341 - sys-apps/iproute2-6.8.0-r2 - rdma.c:110:13: error: call to undeclared function 'basename'
Summary: sys-apps/iproute2-6.8.0-r2 - rdma.c:110:13: error: call to undeclared functio...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: PATCH, PullRequest
Depends on:
Blocks: musl-1.2.5
  Show dependency tree
 
Reported: 2024-03-07 09:53 UTC by ernsteiswuerfel
Modified: 2024-08-04 16:17 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (iproute2-6.6.0-r3:20240307-094932.log,16.88 KB, text/plain)
2024-03-07 09:53 UTC, ernsteiswuerfel
Details
emerge --info (file_926341.txt,7.42 KB, text/plain)
2024-03-07 09:54 UTC, ernsteiswuerfel
Details
emerge --info (file_926341.txt,7.63 KB, text/plain)
2024-07-01 21:09 UTC, ernsteiswuerfel
Details
build.log (amd64, 6.8.0-r2) (iproute2-6.8.0-r2:20240701-210445.log,167.58 KB, text/plain)
2024-07-01 21:10 UTC, ernsteiswuerfel
Details
Patch to build iproute2-6.10.0 successfully (iproute2-6.10.0-headers.patch,530 bytes, patch)
2024-07-18 18:06 UTC, Nathaniel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ernsteiswuerfel archtester 2024-03-07 09:53:24 UTC
Created attachment 886891 [details]
build.log

[...]
clang -Wall -Wstrict-prototypes  -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wformat=2 -Os -march=x86-64-v2 -pipe  -pipe -I../include -I../include/uapi -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONF_USR_DIR=\"/usr/share/iproute2\" -DCONF_ETC_DIR=\"/etc/iproute2\" -DNETNS_RUN_DIR=\"/run/netns\" -DNETNS_ETC_DIR=\"/etc/netns\" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -Os -march=x86-64-v2 -pipe -DHAVE_HANDLE_AT -DHAVE_HANDLE_AT -DHAVE_SETNS -DHAVE_SETNS -DHAVE_LIBMNL -DHAVE_LIBMNL -fPIC   -c -o color.o color.c
clang -Wall -Wstrict-prototypes  -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wformat=2 -Os -march=x86-64-v2 -pipe  -pipe -I../include -I../include/uapi -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONF_USR_DIR=\"/usr/share/iproute2\" -DCONF_ETC_DIR=\"/etc/iproute2\" -DNETNS_RUN_DIR=\"/run/netns\" -DNETNS_ETC_DIR=\"/etc/netns\" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -Os -march=x86-64-v2 -pipe -DHAVE_HANDLE_AT -DHAVE_HANDLE_AT -DHAVE_SETNS -DHAVE_SETNS -DHAVE_LIBMNL -DHAVE_LIBMNL -fPIC   -c -o bpf_legacy.o bpf_legacy.c
bpf_legacy.c:974:5: error: call to undeclared function 'basename'; ISO C99
      and later do not support implicit function declarations [-Wimplicit-function-declaration]
  974 |                          basename(cfg->object), cfg->mode == EBPF_PINNED ?
      |                          ^
bpf_legacy.c:974:5: warning: format specifies type 'char *' but the
      argument has type 'int' [-Wformat]
  973 |                 snprintf(annotation, sizeof(annotation), "%s:[%s]",
      |                                                           ~~
      |                                                           %d
  974 |                          basename(cfg->object), cfg->mode == EBPF_PINNED ?
      |                          ^~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
make[1]: *** [../config.include:24: bpf_legacy.o] Error 1
make[1]: Leaving directory '/var/tmp/portage/sys-apps/iproute2-6.6.0-r3/work/iproute2-6.6.0/lib'
make: *** [Makefile:78: all] Error 2
Comment 1 ernsteiswuerfel archtester 2024-03-07 09:54:55 UTC
Created attachment 886892 [details]
emerge --info
Comment 2 Andreas K. Hüttel archtester gentoo-dev 2024-04-30 19:33:48 UTC
>>> Emerging (1 of 1) sys-apps/iproute2-6.8.0-r2::gentoo
>>> Installing (1 of 1) sys-apps/iproute2-6.8.0-r2::gentoo
>>> Completed (1 of 1) sys-apps/iproute2-6.8.0-r2::gentoo

works fine with musl-1.2.5 and iproute2-6.8.0-r2
Comment 3 ernsteiswuerfel archtester 2024-07-01 21:08:11 UTC
Sorry I can't confirm this. Still fails for me on iproute2-6.8.0-r2.

[...]
make[1]: Entering directory '/var/tmp/portage/sys-apps/iproute2-6.8.0-r2/work/iproute2-6.8.0/rdma'
clang -Wall -Wstrict-prototypes  -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wformat=2 -Os -march=x86-64-v2 -pipe  -pipe -I../include -I../include/uapi -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONF_USR_DIR=\"/usr/share/iproute2\" -DCONF_ETC_DIR=\"/etc/iproute2\" -DNETNS_RUN_DIR=\"/run/netns\" -DNETNS_ETC_DIR=\"/etc/netns\" -DCONF_COLOR=COLOR_OPT_AUTO -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -Os -march=x86-64-v2 -pipe -DHAVE_HANDLE_AT -DHAVE_HANDLE_AT -DHAVE_SETNS -DHAVE_SETNS -DHAVE_LIBMNL  -DHAVE_LIBMNL  -I./include/uapi/   -c -o rdma.o rdma.c
rdma.c:110:13: error: call to undeclared function 'basename'; ISO C99 and
      later do not support implicit function declarations [-Wimplicit-function-declaration]
  110 |         filename = basename(argv[0]);
      |                    ^
rdma.c:110:11: error: incompatible integer to pointer conversion assigning
      to 'char *' from 'int' [-Wint-conversion]
  110 |         filename = basename(argv[0]);
      |                  ^ ~~~~~~~~~~~~~~~~~
2 errors generated.
make[1]: *** [../config.include:24: rdma.o] Error 1
make[1]: Leaving directory '/var/tmp/portage/sys-apps/iproute2-6.8.0-r2/work/iproute2-6.8.0/rdma'
make: *** [Makefile:79: all] Error 2
 * ERROR: sys-apps/iproute2-6.8.0-r2::gentoo failed (compile phase):
 *   emake failed
Comment 4 ernsteiswuerfel archtester 2024-07-01 21:09:21 UTC
Created attachment 896735 [details]
emerge --info
Comment 5 ernsteiswuerfel archtester 2024-07-01 21:10:33 UTC
Created attachment 896736 [details]
build.log (amd64, 6.8.0-r2)
Comment 6 Mike Gilbert gentoo-dev 2024-07-02 18:19:01 UTC
(In reply to ernsteiswuerfel from comment #3)

This is technically a different error than the one originally reported.

The issue in bpf_legacy.c was fixed upstream.

https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=69e3b2fadcd32683db2942f31fe41f0fbb2185f8

This new issue is in rdma/rdma.c.
Comment 7 Mike Gilbert gentoo-dev 2024-07-02 18:22:29 UTC
Err, bpf_legacy.c was "fixed" by this commit actually.

https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=64ed1886e719f40acb554ac895305acb43f27bea

The other commit (69e3b2fadcd32683db2942f31fe41f0fbb2185f8) resolved a warning and introduced a memory leak.
Comment 8 ernsteiswuerfel archtester 2024-07-02 20:02:14 UTC
Thanks for pointing out! Seems I have not looked closely enough...

The new rdma/rdma.c issue is not fixed upstream yet it seems.
Comment 9 Nathaniel 2024-07-18 12:53:57 UTC
I am having this error, and while an upstream fix would be ideal, if like me you just need to get it to build so you can continue with your install, you can edit the affected `rdma.c` file and add a `#include <libgen.h>` near the beginning.

It's quick-n-dirty hackery at its worst. Don't be like me and quickly edit the file between the time emerge unpacks the integrity-checked source and the time the affected file builds; no, obviously the proper way to apply this dirty hack is to make a local repository and add a patch in the ebuild.

Normally I'd try to submit a patch upstream, but looking at `rdma.c` and its general lack of header inclusions, they probably have a better way of doing this and my clumsy patch would just be noise... but today it gets my system building! :-)
Comment 10 Nathaniel 2024-07-18 18:06:04 UTC
Created attachment 897936 [details, diff]
Patch to build iproute2-6.10.0 successfully

Version 6.10.0 has another one:

../include/libnetlink.h:280:9: error: call to undeclared function 'htobe64'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

If you want to build today, you can use this patch in a custom ebuild to get it building.
Comment 11 Holger Hoffstätte 2024-07-21 07:50:50 UTC
See also: https://bugs.gentoo.org/936234
Comment 12 Mike Gilbert gentoo-dev 2024-07-22 17:43:03 UTC
Please send patches upstream. We can backport once they land there.
Comment 13 Larry the Git Cow gentoo-dev 2024-08-04 16:17:32 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0564906652c69469deab2b7814bb4736d7be5881

commit 0564906652c69469deab2b7814bb4736d7be5881
Author:     Andreas K. Hüttel <dilfridge@gentoo.org>
AuthorDate: 2024-08-04 16:16:13 +0000
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: 2024-08-04 16:17:21 +0000

    sys-apps/iproute2: fix build on musl
    
    Closes: https://bugs.gentoo.org/936234
    Closes: https://bugs.gentoo.org/926341
    Closes: https://github.com/gentoo/gentoo/pull/37658
    Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>

 .../iproute2/files/iproute2-6.10.0-musl-1.patch    | 41 +++++++++++++++++++++
 .../iproute2/files/iproute2-6.10.0-musl-2.patch    | 43 ++++++++++++++++++++++
 sys-apps/iproute2/iproute2-6.10.0.ebuild           |  2 +
 3 files changed, 86 insertions(+)