We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3399 - Errors cross-compiling Lubuntu 16.04 -> Windows
Summary: Errors cross-compiling Lubuntu 16.04 -> Windows
Status: RESOLVED DUPLICATE of bug 3336
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86 Windows (All)
: P2 critical
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-27 14:15 UTC by Rainer Deyke
Modified: 2016-10-01 17:29 UTC (History)
1 user (show)

See Also:


Attachments
patch fixing both errors (21.42 KB, patch)
2016-07-27 14:15 UTC, Rainer Deyke
Details | Diff
build log showing the error messages (66.15 KB, text/plain)
2016-07-27 14:17 UTC, Rainer Deyke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Deyke 2016-07-27 14:15:19 UTC
Created attachment 2533 [details]
patch fixing both errors

I'm unable to cross-compile SDL2, neither 2.0.4 nor the latest hg, under amd64 Lubuntu 16.04.  My compiler is i686-w64-mingw32-gcc (GCC) 5.3.1 20160211.  I suspect that this problem affects all gcc 5.x builds of mingw on all platforms, although I haven't tested any others.

There are two errors.  The first is that SDL defines static versions of IID_IDXGIFactory2 and co, which conflicts with the non-static versions of the same GUIDs, as declared in the Direct3D11 header files.  The other is that SDL uses the pattern __FUNCTION__ ", text here" to generate string literals containing the function name, which doesn't work because __FUNCTION__ is a variable, not a preprocessor token.

I have attached a patch that fixes both errors.
Comment 1 Rainer Deyke 2016-07-27 14:17:01 UTC
Created attachment 2534 [details]
build log showing the error messages
Comment 2 Kai Sterker 2016-09-12 17:48:58 UTC
The attached patch is slightly wrong.

The new method with two char* arguments is invoked as WIN_SetErrorfromHRESULT,
but declared/defined as WIN_SetErrorFromHRESULT2, which means it does not compile without changing one or the other. Also, gcc spits a warning about passing const char* "" as non-const in the call.

In general, this patch does look much nicer than the external patches linked here https://bugzilla.libsdl.org/show_bug.cgi?id=3336#c2

Would really love to see this issue fixed in time for SDL 2.0.5. Cross-compiling or resorting to Mingw64 on Windows seems quite common practice when primarily developing for Linux.
Comment 3 Sam Lantinga 2016-10-01 17:29:53 UTC
This is fixed in https://hg.libsdl.org/SDL/rev/6cf7d55773b3

*** This bug has been marked as a duplicate of bug 3336 ***