Opened 9 years ago

Closed 8 years ago

Last modified 10 months ago

#3138 closed defect (fixed)

[PATCH] SDL 2.0.4 devel version breaks Windows build

Reported by: historic_bruno Owned by: historic_bruno
Priority: Should Have Milestone: Alpha 20
Component: Core engine Keywords: patch
Cc: Patch:

Description

I tested the latest SDL 2.0.4 dev copy from Hg, and there are various Windows build errors related to the main() function. For one thing, we no longer need to define a wmain() function to convert cl arguments to UTF-8, SDL2 does that. Then, the test suite is broken:

1>------ Build started: Project: test, Configuration: Release Win32 ------
1>  test_root.cpp
1>SDL2main.lib(SDL_windows_main.obj) : error LNK2005: _main already defined in test_root.obj
1>     Creating library ..\..\..\binaries\system\test.lib and object ..\..\..\binaries\system\test.exp
1>SDL2main.lib(SDL_windows_main.obj) : error LNK2019: unresolved external symbol _SDL_main referenced in function _main_utf8
1>..\..\..\binaries\system\test.exe : fatal error LNK1120: 1 unresolved externals

I was able to fix this by manually adding #include "lib/external_libraries/libsdl.h" to test_root.cpp, but I don't know how that file is generated or if this might break older SDL versions.

Attachments (2)

wseh.cpp.patch (1.0 KB ) - added by historic_bruno 9 years ago.
sdl2.0.4-win-fixes.patch (2.4 KB ) - added by historic_bruno 9 years ago.

Download all attachments as: .zip

Change History (12)

by historic_bruno, 9 years ago

Attachment: wseh.cpp.patch added

by historic_bruno, 9 years ago

Attachment: sdl2.0.4-win-fixes.patch added

comment:1 by historic_bruno, 9 years ago

leper pointed me in the right direction for the tests error, I needed to add an include in premake4.lua. The new patch has a little more cleanup for wseh.cpp.

comment:2 by leper, 9 years ago

I guess we could also remove the MAIN_STARTUP define now (I really think we should just rip ICC related code out since it hasn't been tested in years and likely is broken, but that would be another ticket). Apart from that the patch looks good.

comment:3 by historic_bruno, 9 years ago

Cc: Yves leper removed
Keywords: review removed
Owner: set to historic_bruno
Status: newassigned

comment:4 by Itms, 9 years ago

We should get that in ASAP if we want to avoid pushing it to A20.

comment:5 by historic_bruno, 9 years ago

Note this isn't needed unless we update to SDL 2.0.4 (currently RC), so we can push it to A20 if that doesn't happen.

comment:6 by Itms, 9 years ago

Milestone: Alpha 19Alpha 20

comment:8 by ben, 8 years ago

Resolution: fixed
Status: assignedclosed

In 17658:

Updates precompiled win32 SDL libs to 2.0.4 from libsdl.org.
Fixes windows build with SDL 2.0.4, fixes #3138, #3225

comment:9 by elexis, 8 years ago

r17658 introduced a bug for hotkeys, see #3870.

comment:10 by Vladislav Belov, 10 months ago

In 27764:

Fixes linking failure solution introduced in rP17658 for SDL dependency.

Refs #3138

Accepted By: Itms

Differential Revision: https://code.wildfiregames.com/D5065

Note: See TracTickets for help on using tickets.