![]() |
#11 |
Swordsman
Join Date: Aug 2019
Posts: 350
![]() |
There's a modified version of src/main.c at https://github.com/backwardsEric/ang...ing/src/main.c which avoids the compiler warning about the missing prototype for SDL_main(). I'd be interested to know that the resulting executable from compiling it under MSYS2 starts up as expected on Windows. If it does, it might also be worth checking if there's any impact on https://github.com/angband/angband/issues/5497 (MSYS2 compiled SDL2 front end blanks out after a Windows lock screen) and https://github.com/angband/angband/issues/5512 (MSYS2 compiled SDL2 front end doesn't deal well with display switches).
|
![]() |
![]() |
![]() |
#12 |
Swordsman
Join Date: Oct 2021
Location: WA
Posts: 322
![]() |
It fixes the "missing prototype for SDL_main()" warning. : ) It doesn't fix the screen blanking stuff for MSYS2 or Cygwin/X (Cygwin/X being affected only by 5512), though.
__________________
My Angband videos |
![]() |
![]() |
![]() |
#13 |
Swordsman
Join Date: Oct 2021
Location: WA
Posts: 322
![]() |
Compiling with
$ make -f Makefile.msys2.sdl2 SOUND=yes results in a 22.1 MB angband.exe, whereas the downloadable 4.2.4 Windows front end .exe is only 1.97 MB. Compiling with make -f Makefile.msys2 gets me a I think it was 1.68 MB GCU-only .exe. But is there a way to get a slimmer SDL2 .exe? Is the additional file size due to necessary SDL2 stuff? (I tried lumping on parameters that cut a 200 MB+ Hengband .exe down to 4 MB, ie $ make -f Makefile.msys2.sdl2 SOUND=yes CXXFLAGS="-g0 -O2" after a make "clean," but the .exe size remained 22.1 MB.)
__________________
My Angband videos Last edited by smbhax; November 18, 2022 at 04:29. |
![]() |
![]() |
![]() |
#14 |
Swordsman
Join Date: Aug 2019
Posts: 350
![]() |
Makefile.msys2.sdl2 is compiling with debugging symbols so that'll be part of the 22 megabytes. To avoid that, it's probably easiest to edit Makefile.msys2.sdl2 and remove "-g" from CFLAGS (it's at line 101 in the current version). For the normal Windows builds, removing the debugging symbols saved ~5 megabytes in the size of the executable.
With Makefile.msys2.sdl2, the SDL2 libraries are linked statically, which also bloats the executable size. I tried once to link those dynamically in the hopes that would simplify what libraries have to be specified in Makefile.msys2.sdl2 but had no success. So I don't have any easy pathway for you to avoid that part of the large executable size. |
![]() |
![]() |
![]() |
#15 |
Swordsman
Join Date: Oct 2021
Location: WA
Posts: 322
![]() |
Ah! Yeah setting -g0 there got the .exe down to 15.7 MB. Better than 22.1. : )
Removing the -static line (104) got the .exe down to 4 MB or so but then it just started complaining about missing dlls, four at a time, starting mostly with the SDL2 ones. ; )
__________________
My Angband videos |
![]() |
![]() |
![]() |
#16 |
Veteran
Join Date: Jun 2007
Posts: 1,391
![]() |
Try running "strip" on the executable post-build.
|
![]() |
![]() |
![]() |
#17 |
Swordsman
Join Date: Oct 2021
Location: WA
Posts: 322
![]() |
Ooh! "strip angband.exe" gets it down to 11.5 MB, with or without setting -g0 in the Makefile. : )
__________________
My Angband videos |
![]() |
![]() |
![]() |
#18 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 6,769
Donated: $40
![]() |
Strip is a bad choice. You won't be able to report bugs. Use -O2 optimization. It'll make a clean build. If you can find a static build of the SDL library you'll do better, too.
|
![]() |
![]() |
![]() |
#19 |
Swordsman
Join Date: Oct 2021
Location: WA
Posts: 322
![]() |
Aw. Well, it's already got -O2 in there, at least.
__________________
My Angband videos |
![]() |
![]() |
![]() |
#20 | ||
Swordsman
Join Date: Oct 2021
Location: WA
Posts: 322
![]() |
Not sure about the "static build of the SDL library" thing. Googling suggests static linking the SDL2 library is a little involved. These pages for instance
https://stackoverflow.com/questions/...linking-errors (2022) https://stackoverflow.com/questions/...sdl2-libraries (2013) which are not MSYS2-specific, mention a lot of additional linker flags, and something about special handling surrounding a "libSDL2.a" file. Well, the main 2022 answer seems to be Quote:
There's also this page https://stackoverflow.com/questions/...rams-correctly which does have a section on MSYS2, titled "A saner alternative": Quote:
__________________
My Angband videos Last edited by smbhax; November 20, 2022 at 01:42. |
||
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Angband 4.2.4 Windows SDL2 Build Issue | docrobot | Vanilla | 4 | February 24, 2022 01:43 |
4.2.0 windows sdl2 frontend | Adriankhl | Development | 10 | June 11, 2020 15:55 |
SDL2 port when ? | shirish | Development | 89 | September 2, 2019 11:59 |
Latest Nightly release, SDL2 crashing with 8 terms | EducatedNoob | Development | 3 | June 24, 2019 22:17 |
v4.1.2 Sound? | Imzy | Vanilla | 1 | January 27, 2018 22:45 |