Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 617778 - sys-apps/portage-2.3.5: build fails with musl: error: unknown type name ‘loff_t’
Summary: sys-apps/portage-2.3.5: build fails with musl: error: unknown type name ‘loff_t’
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 619102
  Show dependency tree
 
Reported: 2017-05-07 23:29 UTC by Zac Medico
Modified: 2017-08-11 19:42 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zac Medico gentoo-dev 2017-05-07 23:29:58 UTC
Build fails as follows with musl:

src/portage_util_file_copy_reflink_linux.c:69:36: error: unknown type name ‘loff_t’
 cfr_wrapper(int fd_out, int fd_in, loff_t *off_out, size_t len)
                                    ^
src/portage_util_file_copy_reflink_linux.c:99:38: error: unknown type name ‘loff_t’
 do_lseek_data(int fd_out, int fd_in, loff_t *off_out) {
                                      ^
src/portage_util_file_copy_reflink_linux.c: In function ‘_reflink_linux_file_copy’:
src/portage_util_file_copy_reflink_linux.c:192:35: error: unknown type name ‘loff_t’
     ssize_t (*copyfunc)(int, int, loff_t *, size_t);

The problem was initially reported here:

https://github.com/gentoo/portage/pull/159
Comment 2 Felix Janda 2017-05-08 03:07:41 UTC
The patch looks good to me.

Actually -D_FILE_OFFSET_BITS=64 suffices, and -D_LARGEFILE_SOURCE and
-D_LARGEFILE64_SOURCE are unecessary. See feature_test_macros(7).
Comment 3 Zac Medico gentoo-dev 2017-05-08 16:26:10 UTC
(In reply to Felix Janda from comment #2)
> The patch looks good to me.

Thanks!

> Actually -D_FILE_OFFSET_BITS=64 suffices, and -D_LARGEFILE_SOURCE and
> -D_LARGEFILE64_SOURCE are unecessary. See feature_test_macros(7).

It says new programs should just use -D_FILE_OFFSET_BITS=64, but I wonder if the other macros are useful for prefix, since it might be compiled against an older libc. Ultimately, it would be nice to even support non-Linux platforms.
Comment 4 Fabian Groffen gentoo-dev 2017-05-08 20:13:07 UTC
Older libc (RH/CO/OL5 or 6) yes, non-Linux, I doubt it since this is pretty much linux specific isn't it?
Comment 5 Zac Medico gentoo-dev 2017-05-08 20:28:09 UTC
(In reply to Fabian Groffen from comment #4)
> Older libc (RH/CO/OL5 or 6) yes

Okay, that seems like a good enough reason to cargo cult the old macros.

> non-Linux, I doubt it since this is pretty much linux specific isn't it?

Maybe we could implement sparse copy for FreeBSD, since its lseek apparently supports SEEK_HOLE and SEEK_DATA:

https://www.freebsd.org/cgi/man.cgi?query=lseek&sektion=2

I see that sendfile does not support output to regular files on either FreeBSD or MacOS.
Comment 6 Michael Haubenwallner (RETIRED) gentoo-dev 2017-05-09 07:42:18 UTC
(In reply to Zac Medico from comment #3)
> > Actually -D_FILE_OFFSET_BITS=64 suffices, and -D_LARGEFILE_SOURCE and
> > -D_LARGEFILE64_SOURCE are unecessary. See feature_test_macros(7).
> 
> It says new programs should just use -D_FILE_OFFSET_BITS=64, but I wonder if
> the other macros are useful for prefix, since it might be compiled against
> an older libc. Ultimately, it would be nice to even support non-Linux
> platforms.

Existing autoconf macros are a nice reference here - AC_SYS_LARGEFILE in particular:
http://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/specific.m4#n128

AIX for example needs _LARGE_FILES.
Comment 7 Zac Medico gentoo-dev 2017-05-09 16:54:06 UTC
This is in the master branch:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=1a7aeb58c4e687e4d4012054b56373f27941a067

(In reply to Michael Haubenwallner from comment #6)
> Existing autoconf macros are a nice reference here - AC_SYS_LARGEFILE in
> particular:
>http://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/specific.m4#n128
> 
> AIX for example needs _LARGE_FILES.

Okay, looks like we'll probably want to move to autoconf for non-Linux support. Thanks!
Comment 8 Zac Medico gentoo-dev 2017-08-11 19:42:58 UTC
Fixed in 2.3.6.