Search code examples
cadagnatgprbuild

GPRBuild does not compile C files


I upgraded to GNAT Community 2018 (everything worked fine with GNAT GPL 2017). I have this project file:

with "opengl";

library project OpenGL.Soil is
   for Library_Name use "SoilAda";

   for Languages use ("ada", "c");

   for Source_Dirs use ("src/soil");

   -- snip compiler config
end OpenGL.Soil;

Now in src/soil, there are a couple of .ads and .adb files as well as .h and .c files. Previously, this project file compiled all of them and linked them together just fine when used. Since GNAT Community 2018, this file only compiles the Ada sources, not the C sources.

Things I have tried:

  • Ensured that GCC coming with GNAT Community still supports compiling C. Yes it does.
  • Explicitly defined Naming package setting Spec_Suffix and Implementation_Suffix for C to the respective file endings.
  • Explicitly specified Source_Files and put all Ada and C files in it.

No matter what I did, GPRBuild, when invoked, will not compile the C files (resulting in linker errors). There is no error or warning output regarding the C files even if they are explicitly specified.

How can I make GPRBuild compile the C files again?


Solution

  • Reason was that there were still 32bit object files from the previous compiler lying around. GPRBuild did not re-compile those but also didn't try and link them (which would have failed), calling gprclean -r on the project and compiling again fixed it.