Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 938846 - sys-libs/libsemanage-3.7 - [gcc-15] direct_api.c: error: implicit declaration of function basename [-Wimplicit-function-declaration]
Summary: sys-libs/libsemanage-3.7 - [gcc-15] direct_api.c: error: implicit declaration...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo musl team
URL:
Whiteboard: musl/basename
Keywords:
Depends on:
Blocks: musl-1.2.5
  Show dependency tree
 
Reported: 2024-08-31 20:15 UTC by Toralf Förster
Modified: 2025-01-08 17:53 UTC (History)
3 users (show)

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


Attachments
emerge-info.txt (emerge-info.txt,19.64 KB, text/plain)
2024-08-31 20:15 UTC, Toralf Förster
Details
emerge-history.txt.xz (emerge-history.txt.xz,87.46 KB, application/x-xz)
2024-08-31 20:15 UTC, Toralf Förster
Details
environment (environment,121.01 KB, text/plain)
2024-08-31 20:16 UTC, Toralf Förster
Details
etc.clang.tar.xz (etc.clang.tar.xz,1020 bytes, application/x-xz)
2024-08-31 20:16 UTC, Toralf Förster
Details
etc.portage.tar.xz (etc.portage.tar.xz,44.29 KB, application/x-xz)
2024-08-31 20:16 UTC, Toralf Förster
Details
qlist-info.txt.xz (qlist-info.txt.xz,88.45 KB, application/x-xz)
2024-08-31 20:16 UTC, Toralf Förster
Details
sys-libs:libsemanage-3.7:20240831-201235.log (sys-libs:libsemanage-3.7:20240831-201235.log,5.65 KB, text/plain)
2024-08-31 20:16 UTC, Toralf Förster
Details
temp.tar.xz (temp.tar.xz,26.74 KB, application/x-xz)
2024-08-31 20:16 UTC, Toralf Förster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2024-08-31 20:15:56 UTC
too long lines were shrinked:

x86_64-pc-linux-musl-gcc  -O2 -pipe -march=native -fno-diagnostics-color -fno-semantic-interposition -I../include -D_GNU_SOURCE -c -o database_llist.o database_llist.c
x86_64-pc-linux-musl-gcc  -O2 -pipe -march=native -fno-diagnostics-color -fno-semantic-interposition -I../include -D_GNU_SOURCE -c -o database_policydb.o database_policydb.c
x86_64-pc-linux-musl-gcc  -O2 -pipe -march=native -fno-diagnostics-color -fno-semantic-interposition -I../include -D_GNU_SOURCE -c -o debug.o debug.c
x86_64-pc-linux-musl-gcc  -O2 -pipe -march=native -fno-diagnostics-color -fno-semantic-interposition -I../include -D_GNU_SOURCE -c -o direct_api.o direct_api.c
x86_64-pc-linux-musl-gcc  -O2 -pipe -march=native -fno-diagnostics-color -fno-semantic-interposition -I../include -D_GNU_SOURCE -c -o fcontext_record.o fcontext_record.c
direct_api.c: In function 'semanage_direct_install_file':
direct_api.c:1738:20: error: implicit declaration of function 'basename' [-Wimplicit-function-declaration]
 1738 |         filename = basename(path);
      |                    ^~~~~~~~

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 23.0_musl-20240824-035506

  UNMASKED:
    Please re-assign to toolchain@ if you get a test failure in C, C++, or Fortran code which makes no sense.
  /etc/portage/package.unmask/60gcc:<sys-devel/gcc-15.0.9999:15

  The attached etc.portage.tar.xz has all details.
  -------------------------------------------------------------------

gcc-config -l:
 [1] x86_64-pc-linux-musl-15 *
clang/llvm (if any):
clang version 18.1.8
Target: x86_64-pc-linux-musl
Thread model: posix
InstalledDir: /usr/lib/llvm/18/bin
Configuration file: /etc/clang/x86_64-pc-linux-musl-clang.cfg
/usr/lib/llvm/18
18.1.8
Python 3.12.5
Available Ruby profiles:
  [1]   ruby31 (with Rubygems)
  [2]   ruby32 (with Rubygems)
  [3]   ruby33 (with Rubygems) *
Available Rust versions:
  [1]   rust-bin-1.80.1 *
The following VMs are available for generation-2:
1)	Eclipse Temurin JDK 11.0.24_p8 [openjdk-bin-11]
2)	Eclipse Temurin JDK 17.0.12_p7 [openjdk-bin-17]
*)	Eclipse Temurin JDK 21.0.4_p7 [openjdk-bin-21]
Available Java Virtual Machines:
  [1]   openjdk-bin-11 
  [2]   openjdk-bin-17 
  [3]   openjdk-bin-21  system-vm

php cli (if any):
go version go1.23.0 linux/amd64

  HEAD of ::gentoo
commit 02d5d10f3c9f580626d39e88f53fa61508fe18b6
Author: Repository mirror & CI <repomirrorci@gentoo.org>
Date:   Sat Aug 31 19:33:51 2024 +0000

    2024-08-31 19:33:51 UTC

emerge -qpvO =sys-libs/libsemanage-3.7
[ebuild  N    ] sys-libs/libsemanage-3.7  PYTHON_TARGETS="python3_12 -python3_10 -python3_11"
Comment 1 Toralf Förster gentoo-dev 2024-08-31 20:15:57 UTC
Created attachment 901784 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2024-08-31 20:15:59 UTC
Created attachment 901785 [details]
emerge-history.txt.xz
Comment 3 Toralf Förster gentoo-dev 2024-08-31 20:16:00 UTC
Created attachment 901786 [details]
environment
Comment 4 Toralf Förster gentoo-dev 2024-08-31 20:16:01 UTC
Created attachment 901787 [details]
etc.clang.tar.xz
Comment 5 Toralf Förster gentoo-dev 2024-08-31 20:16:02 UTC
Created attachment 901788 [details]
etc.portage.tar.xz
Comment 6 Toralf Förster gentoo-dev 2024-08-31 20:16:03 UTC
Created attachment 901789 [details]
qlist-info.txt.xz
Comment 7 Toralf Förster gentoo-dev 2024-08-31 20:16:04 UTC
Created attachment 901790 [details]
sys-libs:libsemanage-3.7:20240831-201235.log
Comment 8 Toralf Förster gentoo-dev 2024-08-31 20:16:05 UTC
Created attachment 901791 [details]
temp.tar.xz
Comment 9 poieen 2024-12-28 19:09:50 UTC
this is caused by a missing header: libgen.h
i've made this patch to add it to the files where it's required:


--- a/src/direct_api.c
+++ b/src/direct_api.c
@@ -38,6 +38,7 @@
 #include <limits.h>
 #include <errno.h>
 #include <dirent.h>
+#include <libgen.h>

 #include "user_internal.h"
 #include "seuser_internal.h"
--- a/src/conf-parse.y
+++ b/src/conf-parse.y
@@ -30,6 +30,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <libgen.h>

 extern int semanage_lex(void);                /* defined in conf-scan.c */
 extern int semanage_lex_destroy(void);        /* defined in conf-scan.c */
Comment 10 poieen 2024-12-28 19:54:18 UTC
it seems that this is musl specific, since glibc declares the basename function within string.h
Comment 11 Christian Tramnitz 2025-01-08 17:53:01 UTC
I think its the other way around: libsemanage relies on glibc which defines `basename` twice. The one declared in stdlib.h has alternate semantics and signature that conflict with the standard definition. musl only provides the standard one.

libsemanage seems to expect the alternate glibc/stdlib.h definition, even upstream: https://github.com/SELinuxProject/selinux/pull/440/files

(this is also present in libsemanage-3.6)