v1.1.0rc does not build on macOS 10.12.6 #476

Closed
opened 2026-01-29 20:44:33 +00:00 by claunia · 8 comments
Owner

Originally created by @debohman on GitHub (Aug 23, 2023).

FAILED: CMakeFiles/brotli.dir/c/tools/brotli.c.o 
/usr/local/bin/cc -DBROTLI_HAVE_LOG2=1 -DBROTLI_SHARED_COMPILATION -DOS_MACOSX -I/tera/tera/debo/Projects/brotli/v1.1.0rc/c/include -O3 -DNDEBUG -MD -MT CMakeFiles/brotli.dir/c/tools/brotli.c.o -MF CMakeFiles/brotli.dir/c/tools/brotli.c.o.d -o CMakeFiles/brotli.dir/c/tools/brotli.c.o -c /tera/tera/debo/Projects/brotli/v1.1.0rc/c/tools/brotli.c
/tera/tera/debo/Projects/brotli/v1.1.0rc/c/tools/brotli.c:709:10: error: call to undeclared function 'utimensat'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  return utimensat(AT_FDCWD, output_path, times, AT_SYMLINK_NOFOLLOW);

It seems to come from here in c/tools/brotli.c:

#if defined(__APPLE__) && !defined(_POSIX_C_SOURCE)
#define HAVE_UTIMENSAT 1
#define ATIME_NSEC(S) ((S)->st_atimespec.tv_nsec)
#define MTIME_NSEC(S) ((S)->st_mtimespec.tv_nsec)
#elif defined(_WIN32) || !defined(AT_SYMLINK_NOFOLLOW)
#define HAVE_UTIMENSAT 0
#else
#define HAVE_UTIMENSAT 1
#define ATIME_NSEC(S) ((S)->st_atim.tv_nsec)
#define MTIME_NSEC(S) ((S)->st_mtim.tv_nsec)
#endif

The logic does not allow for no utimensat() except on _WIN32.

Originally created by @debohman on GitHub (Aug 23, 2023). ``` FAILED: CMakeFiles/brotli.dir/c/tools/brotli.c.o /usr/local/bin/cc -DBROTLI_HAVE_LOG2=1 -DBROTLI_SHARED_COMPILATION -DOS_MACOSX -I/tera/tera/debo/Projects/brotli/v1.1.0rc/c/include -O3 -DNDEBUG -MD -MT CMakeFiles/brotli.dir/c/tools/brotli.c.o -MF CMakeFiles/brotli.dir/c/tools/brotli.c.o.d -o CMakeFiles/brotli.dir/c/tools/brotli.c.o -c /tera/tera/debo/Projects/brotli/v1.1.0rc/c/tools/brotli.c /tera/tera/debo/Projects/brotli/v1.1.0rc/c/tools/brotli.c:709:10: error: call to undeclared function 'utimensat'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] return utimensat(AT_FDCWD, output_path, times, AT_SYMLINK_NOFOLLOW); ``` It seems to come from here in `c/tools/brotli.c`: ``` #if defined(__APPLE__) && !defined(_POSIX_C_SOURCE) #define HAVE_UTIMENSAT 1 #define ATIME_NSEC(S) ((S)->st_atimespec.tv_nsec) #define MTIME_NSEC(S) ((S)->st_mtimespec.tv_nsec) #elif defined(_WIN32) || !defined(AT_SYMLINK_NOFOLLOW) #define HAVE_UTIMENSAT 0 #else #define HAVE_UTIMENSAT 1 #define ATIME_NSEC(S) ((S)->st_atim.tv_nsec) #define MTIME_NSEC(S) ((S)->st_mtim.tv_nsec) #endif ``` The logic does not allow for no `utimensat()` except on `_WIN32`.
Author
Owner

@debohman commented on GitHub (Aug 23, 2023):

Seems that the existence of utimensat() should be conditioned on _ATFILE_SOURCE.

@debohman commented on GitHub (Aug 23, 2023): Seems that the existence of `utimensat()` should be conditioned on `_ATFILE_SOURCE`.
Author
Owner

@debohman commented on GitHub (Aug 23, 2023):

Something like this:

diff --git a/c/tools/brotli.c b/c/tools/brotli.c
index 432fa52..017382b 100644
--- a/c/tools/brotli.c
+++ b/c/tools/brotli.c
@@ -75,17 +75,18 @@ static int ms_open(const char* filename, int oflag, int pmode) {
 #define MAKE_BINARY(FILENO) (FILENO)
 #endif  /* defined(_WIN32) */
 
-#if defined(__APPLE__) && !defined(_POSIX_C_SOURCE)
+#if defined(_ATFILE_SOURCE)
 #define HAVE_UTIMENSAT 1
+#if defined(__APPLE__) && !defined(_POSIX_C_SOURCE)
 #define ATIME_NSEC(S) ((S)->st_atimespec.tv_nsec)
 #define MTIME_NSEC(S) ((S)->st_mtimespec.tv_nsec)
-#elif defined(_WIN32) || !defined(AT_SYMLINK_NOFOLLOW)
-#define HAVE_UTIMENSAT 0
 #else
-#define HAVE_UTIMENSAT 1
 #define ATIME_NSEC(S) ((S)->st_atim.tv_nsec)
 #define MTIME_NSEC(S) ((S)->st_mtim.tv_nsec)
 #endif
+#else
+#define HAVE_UTIMENSAT 0
+#endif
 
 typedef enum {
   COMMAND_COMPRESS,
@debohman commented on GitHub (Aug 23, 2023): Something like this: ``` diff --git a/c/tools/brotli.c b/c/tools/brotli.c index 432fa52..017382b 100644 --- a/c/tools/brotli.c +++ b/c/tools/brotli.c @@ -75,17 +75,18 @@ static int ms_open(const char* filename, int oflag, int pmode) { #define MAKE_BINARY(FILENO) (FILENO) #endif /* defined(_WIN32) */ -#if defined(__APPLE__) && !defined(_POSIX_C_SOURCE) +#if defined(_ATFILE_SOURCE) #define HAVE_UTIMENSAT 1 +#if defined(__APPLE__) && !defined(_POSIX_C_SOURCE) #define ATIME_NSEC(S) ((S)->st_atimespec.tv_nsec) #define MTIME_NSEC(S) ((S)->st_mtimespec.tv_nsec) -#elif defined(_WIN32) || !defined(AT_SYMLINK_NOFOLLOW) -#define HAVE_UTIMENSAT 0 #else -#define HAVE_UTIMENSAT 1 #define ATIME_NSEC(S) ((S)->st_atim.tv_nsec) #define MTIME_NSEC(S) ((S)->st_mtim.tv_nsec) #endif +#else +#define HAVE_UTIMENSAT 0 +#endif typedef enum { COMMAND_COMPRESS, ```
Author
Owner

@eustas commented on GitHub (Aug 23, 2023):

Hmmm, interesting. CI is happy: https://github.com/google/brotli/actions/runs/5927009396/job/16069573052#step:4:134

@eustas commented on GitHub (Aug 23, 2023): Hmmm, interesting. CI is happy: https://github.com/google/brotli/actions/runs/5927009396/job/16069573052#step:4:134
Author
Owner

@eustas commented on GitHub (Aug 23, 2023):

Thanks for your investigation. Unfortunately, "_ATFILE_SOURCE" seems to be specific to glibc. Investigating further.

@eustas commented on GitHub (Aug 23, 2023): Thanks for your investigation. Unfortunately, "_ATFILE_SOURCE" seems to be specific to glibc. Investigating further.
Author
Owner

@eustas commented on GitHub (Aug 23, 2023):

Hi, could you check that https://github.com/google/brotli/pull/1067 works for you?

@eustas commented on GitHub (Aug 23, 2023): Hi, could you check that https://github.com/google/brotli/pull/1067 works for you?
Author
Owner

@debohman commented on GitHub (Aug 23, 2023):

Yes, you are right about _ATFILE_SOURCE.

Unfortunately, #1067 does not work. The basis of this problem is that utimensat() does not exist, so we need to test for that. Perhaps a config file can be generated by cmake?

@debohman commented on GitHub (Aug 23, 2023): Yes, you are right about `_ATFILE_SOURCE`. Unfortunately, #1067 does not work. The basis of this problem is that `utimensat()` does not exist, so we need to test for that. Perhaps a config file can be generated by cmake?
Author
Owner

@eustas commented on GitHub (Aug 24, 2023):

How about new revision? It is closer to your proposal.

@eustas commented on GitHub (Aug 24, 2023): How about new revision? It is closer to your proposal.
Author
Owner

@debohman commented on GitHub (Aug 24, 2023):

Yes, that works fine for me.

@debohman commented on GitHub (Aug 24, 2023): Yes, that works fine for me.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#476