Previous Thread
Next Thread
Print Thread
Joined: May 1999
Posts: 619
Likes: 1
Senior Member
Senior Member
Joined: May 1999
Posts: 619
Likes: 1
Did anybody else get the following error?

In file included from ../../../../../3rdparty/zlib/deflate.h:16:
../../../../../3rdparty/zlib/zutil.h:170:11: error: 'OS_CODE' macro redefined [-Werror,-Wmacro-redefined]
170 | # define OS_CODE 19
| ^
../../../../../3rdparty/zlib/zutil.h:141:11: note: previous definition is here
141 | # define OS_CODE 7
| ^
make[2]: *** [../../../../osx_clang/obj/x64/Release/3rdparty/zlib/crc32.o] Error 1
Compiling 3rdparty/flac/src/libFLAC/cpu.c...
1 error generated.


Compiles fine on my AS mac mini.

Joined: Mar 2001
Posts: 17,261
Likes: 267
R
Very Senior Member
Very Senior Member
R Online: Content
Joined: Mar 2001
Posts: 17,261
Likes: 267
Checking the diff on that file it's an upstream change, but one that was made in January 2024. You can // out that line 141 and it should be fine, but I don't get why it's necessary.

Joined: Sep 2000
Posts: 258
W
Senior Member
Senior Member
W Offline
Joined: Sep 2000
Posts: 258
Looks like with the macOS update 15.4, we also get a new version of clang;

Prev: Apple clang version 16.0.0 (clang-1600.0.26.6) - compiles fine
New: Apple clang version 17.0.0 (clang-1700.0.13.3) - fails with the same error above.

Tried commenting that line and it still fails compiling :

Code
Clang 17.0.0 detected
Compiling 3rdparty/zlib/zutil.c...
In file included from ../../../../../3rdparty/zlib/zutil.c:10:
In file included from ../../../../../3rdparty/zlib/gzguts.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:61:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected identifier or '('
  318 | FILE    *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
      |          ^
In file included from ../../../../../3rdparty/zlib/zutil.c:8:
../../../../../3rdparty/zlib/zutil.h:147:33: note: expanded from macro 'fdopen'
  147 | #        define fdopen(fd,mode) NULL /* No fdopen() */
      |                                 ^
In file included from ../../../../../3rdparty/zlib/zutil.c:8:
In file included from ../../../../../3rdparty/zlib/zutil.h:22:
In file included from ../../../../../3rdparty/zlib/zlib.h:34:
In file included from ../../../../../3rdparty/zlib/zconf.h:254:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/17/include/stddef.h:113:
/Library/Developer/CommandLineTools/usr/lib/clang/17/include/__stddef_null.h:26:16: note: expanded from macro 'NULL'
   26 | #define NULL ((void*)0)
      |                ^
In file included from ../../../../../3rdparty/zlib/zutil.c:10:
In file included from ../../../../../3rdparty/zlib/gzguts.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:61:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected ')'
In file included from ../../../../../3rdparty/zlib/zutil.c:8:
../../../../../3rdparty/zlib/zutil.h:147:33: note: expanded from macro 'fdopen'
  147 | #        define fdopen(fd,mode) NULL /* No fdopen() */
      |                                 ^
In file included from ../../../../../3rdparty/zlib/zutil.c:8:
In file included from ../../../../../3rdparty/zlib/zutil.h:22:
In file included from ../../../../../3rdparty/zlib/zlib.h:34:
In file included from ../../../../../3rdparty/zlib/zconf.h:254:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/17/include/stddef.h:113:
/Library/Developer/CommandLineTools/usr/lib/clang/17/include/__stddef_null.h:26:16: note: expanded from macro 'NULL'
   26 | #define NULL ((void*)0)
      |                ^
In file included from ../../../../../3rdparty/zlib/zutil.c:10:
In file included from ../../../../../3rdparty/zlib/gzguts.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:61:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: note: to match this '('
In file included from ../../../../../3rdparty/zlib/zutil.c:8:
../../../../../3rdparty/zlib/zutil.h:147:33: note: expanded from macro 'fdopen'
  147 | #        define fdopen(fd,mode) NULL /* No fdopen() */
      |                                 ^
In file included from ../../../../../3rdparty/zlib/zutil.c:8:
In file included from ../../../../../3rdparty/zlib/zutil.h:22:
In file included from ../../../../../3rdparty/zlib/zlib.h:34:
In file included from ../../../../../3rdparty/zlib/zconf.h:254:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/17/include/stddef.h:113:
/Library/Developer/CommandLineTools/usr/lib/clang/17/include/__stddef_null.h:26:15: note: expanded from macro 'NULL'
   26 | #define NULL ((void*)0)
      |               ^
In file included from ../../../../../3rdparty/zlib/zutil.c:10:
In file included from ../../../../../3rdparty/zlib/gzguts.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:61:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: error: expected ')'
  318 | FILE    *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
      |          ^
In file included from ../../../../../3rdparty/zlib/zutil.c:8:
../../../../../3rdparty/zlib/zutil.h:147:33: note: expanded from macro 'fdopen'
  147 | #        define fdopen(fd,mode) NULL /* No fdopen() */
      |                                 ^
In file included from ../../../../../3rdparty/zlib/zutil.c:8:
In file included from ../../../../../3rdparty/zlib/zutil.h:22:
In file included from ../../../../../3rdparty/zlib/zlib.h:34:
In file included from ../../../../../3rdparty/zlib/zconf.h:254:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/17/include/stddef.h:113:
/Library/Developer/CommandLineTools/usr/lib/clang/17/include/__stddef_null.h:26:22: note: expanded from macro 'NULL'
   26 | #define NULL ((void*)0)
      |                      ^
In file included from ../../../../../3rdparty/zlib/zutil.c:10:
In file included from ../../../../../3rdparty/zlib/gzguts.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:61:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:318:7: note: to match this '('
In file included from ../../../../../3rdparty/zlib/zutil.c:8:
../../../../../3rdparty/zlib/zutil.h:147:33: note: expanded from macro 'fdopen'
  147 | #        define fdopen(fd,mode) NULL /* No fdopen() */
      |                                 ^
In file included from ../../../../../3rdparty/zlib/zutil.c:8:
In file included from ../../../../../3rdparty/zlib/zutil.h:22:
In file included from ../../../../../3rdparty/zlib/zlib.h:34:
In file included from ../../../../../3rdparty/zlib/zconf.h:254:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/17/include/stddef.h:113:
/Library/Developer/CommandLineTools/usr/lib/clang/17/include/__stddef_null.h:26:14: note: expanded from macro 'NULL'
   26 | #define NULL ((void*)0)
      |              ^
3 errors generated.
make[2]: *** [../../../../osx_clang/obj/x64/Release/3rdparty/zlib/zutil.o] Error 1
make[1]: *** [zlib] Error 2
make: *** [macosx_arm64_clang] Error 2


=will=
Joined: Sep 2000
Posts: 258
W
Senior Member
Senior Member
W Offline
Joined: Sep 2000
Posts: 258
BTW, I'm on Apple Silicon (ARM) not Intel but it looks like the same issue.


=will=
Joined: Mar 2001
Posts: 17,261
Likes: 267
R
Very Senior Member
Very Senior Member
R Online: Content
Joined: Mar 2001
Posts: 17,261
Likes: 267
Weird. I just updated to 15.4 and clang 17.0.0 but MAME top-of-tree built fine from clean (I'm on Apple Silicon).

The 0.276 release doesn't have the new zlib update, are you guys building the release version or a Github pull?

Last edited by R. Belmont; 04/02/25 02:55 AM.
Joined: May 1999
Posts: 619
Likes: 1
Senior Member
Senior Member
Joined: May 1999
Posts: 619
Likes: 1
I'm using release.

Joined: Mar 2001
Posts: 17,261
Likes: 267
R
Very Senior Member
Very Senior Member
R Online: Content
Joined: Mar 2001
Posts: 17,261
Likes: 267
Ok. I'll check if there are any easy fixes for release, but I think 15.4 is probably going to end up requiring 0.277.

Joined: Feb 2004
Posts: 2,628
Likes: 339
Very Senior Member
Very Senior Member
Joined: Feb 2004
Posts: 2,628
Likes: 339
I just looked at 3rdparty/zlib/zutil.h and I don’t see # define fdopen(fd,mode) NULL /* No fdopen() */. It looks like that was removed in zlib 1.3.1 which holub imported in #13505. You may well be able to just patch that part of zutil.h:
Code
diff --git a/3rdparty/zlib/zutil.h b/3rdparty/zlib/zutil.h
index 902a304cc2d..48dd7febae6 100644
--- a/3rdparty/zlib/zutil.h
+++ b/3rdparty/zlib/zutil.h
@@ -137,17 +137,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
 #  endif
 #endif
 
-#if defined(MACOS) || defined(TARGET_OS_MAC)
+#if defined(MACOS)
 #  define OS_CODE  7
-#  ifndef Z_SOLO
-#    if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
-#      include <unix.h> /* for fdopen */
-#    else
-#      ifndef fdopen
-#        define fdopen(fd,mode) NULL /* No fdopen() */
-#      endif
-#    endif
-#  endif
 #endif
 
 #ifdef __acorn

Joined: May 1999
Posts: 619
Likes: 1
Senior Member
Senior Member
Joined: May 1999
Posts: 619
Likes: 1
MAME 0.276 compiles fine with that patch on Intel macOS, too, now. Thanks.

Joined: Sep 2000
Posts: 258
W
Senior Member
Senior Member
W Offline
Joined: Sep 2000
Posts: 258
Ditto, thanks!


=will=

Moderated by  R. Belmont 

Link Copied to Clipboard
Who's Online Now
1 members (1 invisible), 146 guests, and 3 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,363
Posts122,479
Members5,082
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Powered by UBB.threads™ PHP Forum Software 8.0.0