public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/110462] New: [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?)
@ 2023-06-28 17:11 sjames at gcc dot gnu.org
  2023-06-28 17:12 ` [Bug libstdc++/110462] " sjames at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-06-28 17:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110462

            Bug ID: 110462
           Summary: [14 regression] Build failure with musl-1.2.4
                    (filesystem/ops-common.h:377:5: error: 'off64_t' was
                    not declared in this scope; did you mean 'off_t'?)
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

See PR109533. Pretty sure this was caused by r14-1569-gd87caacf8e2df5.

```
In file included from
/var/tmp/portage/sys-devel/gcc-14.0.0.9999/work/gcc-14.0.0.9999/libstdc++-v3/src/c++17/fs_ops.cc:63:
/var/tmp/portage/sys-devel/gcc-14.0.0.9999/work/gcc-14.0.0.9999/libstdc++-v3/src/c++17/../filesystem/ops-common.h:
In function 'bool std::filesystem::copy_file_copy_file_range(int, int,
std::size_t)':
/var/tmp/portage/sys-devel/gcc-14.0.0.9999/work/gcc-14.0.0.9999/libstdc++-v3/src/c++17/../filesystem/ops-common.h:377:5:
error: 'off64_t' was not declared in this scope; did you mean 'off_t'?
  377 |     off64_t off_in = 0, off_out = 0;
      |     ^~~~~~~
      |     off_t
/var/tmp/portage/sys-devel/gcc-14.0.0.9999/work/gcc-14.0.0.9999/libstdc++-v3/src/c++17/../filesystem/ops-common.h:381:50:
error: 'off_in' was not declared in this scope; did you mean 'fd_in'?
  381 |         bytes_copied = ::copy_file_range(fd_in, &off_in, fd_out,
&off_out,
      |                                                  ^~~~~~
      |                                                  fd_in
/var/tmp/portage/sys-devel/gcc-14.0.0.9999/work/gcc-14.0.0.9999/libstdc++-v3/src/c++17/../filesystem/ops-common.h:381:67:
error: 'off_out' was not declared in this scope; did you mean 'fd_out'?
  381 |         bytes_copied = ::copy_file_range(fd_in, &off_in, fd_out,
&off_out,
      |                                                                  
^~~~~~~
      |                                                                  
fd_out
make[6]: *** [Makefile:587: fs_ops.lo] Error 1
```

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/110462] [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?)
  2023-06-28 17:11 [Bug libstdc++/110462] New: [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?) sjames at gcc dot gnu.org
@ 2023-06-28 17:12 ` sjames at gcc dot gnu.org
  2023-06-28 17:13 ` redi at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-06-28 17:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110462

--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
Created attachment 55415
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55415&action=edit
build.log.xz

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/110462] [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?)
  2023-06-28 17:11 [Bug libstdc++/110462] New: [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?) sjames at gcc dot gnu.org
  2023-06-28 17:12 ` [Bug libstdc++/110462] " sjames at gcc dot gnu.org
@ 2023-06-28 17:13 ` redi at gcc dot gnu.org
  2023-06-28 17:14 ` sjames at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2023-06-28 17:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110462

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The system call is defined in terms of off64_t. What type does musl use for
copy_file_range(2)?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/110462] [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?)
  2023-06-28 17:11 [Bug libstdc++/110462] New: [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?) sjames at gcc dot gnu.org
  2023-06-28 17:12 ` [Bug libstdc++/110462] " sjames at gcc dot gnu.org
  2023-06-28 17:13 ` redi at gcc dot gnu.org
@ 2023-06-28 17:14 ` sjames at gcc dot gnu.org
  2023-06-28 17:15 ` sjames at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-06-28 17:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110462

--- Comment #3 from Sam James <sjames at gcc dot gnu.org> ---
Looks like we already AC_SYS_LARGEFILE in libstdc++-v3/configure.ac, so this
should be as simple as just using off_t instead?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/110462] [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?)
  2023-06-28 17:11 [Bug libstdc++/110462] New: [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?) sjames at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-06-28 17:14 ` sjames at gcc dot gnu.org
@ 2023-06-28 17:15 ` sjames at gcc dot gnu.org
  2023-06-28 17:15 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-06-28 17:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110462

--- Comment #4 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #2)
> The system call is defined in terms of off64_t. What type does musl use for
> copy_file_range(2)?

/usr/include/unistd.h:197:ssize_t copy_file_range(int, off_t *, int, off_t *,
size_t, unsigned);

On musl, off_t and friends are always 64-bit (i.e. it's natively LFS, no need
for largefile source functions/types). In musl-1.2.4, they dropped the
typedefs.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/110462] [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?)
  2023-06-28 17:11 [Bug libstdc++/110462] New: [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?) sjames at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-06-28 17:15 ` sjames at gcc dot gnu.org
@ 2023-06-28 17:15 ` redi at gcc dot gnu.org
  2023-06-28 17:16 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2023-06-28 17:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110462

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This would "fix" it, but only by disabling copy_file_range use with musl:

--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -5160,7 +5160,7 @@ dnl
       linux*)
        GCC_TRY_COMPILE_OR_LINK(
          [#include <unistd.h>],
-         [copy_file_range(1, nullptr, 2, nullptr, 1, 0);],
+         [copy_file_range(1, (off64_t*)nullptr, 2, (off64_t*)nullptr, 1, 0);],
          [glibcxx_cv_copy_file_range=yes],
          [glibcxx_cv_copy_file_range=no])
        ;;


It would be better to figure out how to use it.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/110462] [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?)
  2023-06-28 17:11 [Bug libstdc++/110462] New: [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?) sjames at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-06-28 17:15 ` redi at gcc dot gnu.org
@ 2023-06-28 17:16 ` redi at gcc dot gnu.org
  2023-06-28 17:18 ` sjames at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2023-06-28 17:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110462

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Sam James from comment #4)
> On musl, off_t and friends are always 64-bit (i.e. it's natively LFS, no
> need for largefile source functions/types). In musl-1.2.4, they dropped the
> typedefs.

But that doesn't help write portable code where off_t might not be 64-bit, and
we need to use off64_t as the correct type to pass to the function.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/110462] [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?)
  2023-06-28 17:11 [Bug libstdc++/110462] New: [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?) sjames at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-06-28 17:16 ` redi at gcc dot gnu.org
@ 2023-06-28 17:18 ` sjames at gcc dot gnu.org
  2023-06-28 17:23 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-06-28 17:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110462

--- Comment #7 from Sam James <sjames at gcc dot gnu.org> ---
Oh, duh, it's libstdc++. I'm not sure there's an alternative to typedefing it
then.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/110462] [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?)
  2023-06-28 17:11 [Bug libstdc++/110462] New: [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?) sjames at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-06-28 17:18 ` sjames at gcc dot gnu.org
@ 2023-06-28 17:23 ` redi at gcc dot gnu.org
  2023-06-28 18:03 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2023-06-28 17:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110462

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2023-06-28
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
   Target Milestone|---                         |14.0
     Ever confirmed|0                           |1

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Sam James from comment #3)
> Looks like we already AC_SYS_LARGEFILE in libstdc++-v3/configure.ac, so this
> should be as simple as just using off_t instead?

Ah but the filesystem sources include <bits/largefile-config.h> which means
off_t is 64-bit here.

I'll test this:

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index efc27aa493e..43dd80abc15 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -5160,7 +5160,7 @@ dnl
       linux*)
        GCC_TRY_COMPILE_OR_LINK(
          [#include <unistd.h>],
-         [copy_file_range(1, nullptr, 2, nullptr, 1, 0);],
+         [copy_file_range(1, (off_t*)nullptr, 2, (off_t*)nullptr, 1, 0);],
          [glibcxx_cv_copy_file_range=yes],
          [glibcxx_cv_copy_file_range=no])
        ;;
diff --git a/libstdc++-v3/src/filesystem/ops-common.h
b/libstdc++-v3/src/filesystem/ops-common.h
index f04bbc66d7d..e04cb4010d7 100644
--- a/libstdc++-v3/src/filesystem/ops-common.h
+++ b/libstdc++-v3/src/filesystem/ops-common.h
@@ -374,7 +374,9 @@ _GLIBCXX_BEGIN_NAMESPACE_FILESYSTEM
        return false;
       }
     size_t bytes_left = length;
-    off64_t off_in = 0, off_out = 0;
+    // copy_file_range wants off64_t* args, but libc might only define off_t.
+    static_assert(sizeof(off_t) == sizeof(int64_t), "off_t is 64-bit");
+    off_t off_in = 0, off_out = 0;
     ssize_t bytes_copied;
     do
       {

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/110462] [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?)
  2023-06-28 17:11 [Bug libstdc++/110462] New: [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?) sjames at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2023-06-28 17:23 ` redi at gcc dot gnu.org
@ 2023-06-28 18:03 ` redi at gcc dot gnu.org
  2023-06-28 18:44 ` sjames at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2023-06-28 18:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110462

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It seems we should be using loff_t here.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/110462] [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?)
  2023-06-28 17:11 [Bug libstdc++/110462] New: [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?) sjames at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2023-06-28 18:03 ` redi at gcc dot gnu.org
@ 2023-06-28 18:44 ` sjames at gcc dot gnu.org
  2023-06-29 15:19 ` cvs-commit at gcc dot gnu.org
  2023-06-29 15:22 ` redi at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-06-28 18:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110462

--- Comment #10 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #9)
> It seems we should be using loff_t here.

For the benefit of the bug:
https://lore.kernel.org/linux-man/add1e27e-e10c-e70d-ed5e-85bb0d4d4101@cs.ucla.edu/T/#me942a9ccc53dc5b00b2fab58f493632c143326df.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/110462] [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?)
  2023-06-28 17:11 [Bug libstdc++/110462] New: [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?) sjames at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2023-06-28 18:44 ` sjames at gcc dot gnu.org
@ 2023-06-29 15:19 ` cvs-commit at gcc dot gnu.org
  2023-06-29 15:22 ` redi at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-29 15:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110462

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:ff29ee6af88f709e08ee467869d8c1b13889a724

commit r14-2191-gff29ee6af88f709e08ee467869d8c1b13889a724
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jun 28 19:10:29 2023 +0100

    libstdc++: Do not use off64_t in calls to copy_file_range [PR110462]

    Although the copy_file_range(2) man page shows the arguments as off64_t*
    that is not portable. For musl there is no off64_t type, as off_t is
    always 64-bit. Use the loff_t type which is always 64-bit even if off_t
    isn't. We could just use off_t because the filesystem library is
    compiled with _FILE_OFFSET_BITS=64, but loff_t is the more correct type
    for this interface.

    libstdc++-v3/ChangeLog:

            PR libstdc++/110462
            * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check that
            copy_file_range can be called with loff_t* arguments.
            * configure: Regenerate.
            * src/filesystem/ops-common.h (copy_file_copy_file_range):
            Use loff_t for offsets.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/110462] [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?)
  2023-06-28 17:11 [Bug libstdc++/110462] New: [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?) sjames at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2023-06-29 15:19 ` cvs-commit at gcc dot gnu.org
@ 2023-06-29 15:22 ` redi at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2023-06-29 15:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110462

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Should be fixed now.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-06-29 15:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28 17:11 [Bug libstdc++/110462] New: [14 regression] Build failure with musl-1.2.4 (filesystem/ops-common.h:377:5: error: 'off64_t' was not declared in this scope; did you mean 'off_t'?) sjames at gcc dot gnu.org
2023-06-28 17:12 ` [Bug libstdc++/110462] " sjames at gcc dot gnu.org
2023-06-28 17:13 ` redi at gcc dot gnu.org
2023-06-28 17:14 ` sjames at gcc dot gnu.org
2023-06-28 17:15 ` sjames at gcc dot gnu.org
2023-06-28 17:15 ` redi at gcc dot gnu.org
2023-06-28 17:16 ` redi at gcc dot gnu.org
2023-06-28 17:18 ` sjames at gcc dot gnu.org
2023-06-28 17:23 ` redi at gcc dot gnu.org
2023-06-28 18:03 ` redi at gcc dot gnu.org
2023-06-28 18:44 ` sjames at gcc dot gnu.org
2023-06-29 15:19 ` cvs-commit at gcc dot gnu.org
2023-06-29 15:22 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).