Re: tools-windows-msvc runtime error

Frederik Seiffert <[email protected]> Tue, 18 Jul 2023 09:34:08 +0200
Newsgroups gmane.comp.lib.gnustep.devel,gmane.comp.lib.gnustep.bugs,gmane.comp.lib.gnustep.general
Message-ID <[email protected]>
--Apple-Mail=_B2F058B4-4660-432E-9687-2E398952F272
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Thanks, I reproduced the issue here. It turns out using the Microsoft =
linker causes this issue, but using LLD works fine. I=E2=80=99m not sure =
why or since when this is, as using link.exe definitely worked for me at =
one point, but now using either VS 2019 or 2022 causes this crash as =
soon as objc_msgSend() is called. Maybe David has an idea what could be =
going on here?

Anyway, passing -fuse-ld=3Dlld should get you going. I would also add =
/Z7 to produce debug symbols as well:

clang-cl -I C:\GNUstep\x64\Debug\include -fobjc-runtime=3Dgnustep-2.0 =
-Xclang -fexceptions -Xclang -fobjc-exceptions -fblocks -DGNUSTEP =
-DGNUSTEP_WITH_DLL -DGNUSTEP_RUNTIME=3D1 -D_NONFRAGILE_ABI=3D1 =
-D_NATIVE_OBJC_EXCEPTIONS -DGSWARN -DGSDIAGNOSE /MDd /Z7 /c test.m

clang-cl test.obj gnustep-base.lib objc.lib dispatch.lib -fuse-ld=3Dlld =
/MDd /Z7 -o test.exe /link /LIBPATH:C:\GNUstep\x64\Debug\lib

I=E2=80=99ve updated the toolchain readme to add this flag in the =
example.

Hope that helps.
Frederik


> Am 18.07.2023 um 03:00 schrieb loserist <[email protected]>:
>=20
> Sure! The following is it:
>=20
> * thread #1, stop reason =3D Exception 0xc0000005 encountered at =
address 0x7ffcec4e1048: Access violation reading locatio
> n 0x00000000
> * frame #0: 0x00007ffcec4e1048 objc.dll`objc_msgSend + 40
> frame #1: 0x00007ff645cc1154 abc.exe
> frame #2: 0x00007ff645cc142c abc.exe
> frame #3: 0x00007ffcfb967614 kernel32.dll`BaseThreadInitThunk + 20
> frame #4: 0x00007ffcfc1826b1 ntdll.dll`RtlUserThreadStart + 33
> Thanks!


--Apple-Mail=_B2F058B4-4660-432E-9687-2E398952F272
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;"><div>Thanks, I =
reproduced the issue here. It turns out using the Microsoft linker =
causes this issue, but using LLD works fine. I=E2=80=99m not sure why or =
since when this is, as using link.exe definitely worked for me at one =
point, but now using either VS 2019 or 2022 causes this crash as soon as =
objc_msgSend() is called. Maybe David has an idea what could be going on =
here?</div><div><br></div><div>Anyway, passing -fuse-ld=3Dlld should get =
you going. I would also add /Z7 to produce debug symbols as =
well:</div><div><br></div><div>clang-cl -I C:\GNUstep\x64\Debug\include =
-fobjc-runtime=3Dgnustep-2.0 -Xclang -fexceptions -Xclang =
-fobjc-exceptions -fblocks -DGNUSTEP -DGNUSTEP_WITH_DLL =
-DGNUSTEP_RUNTIME=3D1 -D_NONFRAGILE_ABI=3D1 -D_NATIVE_OBJC_EXCEPTIONS =
-DGSWARN -DGSDIAGNOSE /MDd /Z7 /c =
test.m</div><div><br></div><div>clang-cl test.obj gnustep-base.lib =
objc.lib dispatch.lib -fuse-ld=3Dlld /MDd /Z7 -o test.exe /link =
/LIBPATH:C:\GNUstep\x64\Debug\lib</div><div><br></div><div>I=E2=80=99ve =
updated the toolchain readme to add this flag in the =
example.</div><div><br></div><div>Hope that =
helps.</div><div>Frederik</div><div><br></div><div><br><blockquote =
type=3D"cite"><div>Am 18.07.2023 um 03:00 schrieb loserist =
&lt;[email protected]&gt;:</div><br =
class=3D"Apple-interchange-newline"><div><div style=3D"margin: =
0px;">Sure! The following is it:</div><div style=3D"margin: 0px;"><br>* =
thread #1, stop reason =3D <span style=3D"color: #FF0001">Exception =
0xc0000005 encountered at address 0x7ffcec4e1048: Access violation =
reading locatio</span></div><div style=3D"margin: 0px;"><span =
style=3D"color: #FF0001">n 0x00000000</span></div><div style=3D"margin: =
0px;">  * frame #0: <span style=3D"color: =
#FFBF02">0x00007ffcec4e1048</span> objc.dll`objc_msgSend + 40</div><div =
style=3D"margin: 0px;">    frame #1: <span style=3D"color: =
#FFBF02">0x00007ff645cc1154</span> abc.exe</div><div style=3D"margin: =
0px;">    frame #2: <span style=3D"color: =
#FFBF02">0x00007ff645cc142c</span> abc.exe</div><div style=3D"margin: =
0px;">    frame #3: <span style=3D"color: =
#FFBF02">0x00007ffcfb967614</span> kernel32.dll`BaseThreadInitThunk + =
20</div><div style=3D"margin: 0px;">    frame #4: <span style=3D"color: =
#FFBF02">0x00007ffcfc1826b1</span> ntdll.dll`RtlUserThreadStart + =
33<br></div><div style=3D"margin: =
0px;">Thanks!</div></div></blockquote></div><br></body></html>=

--Apple-Mail=_B2F058B4-4660-432E-9687-2E398952F272--