open-watcom / open-watcom-v2

Open Watcom V2.0 - Source code repository, Wiki, Latest Binary build, Archived builds including all installers for download.
Other
958 stars 157 forks source link

wrc crashes at attempt to compile any resource file #708

Closed denis-shienkov closed 3 years ago

denis-shienkov commented 3 years ago

Hi all.

I try to compile the following simple resource source file:

#define IDR_VERSION1 1

//#include <rc-include.h>

IDR_VERSION1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEOS 0x00000004
FILETYPE 0x00000000
BEGIN
  BLOCK "StringFileInfo"
  BEGIN
    BLOCK "FFFF0000"
    BEGIN
      VALUE "FileVersion", "1.0.0.0\0"
      VALUE "ProductVersion", "1.0.0.0\0"
    END
  END
  BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0xFFFF, 0x0000
  END
END

using the following command:

e:\git\ng\git\123\qbs-git\tests\rc>wrc test.rc

But, seems that the resource compiler gets crashed, because it does nothing.

PS: I tested this resource file using the MinGW windres utility, and it does work as expected:

windres test.rc -o test.res
jmalak commented 3 years ago

Sorry, windres functionality is not relevant. .rc file must follow Microsoft Resource Script rules. Try it with MS Resource Compiler to see what is incorrect. OW tools are not replacement for Linux tools. OW uses Microsoft specifications for Windows related tools, not something from Linux/GNU.

jmalak commented 3 years ago

I check OW Resource Compiler and it generate proper resource file, exactly same as Microsoft Resource Compiler.

OPNA2608 commented 3 years ago

There is a legitimate crash here even if the rc file is valid, because it expects to find & open an executable (to bind the resource file into? - I'm not a Windows dev kinda guy).

$ wrc test.rc
Error! E159: Can't find file "test.exe".
free(): double free detected in tcache 2
Aborted (core dumped)
GDB backtrace ``` Program received signal SIGABRT, Aborted. 0x000000000042de4a in raise () (gdb) bt #0 0x000000000042de4a in raise () #1 0x0000000000401223 in abort () #2 0x0000000000434788 in __libc_message () #3 0x0000000000439bca in malloc_printerr () #4 0x000000000043bd91 in _int_free () #5 0x000000000042ffe5 in fclose () #6 0x000000000040c282 in res_close (fp=0x529750) at ../c/layer0.c:238 #7 0x0000000000423344 in ResCloseFile (fp=) at /build/source/bld/wres/c/rclosef.c:41 #8 0x00000000004232ee in CloseResFile (hinfo=0x51b330 ) at /build/source/bld/wres/c/opcl1.c:80 #9 0x0000000000420ad0 in FiniRcMsgs () at ../c/rcldstr.c:133 #10 0x0000000000421cbe in RCMainLine (opts=opts@entry=0x0, argc=argc@entry=2, argv=argv@entry=0x7fffffffc478) at ../c/ideentry.c:332 #11 0x0000000000421ee6 in IDERunYourSelfArgv (hdl=, argc=argc@entry=2, argv=argv@entry=0x7fffffffc478, fatalerr=fatalerr@entry=0x7fffffffc302) at ../c/ideentry.c:422 #12 0x000000000042288e in IdeDrvExecDLLArgv (inf=inf@entry=0x5180c0 , argc=2, argv=0x7fffffffc478) at /build/source/bld/watcom/c/idedrv.c:644 #13 0x0000000000422556 in main (argc=, argv=) at ../c/maindrv.c:77 ```

Running wrc test.rc -r to only generate a res file completes successfully, so I assume the rc file itself is valid.