Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 926289 - sys-fs/mdadm-4.3 - mdadm.c:1363:18: error: call to undeclared function 'basename' and other failures
Summary: sys-fs/mdadm-4.3 - mdadm.c:1363:18: error: call to undeclared function 'basen...
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:
Depends on:
Blocks: musl-1.2.5
  Show dependency tree
 
Reported: 2024-03-06 23:51 UTC by ernsteiswuerfel
Modified: 2025-02-13 12:01 UTC (History)
2 users (show)

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


Attachments
build.log (mdadm-4.2-r3:20240306-234528.log,3.24 KB, text/plain)
2024-03-06 23:51 UTC, ernsteiswuerfel
Details
emerge --info (file_926289.txt,7.42 KB, text/plain)
2024-03-06 23:51 UTC, ernsteiswuerfel
Details
musl_basename.patch (musl_basename.patch,550 bytes, patch)
2024-08-14 17:03 UTC, ernsteiswuerfel
Details | Diff
musl_limits.patch (musl_limits.patch,254 bytes, patch)
2024-08-14 17:14 UTC, ernsteiswuerfel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ernsteiswuerfel archtester 2024-03-06 23:51:03 UTC
Created attachment 886835 [details]
build.log

[...]
make -j1 PKG_CONFIG=x86_64-gentoo-linux-musl-pkg-config CC=clang CWFLAGS=-Wall 'CXFLAGS=-Os -march=x86-64-v2 -pipe' UDEVDIR=/lib/udev SYSTEMD_DIR=/lib/systemd/system COROSYNC=-DNO_COROSYNC DLM=-DNO_DLM STRIP= all 
clang -Wall -Os -march=x86-64-v2 -pipe -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\" -DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\" -DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM    -DUSE_PTHREADS  -D_LARGEFILE64_SOURCE -DBINDIR=\"/sbin\"  -o mdadm.o -c mdadm.c
mdadm.c:1363:18: error: call to undeclared function 'basename'; ISO C99 and
      later do not support implicit function declarations [-Wimplicit-function-declaration]
 1363 |                         char *bname = basename(devlist->devname);
      |                                       ^
mdadm.c:1363:10: error: incompatible integer to pointer conversion
      initializing 'char *' with an expression of type 'int' [-Wint-conversion]
 1363 |                         char *bname = basename(devlist->devname);
      |                               ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
make: *** [Makefile:193: mdadm.o] Error 1
Comment 1 ernsteiswuerfel archtester 2024-03-06 23:51:59 UTC
Created attachment 886836 [details]
emerge --info
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2024-03-14 03:39:10 UTC
cannot reproduce
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-03-14 08:27:19 UTC
You need musl-1.2.5.
Comment 4 Andreas K. Hüttel archtester gentoo-dev 2024-04-30 19:31:50 UTC
util.c: In function 'get_md_name':
util.c:1031:29: error: 'NAME_MAX' undeclared (first use in this function); did you mean 'MD_NAME_MAX'?
 1031 |         static char devname[NAME_MAX];
      |                             ^~~~~~~~
      |                             MD_NAME_MAX
util.c:1031:29: note: each undeclared identifier is reported only once for each function it appears in
util.c:1031:21: warning: unused variable 'devname' [-Wunused-variable]
 1031 |         static char devname[NAME_MAX];
      |                     ^~~~~~~
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-07-10 06:49:57 UTC
I don't see how it can't be..
Comment 6 ernsteiswuerfel archtester 2024-08-14 17:03:38 UTC
Created attachment 900110 [details, diff]
musl_basename.patch

Upstream patch: https://github.com/md-raid-utilities/mdadm/commit/9dbd11e091f84eb0bf9d717283774816c4c4453d

Solves the 'basename' build issue on mdadm-4.2-r3 and mdadm-4.3 on musl-1.2.5-r1.

This build issue still remains for mdadm-4.3 on musl-1.2.5-r1:
[...]
clang -Wall -Os -march=x86-64-v2 -pipe -DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\" -DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\" -DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\" -DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM    -DUSE_PTHREADS  -D_LARGEFILE64_SOURCE -DBINDIR=\"/sbin\"  -o util.o -c util.c
util.c:1031:22: error: use of undeclared identifier 'NAME_MAX'
 1031 |         static char devname[NAME_MAX];
      |                             ^
1 error generated.
make: *** [Makefile:211: util.o] Error 1
 * ERROR: sys-fs/mdadm-4.3::gentoo failed (compile phase):
Comment 7 ernsteiswuerfel archtester 2024-08-14 17:14:09 UTC
Created attachment 900149 [details, diff]
musl_limits.patch

Upstream patch: https://github.com/md-raid-utilities/mdadm/commit/8bda86099089b44129ef6206764f9de47a45f0db

Solves the 'error: use of undeclared identifier 'NAME_MAX'' build issue on mdadm-4.3 on musl-1.2.5-r1.

With both patches applied mdadm-4.3 builds fine on musl-1.2.5-r1.
Comment 8 Larry the Git Cow gentoo-dev 2025-02-13 12:00:43 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2637faef70821b8cfa25cd5ca4d340fa3ddf70bd

commit 2637faef70821b8cfa25cd5ca4d340fa3ddf70bd
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2025-02-13 11:58:30 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-02-13 11:58:30 +0000

    sys-fs/mdadm: backport musl build fixes to 4.3-r1
    
    Closes: https://bugs.gentoo.org/926289
    Thanks-to: ernsteiswuerfel <erhard_f@mailbox.org>
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-fs/mdadm/files/mdadm-4.3-musl-basename.patch | 19 +++++++++++++++++++
 sys-fs/mdadm/files/mdadm-4.3-musl-include.patch  | 14 ++++++++++++++
 sys-fs/mdadm/mdadm-4.3-r1.ebuild                 |  2 ++
 3 files changed, 35 insertions(+)

Additionally, it has been referenced in the following commit(s):

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

commit f3a618d336bbf468e0a58fe7cfd5339fdceabe4a
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2025-02-13 11:55:40 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-02-13 11:56:13 +0000

    sys-fs/mdadm: add 4.4
    
    Note that this drops mdadm_env.sh as was done upstream in a7a5e676a7eb2ac97acd31b13f75515e9573f891,
    it's not like it was working correctly anyway for systemd, and for OpenRC,
    the default config only had --syslog in there - yet for OpenRC, it'll continue
    working anyway as it wasn't using mdadm_env.sh to begin with.
    
    Bug: https://bugs.gentoo.org/926289
    Closes: https://bugs.gentoo.org/948994
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-fs/mdadm/Manifest         |   2 +
 sys-fs/mdadm/mdadm-4.4.ebuild | 122 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 124 insertions(+)