-
Notifications
You must be signed in to change notification settings - Fork 561
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
Perl can't be built on x64 platform with gcc12.1 #19824
Comments
Thank you for identifying a fix for this problem. A few things I would like to point out:
The problem we're dealing with doesn't arise with gcc-11 or earlier, so I've written the patch to take effect only if gcc is at version 12 (or later). The only remaining issue for me is that perl crashed 3 or 4 times during the running of You haven't mentioned any other patches to the perl source that you used. I notice from your
|
|
I'm certainly agreeable to:
It doesn't seem to be needed with the 32-bit mingw-w64 ports of gcc-12.1.0 so we could also write it as:
but if there's a chance that it might be needed in future with 32-bit builds, then I'd be happy to exclude the "64 bit" requirement. Also, it sounds fair enough to me that we include the safeguard for _MSC_VER if there's a chance that an MS compiler might need it. Do you have a link that explains what My current proposal on how to deal with the Socket.xs problem can be seen in my most recent post at: If you have any comments on that, now would be a good time to make them. |
define POLL_H-#if (defined(HAS_POLL) && defined(I_POLL)) || defined(POLLWRBAND) include <poll.h>#elif (defined(HAS_POLL) && defined(I_SYS_POLL)) include <sys/poll.h>--- cpan/Socket/Socket.xs.orig Sun Apr 24 23:29:00 2022 #endif -static int inet_pton(int af, const char *src, void *dst) -static const char *inet_ntop(int af, const void *src, char *dst, socklen_t size) void
void
|
See https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
|
|
Thanks for the info about -Os. (The docs that I kept googling up mentioned only -O0, -O1, -O2 and -O3.) |
In testing today's release of 5.37.1, I've tried to get a better handle on what works and what doesn't when building with gcc-12.1.0, runtime version 10.
Either of those 3 changes will allow the test suite to complete without failure. The crashing that otherwise occurs during the test suite, seems to occur only in certain test scripts, and at random points within those scripts. |
The test suite crashes occur in test files that don't use Test::More. t/win32/popen.t is the only one of those files that registers a FAIL as a result of the crash. I think that fixing this will turn out to be beyond my capabilities, but I'll keep poking at it from time to time, and report anything that might be useful. |
@yjh-styx I think that a PR with the fix to win32/vmem.h should be presented now. We've already established that there's a bit more to it than just amending win32/vmem.h, but those additional points (namely optimization level and whether we want debugging or unthreaded or threaded) can already be handled via configuration directives, without any need to make additional amendments to the perl source. @yjh-styx would you like to prepare that PR ?
Cheers, |
Although the merging of #19912 allows a usable perl to be built, it doesn't fix the additional problem with optimization level -O2 on multi-thread Windows perls that are built using gcc-12. Cheers, |
Could you please make a new issue for the other problems? Thanks |
The other issue has now been raised at #20024 . Cheers, |
Add comment & refer to Perl#19824
This is a bug report for perl
generated with the help of perlbug 1.42 running under perl 5.36.0.
[Please describe your issue here]
when build with gcc 12.1 with option -O2 perl crash on start )in perl_create) - gcc use 'movaps' for unaligned memory.
If change -O2 to -Os, perl work.
Also work if describe struct MEMORY_BLOCK_HEADER as aligned(16) see patch below
=============file=================
--- perl-5.36.0/lib/CORE/vmem.h.orig Thu Apr 29 17:35:34 2021
+++ perl-5.36.0/lib/CORE/vmem.h Sat Jun 04 18:20:37 2022
@@ -70,11 +70,18 @@
#ifdef _USE_LINKED_LIST
class VMem;
typedef struct _MemoryBlockHeader* PMEMORY_BLOCK_HEADER;
+#ifdef _MSC_VER
+__declspec(align(16))
+#endif
typedef struct _MemoryBlockHeader {
PMEMORY_BLOCK_HEADER pNext;
PMEMORY_BLOCK_HEADER pPrev;
VMem *owner;
-} MEMORY_BLOCK_HEADER, *PMEMORY_BLOCK_HEADER;
+}
+#ifdef GNUC
+attribute((aligned(16)))
+#endif
+MEMORY_BLOCK_HEADER, *PMEMORY_BLOCK_HEADER;
#endif
class VMem
--- perl-5.36.0/win32/vmem.h.orig Thu Apr 29 17:35:34 2021
+++ perl-5.36.0/win32/vmem.h Sat Jun 04 18:19:25 2022
@@ -70,11 +70,18 @@
#ifdef _USE_LINKED_LIST
class VMem;
typedef struct _MemoryBlockHeader* PMEMORY_BLOCK_HEADER;
+#ifdef _MSC_VER
+__declspec(align(16))
+#endif
typedef struct _MemoryBlockHeader {
PMEMORY_BLOCK_HEADER pNext;
PMEMORY_BLOCK_HEADER pPrev;
VMem *owner;
-} MEMORY_BLOCK_HEADER, *PMEMORY_BLOCK_HEADER;
+}
+#ifdef GNUC
+attribute((aligned(16)))
+#endif
+MEMORY_BLOCK_HEADER, *PMEMORY_BLOCK_HEADER;
#endif
class VMem
==============eof================
[Please do not change anything below this line]
Flags:
category=core
severity=high
Site configuration information for perl 5.36.0:
Configured by yjh at Sat Jun 4 18:42:25 2022.
Summary of my perl5 (revision 5 version 36 subversion 0) configuration:
Platform:
osname=MSWin32
osvers=10.0.19044.1741
archname=MSWin32-x64-multi-thread
uname=''
config_args='undef'
hint=recommended
useposix=true
d_sigaction=undef
useithreads=define
usemultiplicity=define
use64bitint=define
use64bitall=undef
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
Compiler:
cc='gcc'
ccflags =' -DWIN32 -DWIN64 -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bitfields'
optimize='-Os'
cppflags='-DWIN32'
ccversion=''
gccversion='12.1.0'
gccosandvers=''
intsize=4
longsize=4
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=16
longdblkind=3
ivtype='long long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='long long'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='g++'
ldflags ='-s -L"C:\Perl64\lib\CORE" -L"E:\mingw64\lib" -L"E:\mingw64\x86_64-w64-mingw32\lib" -L"E:\mingw64\lib\gcc\x86_64-w64-mingw32\12.1.0"'
libpth=E:\mingw64\lib E:\mingw64\x86_64-w64-mingw32\lib E:\mingw64\lib\gcc\x86_64-w64-mingw32\12.1.0
libs=-static -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
perllibs=-static -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
libc=-static
so=dll
useshrplib=true
libperl=libperl536.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs
dlext=dll
d_dlsymun=undef
ccdlflags=' '
cccdlflags=' '
lddlflags='-shared -s -L"C:\Perl64\lib\CORE" -L"E:\mingw64\lib" -L"E:\mingw64\x86_64-w64-mingw32\lib" -L"E:\mingw64\lib\gcc\x86_64-w64-mingw32\12.1.0"'
@inc for perl 5.36.0:
""
N:/PERL/Perl64/site/lib
N:/PERL/Perl64/lib
Environment for perl 5.36.0:
HOME (unset)
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=C:\Perl64\bin;C:\Windows\System32;C:\Windows;E:\mingw64\bin;E:\TOOLSES;D:\BAT;D:\oci\bin
PERL5LIB=""
PERL_BADLANG (unset)
SHELL (unset)
The text was updated successfully, but these errors were encountered: