Re: fork error when trying to call VirtualAlloc with size==0

2025-05-23 Thread Jeremy Drake via Cygwin
On Fri, 23 May 2025, Yuyi Wang wrote: > On Fri, 23 May 2025, Jeremy Drake wrote: > > Maybe. MSYS2 doesn't generally advise to rebase on x86_64, but I think > > Cygwin does as part of its setup/postinstall hooks. As a hack, I was able > > to work around this by setting the "dynamicbase" flag on t

fork error when trying to call VirtualAlloc with size==0

2025-05-23 Thread Yuyi Wang via Cygwin
On Fri, 23 May 2025, Jeremy Drake wrote: > Maybe. MSYS2 doesn't generally advise to rebase on x86_64, but I think > Cygwin does as part of its setup/postinstall hooks. As a hack, I was able > to work around this by setting the "dynamicbase" flag on the dlls (it's a > long story about why this hel

Re: fork error when trying to call VirtualAlloc with size==0

2025-05-23 Thread Jon Turney via Cygwin
On 23/05/2025 02:59, Yuyi Wang via Cygwin wrote: On Wed, 22 May 2025, Jeremy Drake wrote: Ultimately, playing whack-a-mole in a 64-bit address space hoping that the DLL will load in the same place as the parent is an exercise in futility, especially in only 6 attempts. Outside cygwin, rustc al

Re: fork error when trying to call VirtualAlloc with size==0

2025-05-22 Thread Jeremy Drake via Cygwin
On Fri, 23 May 2025, Yuyi Wang wrote: > On Wed, 22 May 2025, Jeremy Drake wrote: > > Ultimately, playing whack-a-mole in a 64-bit address space hoping that the > > DLL will load in the same place as the parent is an exercise in futility, > > especially in only 6 attempts. > > Outside cygwin, rustc

Re: fork error when trying to call VirtualAlloc with size==0

2025-05-22 Thread Yuyi Wang via Cygwin
On Wed, 22 May 2025, Jeremy Drake wrote: > Ultimately, playing whack-a-mole in a 64-bit address space hoping that the > DLL will load in the same place as the parent is an exercise in futility, > especially in only 6 attempts. Outside cygwin, rustc also try 5 times to load the proc macro DLL, so t

Re: fork error when trying to call VirtualAlloc with size==0

2025-05-22 Thread Jeremy Drake via Cygwin
On Wed, 21 May 2025, Jeremy Drake via Cygwin wrote: > On Wed, 21 May 2025, Jeremy Drake via Cygwin wrote: > > > the child to not be very fruitful, but maybe there's some debugging to be > > done there > > Well, found the bug that results in a 0 size. size is a DWORD, but > mb.RegionSize is 0x2000

Re: fork error when trying to call VirtualAlloc with size==0

2025-05-21 Thread Jeremy Drake via Cygwin
On Wed, 21 May 2025, Jeremy Drake via Cygwin wrote: > the child to not be very fruitful, but maybe there's some debugging to be > done there Well, found the bug that results in a 0 size. size is a DWORD, but mb.RegionSize is 0x2. mb.RegionSize is SIZE_T, but I figure size_t is appropria

Re: fork error when trying to call VirtualAlloc with size==0

2025-05-21 Thread Jeremy Drake via Cygwin
On Tue, 20 May 2025, Yuyi Wang wrote: > Thank you for your reply. The DLL is a "proc macro" DLL for rustc, which means > that it's not designed to be changed after created. However, I've also found > that this stage-1 compiler doesn't always trigger this failure: it just > trigger > fork failure

Re: fork error when trying to call VirtualAlloc with size==0

2025-05-19 Thread Yuyi Wang via Cygwin
I tried dlfork(FORK_NO_RELOAD) after dlopen() the proc macro DLLs. Now rustc works as expected. Therefore, I think the problem is most likely caused by too many DLLs loaded. See the PR here: https://github.com/rust-lang/rust/pull/141276 I think dlfork is a good workaround, but not the best. It wou

Re: fork error when trying to call VirtualAlloc with size==0

2025-05-19 Thread Brian Inglis via Cygwin
On 2025-05-19 21:25, Yuyi Wang via Cygwin wrote: Thank you for your reply. The DLL is a "proc macro" DLL for rustc, which means that it's not designed to be changed after created. However, I've also found that this stage-1 compiler doesn't always trigger this failure: it just trigger fork failure

Re: fork error when trying to call VirtualAlloc with size==0

2025-05-19 Thread Yuyi Wang via Cygwin
Thank you for your reply. The DLL is a "proc macro" DLL for rustc, which means that it's not designed to be changed after created. However, I've also found that this stage-1 compiler doesn't always trigger this failure: it just trigger fork failure with compiling relatively large projects. In this

Re: fork error when trying to call VirtualAlloc with size==0

2025-05-19 Thread Jeremy Drake via Cygwin
On Mon, 19 May 2025, Yuyi Wang via Cygwin wrote: > Recently I'm trying to build rustc on Cygwin (actually MSYS2). Here is the > error: > > 0 [main] rustc 3299 child_info_fork::abort: couldn't allocate memory > 0x1FD10(0) for > '\??\D:\Straw\Documents\Git\rust\build\x86_64-pc-cygwin\st

fork error when trying to call VirtualAlloc with size==0

2025-05-19 Thread Yuyi Wang via Cygwin
Recently I'm trying to build rustc on Cygwin (actually MSYS2). Here is the error: 0 [main] rustc 3299 child_info_fork::abort: couldn't allocate memory 0x1FD10(0) for '\??\D:\Straw\Documents\Git\rust\build\x86_64-pc-cygwin\stage1-rustc\release\deps\zerovec_derive-4b870d338ef8cbdd.dll'