wingtk / gvsbuild

GTK stack for Windows
GNU General Public License v2.0
435 stars 164 forks source link

Building gtk fails with a too long string (>65536 chars) [VisualCode 2019/v16] #827

Open F-Loyer opened 1 year ago

F-Loyer commented 1 year ago

I have tried gvsbuild build --vs-ver 16 --vs-install-path C:\DiskuvOCaml\BuildTools gtk3. Since I have Visual Code 2019 which is proposed by the Diskuv project (an Windows Ocaml port).

I have the following errors:

[365/885] Generating gtk/gtkresources_c with a custom command
Un prétraitement xml-stripblanks a été demandé, mais XMLLINT n’est pas défini et xmllint n’est pas dans le chemin PATH
[371/885] Compiling C object gtk/gtk-3-...p/meson-generated_.._gtkresources.c.obj
FAILED: gtk/gtk-3-vs16.dll.p/meson-generated_.._gtkresources.c.obj
[...]
gtk/gtkresources.c(4105): fatal error C1091: limite du compilateur : la longueur de la chaîne dépasse de 65535 octets
[380/885] Compiling C object gtk/gtk-3-...eson-generated_.._gtktypebuiltins.c.obj
ninja: build stopped: subcommand failed.

Since the compiler is limited to 65536 characters strings, I guess I should process the file to replace "\000\001\002..." by 0, 1, 2 or somehing like this.

danyeaw commented 1 year ago

Hi @F-Loyer, do you have long paths enabled in Windows?

F-Loyer commented 1 year ago

It is not about the path, but the compilator doesn't like some long strings inside the .cfile. (See https://learn.microsoft.com/en-us/cpp/cpp/compiler-limits?view=msvc-170)

I have tried to remplace the string by a list or number... but get the following error:

gtk/gtkresources.c(15612): fatal error C1060: espace du tas insuffisant pour le compilateur

The heap space is not suffisient for the compiler. I note the progress... the error is produced at the line 15612... and not 4105... But we need to handle 10 times more lines !

The error is covered here https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/fatal-error-c1060?view=msvc-170, but with an x64 system, I am surprised by this error.

danyeaw commented 1 year ago

Do you have the Diskuv OCaml setup instructions that you are following so that we can try to reproduce this? I haven't seen this issue before, so there must be something unique with your setup.

F-Loyer commented 1 year ago

I have followed https://diskuv-ocaml.gitlab.io/distributions/dkml/# (and use the Diskuv installer). But, the Visual Studio 2019 is installed automatically in a fancy directory, but this installation is made by the Visual Studio Installer.

I don't think the compiler installation is wrong (the 65535 characters limit is documented by Microsoft).

The issue can come from the C:\gtk-build\build\x64\release\gtk3\gtk\gtkresources.c generation. Mine is 175637 lines long !! The ressource is 2809657 bytes long in a unique array. Perhaps something has happenned when generating this file.

F-Loyer commented 1 year ago

I finally solved my issue, using VS2022. The C:\gtk-build\build\x64\release\gtk3\gtk\gtkresources.c is the same, then I guess the older compiler has a known and documented limitation.