Opened 8 days ago

Last modified 5 days ago

#71206 new defect

python313 fails to build: error: static assertion failed: "assuming large file"

Reported by: barracuda156 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.10.2
Keywords: tiger, leopard, powerpc Cc: jmroot (Joshua Root)
Port: python313

Description

/opt/local/bin/gcc-mp-14  -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -arch ppc   -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include   -DPy_BUILD_CORE_BUILTIN -c ./Modules/posixmodule.c -o Modules/posixmodule.o
./Modules/posixmodule.c: In function '_pystatvfs_fromstructstatfs':
./Modules/posixmodule.c:13231:5: error: static assertion failed: "assuming large file"
13231 |     _Static_assert(sizeof(st.f_blocks) == sizeof(long long), "assuming large file");
      |     ^~~~~~~~~~~~~~
  1. S. While this is on 10.6 ppc, I am pretty sure the error is unrelated to it being a developer build and can be reproduced on 10.5.8 and 10.6.8.

Attachments (1)

main.log (130.5 KB) - added by barracuda156 8 days ago.

Download all attachments as: .zip

Change History (6)

Changed 8 days ago by barracuda156

Attachment: main.log added

comment:1 Changed 8 days ago by barracuda156

It should probably do something like:

#if defined(__i386__) || defined(__ppc__)
#define statfs statfs64
#endif

comment:2 Changed 7 days ago by jmroot (Joshua Root)

Keywords: snowleopard removed

It built on 10.6 i386. I can't test anything on ppc but feel free to take it up with upstream.

comment:3 Changed 7 days ago by barracuda156

Keywords: snowleopard added

Ok, just for the record, redefining as such does not yet work, since:

./Modules/posixmodule.c: In function 'os_fstatvfs_impl':
./Modules/posixmodule.c:13350:30: error: passing argument 2 of 'fstatfs' from incompatible pointer type [-Wincompatible-pointer-types]
13350 |         result = fstatfs(fd, &st);
      |                              ^~~
      |                              |
      |                              struct statfs64 *
In file included from ./Modules/posixmodule.c:61:
/usr/include/sys/mount.h:360:22: note: expected 'struct statfs *' but argument is of type 'struct statfs64 *'
  360 | int     fstatfs(int, struct statfs *) __DARWIN_INODE64(fstatfs);
      |                      ^~~~~~~~~~~~~~~
./Modules/posixmodule.c: In function 'os_statvfs_impl':
./Modules/posixmodule.c:13404:36: error: passing argument 2 of 'fstatfs' from incompatible pointer type [-Wincompatible-pointer-types]
13404 |         result = fstatfs(path->fd, &st);
      |                                    ^~~
      |                                    |
      |                                    struct statfs64 *
/usr/include/sys/mount.h:360:22: note: expected 'struct statfs *' but argument is of type 'struct statfs64 *'
  360 | int     fstatfs(int, struct statfs *) __DARWIN_INODE64(fstatfs);
      |                      ^~~~~~~~~~~~~~~

Thanks for testing i386, I cannot check that now.

  1. S. keyword change was accidental.
Last edited 7 days ago by barracuda156 (previous) (diff)

comment:4 Changed 7 days ago by barracuda156

Keywords: snowleopard removed

comment:5 in reply to:  2 Changed 5 days ago by barracuda156

Replying to jmroot:

It built on 10.6 i386. I can't test anything on ppc but feel free to take it up with upstream.

Okay, this fixed it:

#if defined(__i386__) || defined(__ppc__)
#define statfs statfs64
#define fstatfs fstatfs64
#endif

Warnings, as expected, are there, but no more errors (and no extra flags, just the patch above):

/opt/local/bin/gcc-mp-14  -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -arch ppc   -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include   -DPy_BUILD_CORE_BUILTIN -c ./Modules/_localemodule.c -o Modules/_localemodule.o
./Modules/posixmodule.c: In function 'os_fstatvfs_impl':
./Modules/posixmodule.c:13351:9: warning: 'fstatfs64' is deprecated [-Wdeprecated-declarations]
13351 |         result = fstatfs(fd, &st);
      |         ^~~~~~
In file included from ./Modules/posixmodule.c:61:
/usr/include/sys/mount.h:362:9: note: declared here
  362 | int     fstatfs64(int, struct statfs64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA);
      |         ^~~~~~~~~
./Modules/posixmodule.c: In function 'os_statvfs_impl':
./Modules/posixmodule.c:13405:9: warning: 'fstatfs64' is deprecated [-Wdeprecated-declarations]
13405 |         result = fstatfs(path->fd, &st);
      |         ^~~~~~
/usr/include/sys/mount.h:362:9: note: declared here
  362 | int     fstatfs64(int, struct statfs64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA);
      |         ^~~~~~~~~
./Modules/posixmodule.c:13408:9: warning: 'statfs64' is deprecated [-Wdeprecated-declarations]
13408 |         result = statfs(path->narrow, &st);
      |         ^~~~~~
/usr/include/sys/mount.h:376:9: note: declared here
  376 | int     statfs64(const char *, struct statfs64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA);
      |         ^~~~~~~~

Now, the question is: is this correct solution?

This is the relevant header in the OS: https://github.com/barracuda156/10.6-PowerPC-SDKs/blob/main/MacOSX10.6.sdk/usr/include/sys/mount.h

  1. S. I am not gonna try submitting a PR for any of the pythons, but having a better fix for myself will be nice.
Note: See TracTickets for help on using tickets.