Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p7zip-17.05 Gentoo Linux compile fails with clang 16.0.1 libcxx #222

Open
markwright opened this issue Apr 15, 2023 · 2 comments
Open

p7zip-17.05 Gentoo Linux compile fails with clang 16.0.1 libcxx #222

markwright opened this issue Apr 15, 2023 · 2 comments

Comments

@markwright
Copy link

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.

@jinfeihan57
Copy link
Contributor

I used the same patch on the OpenHarmony system. It works very well. You should submit a PR to fix this error.

@tansy
Copy link
Contributor

tansy commented Sep 14, 2023

-#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants