I get the message “illegal case label “statit-pic” in a .grp file. in the context:
case XX
when “relocatable” =>
for Default_Switches (“ada”) use (”-gnatQ", “-gnata”, “-gnatf”);
.
.
en case;
Can you show us the whole GPR file? You can paste in there between a set of “triple backticks”:
```Ada
code
```
becomes
code
The total .gpr file is to big and not relevant I think.
package Compiler is
case Library_Type is
when “static” =>
–for Default_Switches (“ada”) use (“-gnatQ”, “-g”, “-gnata”, “-gnatf”);
for Default_Switches (“ada”) use (“-gnatQ”, “-gnata”, “-gnatf”);
when “static-pic” =>
for Default_Switches (“ada”) use (“-gnatQ”, “-g”, “-gnata”, “-gnatf”);
when “relocatable” =>
–for Default_Switches (“ada”) use (“-gnatQ”, “-g”, “-gnata”, “-gnatf”);
for Default_Switches (“ada”) use (“-gnatQ”, “-gnata”, “-gnatf”);
end case;
end Compiler;
“statit-pic” /= “static-pic”
If you want help trouble shooting stuff, we often times need complete info. For example, you gave the case statement but not the declaration for Library_Type.
Dmitry’s answer could be the reason or it could be because you just mistyped it potentially.
Hopefully Dmitry’s answer ends up being it though as that is a simple fix.
I just send you my complete .gpr file. I have used this file some years in the past without problems. The complexity is due for instance by willing to use the file in other Operating Systems. Due to the fact that I used a newer compiler so perhaps that is the reason, but I could not find anything about these values: static and static-pic.from an example.
– Copyright (C) 2025 L. Dries –
– This library is free software; you can redistribute it and/or modify it –
– under terms of the GNU General Public License as published by the Free –
– Software Foundation; either version 3, or (at your option) any later –
– version. This library is distributed in the hope that it will be useful, –
– but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- –
– TABILITY or FITNESS FOR A PARTICULAR PURPOSE. –
– As a special exception under Section 7 of GPL version 3, you are granted –
– additional permissions described in the GCC Runtime Library Exception, –
– version 3.1, as published by the Free Software Foundation. –
– You should have received a copy of the GNU General Public License and –
– a copy of the GCC Runtime Library Exception along with this program; –
– see the files COPYING3 and COPYING.RUNTIME respectively. If not, see –
– http://www.gnu.org/licenses/. –
– Version 1.00 dd. 10-07-2025 created by L. Dries –
– Created from emplate V1.00 by L. Dries on 10-07-2025 –
with “gtkada”;
project Sudoku is
type OS_Kind is
(“Windows_NT”, “Linux”);
OS : OS_Kind := external(“OS”, “Windows_NT”);
package Naming is
case OS is
when “Windows_NT” =>
when “Linux” =>
for Casing use “mixedcase”;
end case;
end Naming;
case OS is
when “Windows_NT” =>
for Object_Dir use “.\build”;
for Exec_Dir use “.”;
when “Linux” =>
for Object_Dir use “./Build”;
for Exec_Dir use “.”;
end case;
type Build_Kind is
(“static”, “relocatable”);
Library_Type : Build_Kind := external (“LIBRARY_TYPE”, “static”);
case OS is
when “Windows_NT” =>
case Library_Type is
when “static” =>
for Source_Dirs use (“.”, “Standaarden/Standaard Packages/Init/",
"../../Standaarden/Standaard Packages/Gtk_Message_Box/”,
“../../Standaarden/Standaard Packages/Debugging/“);
for Main use (“Sudoku.adb”);
when “relocatable” =>
end case;
when “Linux” =>
case Library_Type is
when “static” =>
for Source_Dirs use (”.", "../../Standaarden/Standaard Packages/Init/”,
“../../Standaarden/Standaard Packages/Gtk_Message_Box/",
"../../Standaarden/Standaard Packages/Debugging/”);
for Main use (“Sudoku.adb”);
when “relocatable” =>
end case;
end case;
package Ide is
case OS is
when “Windows_NT” =>
for Documentation_Dir use “.\doc”;
when “Linux” =>
for Documentation_Dir use “./doc”;
end case;
end Ide;
package Builder is
case Library_Type is
when “static” =>
for Default_Switches (“ada”) use (“-s”, “-m”, “-g”, “-j8”);
when “static-pic” =>
for Default_Switches (“ada”) use (“-s”, “-m”, “-g”, “-j8”);
when “relocatable” =>
for Default_Switches (“ada”) use (“-s”, “-m”, “-g”, “-j8”);
end case;
end Builder;
package Compiler is
case Library_Type is
when “static” =>
–for Default_Switches (“ada”) use (“-gnatQ”, “-g”, “-gnata”, “-gnatf”);
for Default_Switches (“ada”) use (“-gnatQ”, “-gnata”, “-gnatf”);
when “static-pic” =>
for Default_Switches (“ada”) use (“-gnatQ”, “-g”, “-gnata”, “-gnatf”);
when “relocatable” =>
–for Default_Switches (“ada”) use (“-gnatQ”, “-g”, “-gnata”, “-gnatf”);
for Default_Switches (“ada”) use (“-gnatQ”, “-gnata”, “-gnatf”);
end case;
end Compiler;
package Linker is
case OS is
when “Windows_NT” =>
case Library_Type is
when “static” =>
for Default_Switches (“ada”) use (“-mwindows”, “-g”);
when “relocatable” =>
for Default_Switches (“ada”) use (“-mwindows”);
end case;
when “Linux” =>
case Library_Type is
when “static” =>
for Default_Switches (“ada”) use ( “-g”);
when “relocatable” =>
end case;
end case;
end Linker;
package Prove is
for Switches use (“-j8”);
end Prove;
end Sudoku;
Your case statement handles the labels "static"
, "static-pic"
, and "relocatable"
, but Library_Type
can only have the values: (“static”, “relocatable”)
(see the declaration of Build_Kind
).
The fix is to remove the "static-pic"
case in your compiler switches.
You are creating an application. Specifying library switches for it is totally pointless. As a rule you should inherit options from the parent project(s).
A gpr-file for an application is normally a dozen lines long. E.g.
with "foo.gpr";
project Bar is
for Main use ("bar.adb);
package Compiler renames Foo.Compiler;
package Binder renames Foo.Binder;
package Builder renames Foo.Builder;
package Linker renames Foo.Linker;
end Bar;
For GtkAda you need only -mwindows since the gpr-file generated by the installer script does not have it (a bug).
P.S. Specifying -j8 in a very bad idea. It could make your project non-compilable, provided you really have so many source files. Pass -j0 or a lesser number if you lack memory directly to grpbuild in the command line. E.g. -j2 if you see that the compiler runs out of memory.
Thanks! It looks like @damaki found the problem most likely once we were able to see more of the file. I have separated out the pertinent sections from your gpr file below so you can see. Build_Kind
does not have a "static-pic"
option as you can see, but you try to use that option in the case statements.