p7zip-17.05 Gentoo Linux compile fails with clang 16.0.1 libcxx
From: [Bug 901467] app-arch/p7zip-17.05: Fails to compile with libcxx https://bugs.gentoo.org/show_bug.cgi?id=901467
The clang 16.0.1 libcxx compiler error is:
In file included from ../../../../CPP/Common/Md5Reg.cpp:8:
In file included from ../../../../CPP/Common/../../C/hashes/md5.h:40:
../../../../CPP/Common/../../C/hashes/hash.h:51:16: error: typedef redefinition with different types ('UInt64' (aka 'unsigned long long') vs '__uint64_t' (aka 'unsigned long'))
typedef UInt64 uint64_t;
^
/usr/include/bits/stdint-uintn.h:27:20: note: previous definition is here
typedef __uint64_t uint64_t;
^
1 error generated.
It compiles successfully with clang 16.0.1 libcxx and with gcc 12.2.1_p20230304 p13 with this patch (by me):
--- p7zip-17.05-orig/C/hashes/hash.h 2023-03-03 23:16:28.000000000 +1100
+++ p7zip-17.05/C/hashes/hash.h 2023-04-15 09:05:20.357955971 +1000
@@ -42,17 +42,7 @@
#include "../7zTypes.h"
-#ifndef _UINT32_T_DECLARED
-typedef UInt32 uint32_t;
-#define _UINT32_T_DECLARED
-#endif
-
-#ifndef _UINT64_T_DECLARED
-typedef UInt64 uint64_t;
-#define _UINT64_T_DECLARED
-#endif
-
-//#include <stdint.h>
+#include <stdint.h>
#ifndef min
#define min(a,b) (((a)>(b))?(b):(a))
I can submit a pull request if you like.
I used the same patch on the OpenHarmony system. It works very well. You should submit a PR to fix this error.
-#ifndef _UINT64_T_DECLARED -typedef UInt64 uint64_t; -#define _UINT64_T_DECLARED -#endif
I can submit a pull request if you like.
What makes you think that undefining it will help to compile it? UInt64 is non-standard definition. I for example don't have it in /usr/include/stdint.h and if would remove it from 7zTypes.h I wouldn't be able to compile it. Ask Clang team why did they add it to standard header.