|
From: | Frederik Seiffert |
Subject: | Re: GNUstep on Windows using Clang + MSVC ABI |
Date: | Mon, 1 Feb 2021 19:24:29 +0100 |
Sorry everyone, looks like my earlier draft got sent out prematurely...
Yeah, hopefully this change will resolve these issues once and for all. That being said, Richard raised one *potential* issue with this change on GitHub, which is that it increases the length of the command that the linker is being called with, as now all subproject object files are passed directly to the linker. Hopefully OS command line limits are large enough these days so that this won’t be an issue in practice, but I’d still encourage everyone to try building their projects with the "clang-msvc-support" branch of tools-make.
Thanks, good to know!
I briefly tried building in WSL today, and the main difference to using an MSYS2 shell is that Autoconf will consider it cross-compiling. This means that some config checks will not be run (because Autoconf will think that it can’t run the binaries), and we would need to provide a cross.config file with pre-determined results of these config files instead (just like when cross-compiling e.g. for Android). This is obviously more fragile. But this kind of illustrates what I consider the biggest challenge with this setup: the need to install and jump between different shells in order to build the whole system (i.e. CMD for libobjc2, libdispatch, and probably others; Bash/MSYS2 for GNUstep). I’m not sure if there’s an elegant solution to this. My current line of thinking is to create a project like tools-android (tools-windows?) with Batch + Bash scripts to build all dependencies and GNUstep in their respective environments.
I did: I tried using the MS linker (link.exe), but while that seems to generally work fine linking ObjC files, it throws up at some configure tests (specifically when testing "whether objc really works"). Using LLD works though, so one must run Make configure with LDFLAGS="-fuse-ld=lld". This is reproducible simply by compiling config/config.objc.m from libs-base: $ clang -o conftest.exe config/config.objc.m -I/c/GNUstep/x64/include -L/c/GNUstep/x64/lib -fobjc-runtime=gnustep-2.0 -lobjc LINK : conftest.exe not found or not built by the last incremental link; performing full link conftest-b38f3b.o : warning LNK4078: multiple '.CRT' sections found with different attributes (40400040) libcmt.lib(initializers.obj) : warning LNK4254: section '.CRT' (C0000040) merged into '.rdata' (40000040) with different attributes $ ./conftest.exe Segmentation fault $ lldb conftest.exe (lldb) r Process 165928 stopped * thread #1, stop reason = Exception 0xc0000005 encountered at address 0x7ffce04d1048: Access violation reading location 0x00000000 frame #0: 0x00007ffce04d1048 objc.dll`objc_msgSend + 40 objc.dll`objc_msgSend: -> 0x7ffce04d1048 <+40>: movl (%r10), %r11d 0x7ffce04d104b <+43>: cmpl $0x8, %r11d 0x7ffce04d104f <+47>: je 0x7ffce04d1063 ; <+67> 0x7ffce04d1051 <+49>: cmpl $0x0, %r11d Let me know if I should open an issue for this somewhere, or if there’s something in config.objc.m that we should change to fix this.
That’d be nice! I would personally be completely open to using C++ in GNUstep, and that sounds to me like a much better solution than implementing NSThread and NSLock with native Windows APIs, although that’s of course also an option. I’d appreciate any thoughts on this from others what they think about C++ in GNUstep to replace specific APIs like pthreads? I guess this could be guarded with a config check so that a pure-C version would still be available using pthreads.
Agreed. I’ll give it a go.
Yeah I tried with -fgnuc-version=xxx, but then Windows headers didn’t work.
Indeed. My plan is to link against debug libraries when building with "make debug=yes".
Should I open an LLVM issue for this?
Thank you, glad you like it! This is also exciting to us because it should e.g. allow us to use recent Windows technologies like the C++/WinRT language projection from ObjC++ which are not compatible with MinGW. That being said, I would still very much like to get libobjc2 working with MinGW as well, as it would allow people currently using GNUstep with GCC in a MinGW environment to switch to Clang/libobjc2, should result in a more streamlined setup experience with all dependencies being available via MinGW packages and everything being built in one shell, and allow for existing MinGW-based software to be used. I’ll try to get you those instructions for building LLVM with the MinGW patches in the next couple weeks.
That looks really great! Would be interesting to see some performance stats of this for ObjC specifically if you have that. Frederik |
[Prev in Thread] | Current Thread | [Next in Thread] |