openvpn-gui icon indicating copy to clipboard operation
openvpn-gui copied to clipboard

make windres fail on resource errors

Open chipitsine opened this issue 8 years ago • 9 comments

if resource file is broken, windres produces a "warning" on that.

those might be errors actually, like these

https://github.com/OpenVPN/openvpn-gui/commit/727eaee0c54b0aee01ad28f622c1da7011e7b7c1 https://travis-ci.org/OpenVPN/openvpn-gui/jobs/221950708#L683-L686

we need to turn those warnings into errors

chipitsine avatar Apr 22 '17 07:04 chipitsine

Agreed. I tested what happens if I introduce an error in a .rc file and then go through the build like Travis would. And here's what happened:

$ x86_64-w64-mingw32-windres -DHAVE_CONFIG_H -I.  -I/home/samuli/image/include -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=_WIN32_WINNT_VISTA -DWINVER=_WIN32_WINNT -i res/openvpn-gui-res.rc -o openvpn-gui-res.o

In file included from res/openvpn-gui-res.rc:46:0:
res/openvpn-gui-res-fi.rc:47:22: warning: missing terminating " character [enabled by default]
     LTEXT "Sala"sana:", 0, 6, 26, 50, 10
                      ^
x86_64-w64-mingw32-windres: res/openvpn-gui-res-fi.rc:47: syntax error
x86_64-w64-mingw32-windres: preprocessing failed.

$ echo $?
2

So the return value is 2, not 1. However, if I run the windres command alone it exits with 1:

$ x86_64-w64-mingw32-windres -DHAVE_CONFIG_H -I.  -I/home/samuli/image/include -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=_WIN32_WINNT_VISTA -DWINVER=_WIN32_WINNT -i res/openvpn-gui-res.rc -o openvpn-gui-res.o
In file included from res/openvpn-gui-res.rc:46:0:
res/openvpn-gui-res-fi.rc:34:29: warning: missing terminating " character [enabled by default]
     CHECKBOX "Save pass"word", ID_CHK_SAVE_PASS, 6, 33, 100, 10
                             ^
x86_64-w64-mingw32-windres: res/openvpn-gui-res-fi.rc:34: syntax error
x86_64-w64-mingw32-windres: preprocessing failed.

$ echo $?
1

The error message is identical to the one shown in Travis, except that the advise

res/openvpn-gui-res-kr.rc:268: use "" to put " in a string

is missing. The man-page of x86_64-w64-mingw32-windres does not show any options that we could use, and the error is coming from windres, not the preprocessor (gcc -E ...).

Is this perhaps an issue in the Travis' build environment?

mattock avatar Apr 24 '17 07:04 mattock

I tried local build, it was the same as travis-ci. actually, I had a couple of thoughts

  1. use windres "preprocessor" feature
  2. parse output

I do not like either of above.

what is your windres version ?

chipitsine avatar Apr 24 '17 07:04 chipitsine

/usr/bin/x86_64-w64-mingw32-windres --version
GNU windres (GNU Binutils) 2.23.52.20130620

mattock avatar Apr 24 '17 08:04 mattock

ok, I will have a look at travis-ci and my local tools

chipitsine avatar Apr 24 '17 08:04 chipitsine

have a look

https://travis-ci.org/chipitsine/openvpn-gui/jobs/230523093#L1469

and

https://travis-ci.org/chipitsine/openvpn-gui/jobs/230527072#L1629

as I had a look at windres sources, it is ... designed to compile any resource file, if possible with warning, but not fail. too bad.

chipitsine avatar May 09 '17 21:05 chipitsine

I suppose we have to just keep an eye on windres warnings..

selvanair avatar May 10 '17 03:05 selvanair

if we convert rc into "visual studio compatible", we can run VS under appveyor

chipitsine avatar May 10 '17 04:05 chipitsine

I'll ask at binutils/windres community. Maybe we just miss something obvious

chipitsine avatar May 10 '17 04:05 chipitsine

surprise, windres does fail on its own (i.e. fails as expected), on the same "kr" resource

https://travis-ci.org/chipitsine/windres-xprmnts/jobs/231258891#L1258

it seems to fail ... when including files ?

chipitsine avatar May 11 '17 18:05 chipitsine

We no have MSVC builds and this should not be an issue any longer.

selvanair avatar Dec 17 '22 22:12 selvanair