Closed
Description
This was found while trying to build GIMP 3 with Clang, using Meson as the build generator. The example below is an attempt to simplify a reproducible error.
The following rc file:
#define _QUOTE(x) #x
#define QUOTE(x) _QUOTE(x)
#define VER_INTERNALNAME_STR QUOTE(INTERNALNAME_STR)
STRINGTABLE
{
1, VER_INTERNALNAME_STR
}
Compiles correctly with windres "--define" "INTERNALNAME_STR=\"goat-exercise\"" error.rc error.o
when using Mingw64's windres, but fails with LLVM's:
$ windres "--define" "INTERNALNAME_STR=\"goat-exercise\"" error.rc error.o
llvm-rc: Error parsing file: expected '-', '~', integer or '(', got goat-exercise\
Version info
clang version 14.0.6
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: D:/msys64/clang64/bin
This is an example from the real build:
[98/1885] Generating extensions/goat-exercises/windows_compile_resources_0_gimp-plug-ins.rc with a custom command
FAILED: extensions/goat-exercises/719be94@@gimp_plugins_rc@cus_0_gimp-plug-ins.o
"D:\msys64\clang64\bin/windres.EXE" "--define" "ORIGINALFILENAME_STR=\"goat-exercise-c.exe\"" "--define" "INTERNALNAME_STR=\"goat-exercise\"" "--define" "TOP_SRCDIR=\"D:/Dev/Github/MINGW-packages/mingw-w64-gimp3/src/gimp3-2.99.12.r3.g02739dd6e6\"" "-ID:/Dev/Github/MINGW-packages/mingw-w64-gimp3/src/gimp3-2.99.12.r3.g02739dd6e6/." "-ID:/Dev/Github/MINGW-packages/mingw-w64-gimp3/src/build-CLANG64/." "-ID:/Dev/Github/MINGW-packages/mingw-w64-gimp3/src/gimp3-2.99.12.r3.g02739dd6e6/app" "-ID:/Dev/Github/MINGW-packages/mingw-w64-gimp3/src/build-CLANG64/app" "build/windows/gimp-plug-ins.rc" "extensions/goat-exercises/719be94@@gimp_plugins_rc@cus_0_gimp-plug-ins.o" "--preprocessor-arg=-MD" "--preprocessor-arg=-MQextensions/goat-exercises/719be94@@gimp_plugins_rc@cus_0_gimp-plug-ins.o" "--preprocessor-arg=-MFextensions/goat-exercises/719be94@@gimp_plugins_rc@cus_0_gimp-plug-ins.o.d"
llvm-rc: Error parsing file: expected BLOCK or VALUE, got goat-exercise\
Where the full rc file is:
#include <winver.h>
#include "git-version.h"
#define _QUOTE(x) #x
#define QUOTE(x) _QUOTE(x)
#define VER_COMPANYNAME_STR "Spencer Kimball, Peter Mattis and the GIMP Development Team"
#define VER_PRODUCTVERSION 2,99,12,0
#define VER_PRODUCTVERSION_STR "2.99.12\0"
#define VER_PRODUCTNAME_STR "GNU Image Manipulation Program"
#define VER_FILEVERSION 2,99,12,0
#define VER_FILEVERSION_STR "2.99.12.0\0"
#define VER_FILEDESCRIPTION_STR "GNU Image Manipulation Program Plug-In"
#define VER_INTERNALNAME_STR QUOTE(INTERNALNAME_STR)
#define VER_ORIGINALFILENAME_STR QUOTE(ORIGINALFILENAME_STR)
#define VER_LEGALCOPYRIGHT_STR "Copyright © 1995-" GIMP_GIT_LAST_COMMIT_YEAR
#ifndef DEBUG
#define VER_DEBUG 0
#else
#define VER_DEBUG VS_FF_DEBUG
#endif
#ifndef GIMP_UNSTABLE
#define VER_PRERELEASE 0
#else
#define VER_PRERELEASE VS_FF_PRERELEASE
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS (VER_PRERELEASE|VER_DEBUG)
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", VER_INTERNALNAME_STR
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#include "winuser.h"
1 ICON "/build/windows/plug-ins.ico"
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "/build/windows/gimp.manifest"