Errors trying to run gnattest

165 Views Asked by At

I'm trying to run gnattest on a Ada project file:

gnattest -P(projectname)

and I get the following errors:

object path not found for runtime native gnattest: initialization failed

I made sure the gnatpro-v20.2/bin directory was part of the path. I tried adding other gnat directories to the path. I tried running the command inside of GPS and from command line.

2

There are 2 best solutions below

0
Lynxdom On

I think I figured it out. The fact that running the sample gave me a different error inspired me to try creating a new, from scratch, gpr just for the unit testing. The project I was using before had a bunch of conditions in it and a main. I created a simple gpr, based on the sample, that didn't have a main.

At my company, when IT installs a product they do so on their accounts, so the environment for the users is not always updated . During my research I found there is a file called aunit.gpr that is in the share/gpr folder. I created a variable called GPR_PROJECT_PATH that pointed at that folder. This seems to have fixed it.

0
Bloodgain On

I had these same errors, and they were caused by the presence of a GNAT toolchain in my PATH ahead of the path that includes gnattest. The system GCC or user GCC/GNAT installations usually do not include the necessary support libraries to be compatible with gnattest by default, as GNATtest is now limited to the GNAT Pro suite.

Run the command gnatls -v to see the active GNAT search paths. Ensure that these match the install path (e.g. /usr/local/gnatpro-vXX.Y/bin) for the gnattest binary you are using. On Linux, which gnattest will tell you the path or alias being executed for gnattest.

NOTE: To use the FSF GNAT build tools with GNATtest, you would need to install the AUnit library and any other supporting libraries in the correct search paths for that version of GNAT.