Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 715862 - sys-fs/diskdev_cmds-332.14_p1-r2 : makehfs.c: fatal error: sys/sysctl.h: No such file or directory
Summary: sys-fs/diskdev_cmds-332.14_p1-r2 : makehfs.c: fatal error: sys/sysctl.h: No s...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo musl team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: missing-musl-includes
  Show dependency tree
 
Reported: 2020-04-02 07:24 UTC by Toralf Förster
Modified: 2021-01-06 21:51 UTC (History)
1 user (show)

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


Attachments
emerge-info.txt (emerge-info.txt,15.66 KB, text/plain)
2020-04-02 07:24 UTC, Toralf Förster
Details
emerge-history.txt (emerge-history.txt,235.96 KB, text/plain)
2020-04-02 07:25 UTC, Toralf Förster
Details
environment (environment,51.11 KB, text/plain)
2020-04-02 07:25 UTC, Toralf Förster
Details
etc.portage.tbz2 (etc.portage.tbz2,24.19 KB, application/x-bzip)
2020-04-02 07:25 UTC, Toralf Förster
Details
sys-fs:diskdev_cmds-332.14_p1-r2:20200402-021314.log (sys-fs:diskdev_cmds-332.14_p1-r2:20200402-021314.log,9.53 KB, text/plain)
2020-04-02 07:25 UTC, Toralf Förster
Details
temp.tbz2 (temp.tbz2,14.87 KB, application/x-bzip)
2020-04-02 07:25 UTC, Toralf Förster
Details
fixes musl build (musl-unb0rked_v2.patch,9.88 KB, patch)
2021-01-04 01:03 UTC, ernsteiswuerfel
Details | Diff
fixes musl build (musl-unb0rked_v3.patch,2.27 KB, patch)
2021-01-06 15:37 UTC, ernsteiswuerfel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2020-04-02 07:24:55 UTC
    1 | #warning redirecting incorrect #include <sys/errno.h> to <errno.h>
      |  ^~~~~~~
makehfs.c:40:10: fatal error: sys/sysctl.h: No such file or directory
   40 | #include <sys/sysctl.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.

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

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 17.0_musl-20200328-141627

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

  Please see the tracker bug for details.

gcc-config -l:
 [1] x86_64-gentoo-linux-musl-9.3.0 *
clang version 10.0.0 
Target: x86_64-gentoo-linux-musl
Thread model: posix
InstalledDir: /usr/lib/llvm/10/bin
/usr/lib/llvm/10
10.0.0
Available Python interpreters, in order of preference:
  [1]   python3.8
  [2]   python3.7
  [3]   python3.6
  [4]   python2.7 (fallback)
Available Ruby profiles:
  [1]   ruby24 (with Rubygems)
  [2]   ruby25 (with Rubygems) *
Available Rust versions:
  [1]   rust-1.42.0 *

timestamp of HEAD at this tinderbox image:
/var/db/repos/gentoo	Thu Apr  2 01:07:42 UTC 2020
/var/db/repos/musl	Fri Mar 27 00:25:27 UTC 2020

emerge -qpvO sys-fs/diskdev_cmds
[ebuild  N    ] sys-fs/diskdev_cmds-332.14_p1-r2
Comment 1 Toralf Förster gentoo-dev 2020-04-02 07:24:59 UTC
Created attachment 628812 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2020-04-02 07:25:02 UTC
Created attachment 628814 [details]
emerge-history.txt
Comment 3 Toralf Förster gentoo-dev 2020-04-02 07:25:05 UTC
Created attachment 628816 [details]
environment
Comment 4 Toralf Förster gentoo-dev 2020-04-02 07:25:10 UTC
Created attachment 628818 [details]
etc.portage.tbz2
Comment 5 Toralf Förster gentoo-dev 2020-04-02 07:25:14 UTC
Created attachment 628820 [details]
sys-fs:diskdev_cmds-332.14_p1-r2:20200402-021314.log
Comment 6 Toralf Förster gentoo-dev 2020-04-02 07:25:17 UTC
Created attachment 628822 [details]
temp.tbz2
Comment 7 Georg Rudoy 2020-08-19 19:04:50 UTC
Can confirm the same error with glibc-2.32.
Comment 8 Larry the Git Cow gentoo-dev 2020-08-19 20:43:38 UTC
The bug has been referenced in the following commit(s):

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

commit 0e18040d345fe623061142cca2a8e0c43ff332e8
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-08-19 20:43:21 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-08-19 20:43:34 +0000

    sys-fs/diskdev_cmds: tweak for glibc-2.32
    
    It does not fix build on musl but fixes build on glibc-2.32.
    
    Reported-by: Georg Rudoy
    Bug: https://bugs.gentoo.org/715862
    Package-Manager: Portage-3.0.3, Repoman-3.0.0
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 sys-fs/diskdev_cmds/diskdev_cmds-332.14_p1-r3.ebuild         |  1 +
 .../files/diskdev_cmds-332.14_p1-no-sysctl.patch             | 12 ++++++++++++
 2 files changed, 13 insertions(+)
Comment 9 ernsteiswuerfel archtester 2021-01-04 01:03:21 UTC
Created attachment 680971 [details, diff]
fixes musl build

This is a straightforward patch
1.) fixing warnings from musl's /usr/include/sys/errno.h
2.) stripping out __P function definitions from glibc's /usr/include/sys/cdefs.h (#define __P(args)	args)
3.) #include <sys/types.h> where type u_char is used

as far as the build is concerned. In the complete source package far more of this stuff above is lurking around but does not matter for the sole building of fsck_hfs and newfs_hfs.

With the patch diskdev_cmds-332.14_p1-r4 builds fine on musl, also the patch does not break the glibc build.
Comment 10 Sergei Trofimovich (RETIRED) gentoo-dev 2021-01-04 13:00:59 UTC
(In reply to ernsteiswuerfel from comment #9)
> Created attachment 680971 [details, diff] [details, diff]
> fixes musl build
> 
> This is a straightforward patch
> 1.) fixing warnings from musl's /usr/include/sys/errno.h
> 2.) stripping out __P function definitions from glibc's
> /usr/include/sys/cdefs.h (#define __P(args)	args)
> 3.) #include <sys/types.h> where type u_char is used
> 
> as far as the build is concerned. In the complete source package far more of
> this stuff above is lurking around but does not matter for the sole building
> of fsck_hfs and newfs_hfs.
> 
> With the patch diskdev_cmds-332.14_p1-r4 builds fine on musl, also the patch
> does not break the glibc build.

The patch looks reasonable. I wonder if you could make it slightly shorter by using something like:

    #ifndef __P
    #    __P(x) x
    #endif

at the beginning of each file that uses __P. That way it should be easier to deal with conflicts when porting patch th newer versions if we ever decide to.
Comment 11 ernsteiswuerfel archtester 2021-01-06 15:37:10 UTC
(In reply to Sergei Trofimovich from comment #10)
> The patch looks reasonable. I wonder if you could make it slightly shorter
> by using something like:
> 
>     #ifndef __P
>     #    __P(x) x
>     #endif
> 
> at the beginning of each file that uses __P. That way it should be easier to
> deal with conflicts when porting patch th newer versions if we ever decide
> to.
Ah yes! I used the same wording as glibc's /usr/include/sys/cdefs.h does:

#ifndef __P
#define __P(args)       args
#endif

And thanks for your very helpful Ebuild hacking tips!
Comment 12 ernsteiswuerfel archtester 2021-01-06 15:37:38 UTC
Created attachment 681547 [details, diff]
fixes musl build
Comment 13 ernsteiswuerfel archtester 2021-01-06 16:22:40 UTC
(In reply to Sergei Trofimovich from comment #10)
> at the beginning of each file that uses __P. That way it should be easier to
> deal with conflicts when porting patch th newer versions if we ever decide
> to.
If we ever decide to port a new version here's a nice site to look at the different versions, upstream Apple does not provide: https://github.com/aosm/diskdev_cmds

Though some other distribution deciced to stick to a specific version and sorta 'fork' it, not wanting to deal with Apple specifics: https://aur.archlinux.org/packages/hfsprogs/
Comment 14 Larry the Git Cow gentoo-dev 2021-01-06 21:51:38 UTC
The bug has been closed via the following commit(s):

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

commit 1dcb636abf0488aec91b2c22e6279ee53f8c18d4
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2021-01-06 21:50:53 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2021-01-06 21:51:33 +0000

    sys-fs/diskdev_cmds: adapt to musl
    
    Reported-by: Toralf Förster
    Fixed-by: ernsteiswuerfel
    Closes: https://bugs.gentoo.org/715862
    Package-Manager: Portage-3.0.12, Repoman-3.0.2
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 .../diskdev_cmds/diskdev_cmds-332.14_p1-r4.ebuild  |  3 +-
 .../files/diskdev_cmds-332.14_p1-musl.patch        | 79 ++++++++++++++++++++++
 2 files changed, 81 insertions(+), 1 deletion(-)
Comment 15 Sergei Trofimovich (RETIRED) gentoo-dev 2021-01-06 21:51:50 UTC
(In reply to ernsteiswuerfel from comment #12)
> Created attachment 681547 [details, diff] [details, diff]
> fixes musl build

Pushed as is. Thank you!