http://bugs.winehq.org/show_bug.cgi?id=58580
Bug ID: 58580 Summary: macOS clang: -msabi=ms unrecognized option... causes x86_64-unix/*.a files to be missing. Cannot winegcc cannot link agains libadvapi32 et al Product: Wine Version: 10.0 Hardware: x86-64 OS: MacOS Status: UNCONFIRMED Severity: normal Priority: P2 Component: winelib Assignee: wine-bugs@winehq.org Reporter: matteo.ceruti@gmail.com
Created attachment 79102 --> http://bugs.winehq.org/attachment.cgi?id=79102 the patch for the configure-script that works for me
I had first reported this to macports but I think you should have a look at it https://trac.macports.org/ticket/72792
Expected Behavior: I like to continue to use winegcc and wineg++ on macOS x86_64 to compile winelibs. In fact it worked with wine 9.0.
Actual Behavior: winegcc says it cannot link against advapi32 and others and infact the files such as libadvapi32.a are not in lib/x86_64-unix/ anymore.
I think this might be the case since this change:
https://github.com/wine-mirror/wine/commit/84d8a24af71d#diff-49473dca262eeab... "Disable non-PE import libraries if compiler support is missing."
The -mabi-ms check is now done even if $PE_ARCHS exist which in my understanding means we're crosscompiling PE code. The macport compiles with clang and uses minGW to compile the PE code. But clang does not recognize and no longer ignores the -mabi=ms option and in that case the configure-script now sets DLLEXT from its initial value ".so" to "" which seems to cause the *.a archive files to not being created/installed.
I've patched the configure-script so that DLLEXT is only set to "" in case $PE_ARCHS is empty analogous to the fact that in that -mabi=ms not being recognized is not reported as an error.
And I can create winelibs .exe.so and .dll.so just fine and load them from a client *.exe.
I'd like to still use winegcc and wineg++ and the winelib feature on macOS. Is this no longer possible? I guess linux using clang might experience the same.
This is my the patch that works for me on wine 10.12 (It's also attached):
https://github.com/matatata/macports-ports/blob/ff459f21995e6b6fceeacd51cea9...
I'd appreaciate if you could take a look and clarify.
http://bugs.winehq.org/show_bug.cgi?id=58580
Matteo Ceruti matteo.ceruti@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|macOS clang: -msabi=ms |macOS clang: -msabi=ms |unrecognized option... |unrecognized option... |causes x86_64-unix/*.a |causes x86_64-unix/*.a |files to be missing. Cannot |files to be missing. |winegcc cannot link agains |winegcc cannot link against |libadvapi32 et al |libadvapi32 et al
http://bugs.winehq.org/show_bug.cgi?id=58580
--- Comment #1 from Matteo Ceruti matteo.ceruti@gmail.com --- I just made another obeserfation, which might or might not be related to all the above:
A executable that calls into such a winelib .dll.so crashes when run by wine 10.12 whereas wine 10.0 wine 9.0 and crossover 24.0.1 (based on wine 10 I believe) run the code just fine. I can outline what I'm actually doing if interested, but basically I'm creating a winelib dll.so and a matching fake *.dll that a .exe dxnamically links against and when I replace the fake dll by the dll.so then it executes native code and I can call into macOS APIs. I basically followed the WineLib Guide. So to recap: The first problem was that I no longer were able to use wingcc due to missing .a files. Now I see those crashes (and only in) wine 10.12. I am going to provide code that'll allow to reproduce all that, but I think that's going to be another Bug report.
http://bugs.winehq.org/show_bug.cgi?id=58580
--- Comment #2 from Alexandre Julliard julliard@winehq.org --- Building with Unix clang on x86-64 is not supported, because without -mabi=ms the ABIs are not compatible. It will work for simple things but it will break eventually, for instance when using varargs functions.
On macOS there is now the further problem that we need to switch the %gs register between PE and Unix code, which means that Winelib dlls can't be supported anymore. You'll need to use the new Unix call interface.
http://bugs.winehq.org/show_bug.cgi?id=58580
--- Comment #3 from Matteo Ceruti matteo.ceruti@gmail.com --- Thank you Alexandre for the explanation. I took a look at the unix call interface you were directing me too and I'm happy to report that although it took me some time I think I made it work. I successfully created a *.so file and a corresponding wrapper dll (built as 'builtin'). I was able to call into the dll from a client.exe and the wrapper dll then actually called into unix library once I had put dll and .so file into wine/lib/x86_64-unix and x86_64-windows respectively.
Here's my toy repo https://github.com/matatata/wine_unix_lib_example
So this Bug report can be closed I'd say.
Best regards.
http://bugs.winehq.org/show_bug.cgi?id=58580
Zeb Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |z.figura12@gmail.com Resolution|--- |WONTFIX Summary|macOS clang: -msabi=ms |Hybrid winelib DLLs cannot |unrecognized option... |be compiled on macOS |causes x86_64-unix/*.a |anymore |files to be missing. | |winegcc cannot link against | |libadvapi32 et al | Status|UNCONFIRMED |RESOLVED
--- Comment #4 from Zeb Figura z.figura12@gmail.com --- Closing WONTFIX.