Ada Environment Variable Path Issue

Viewed 120

When compiling Ada, when I change the build path to the GNAT build, all global commands (clear, sudo, gcc, etc.) don't work but when I change it to the global (default) command, the global commands work, but the Ada build isn't recognized.

How do I fix this?

Note: ➜ Ada = $, (using Oh My Zzh from Ada folder)

Terminal: (Note start & end are the same)

➜  Ada gcc -c main.adb                        
error: invalid value 'ada' in '-x ada'
➜  Ada PATH=/Users/Ryan/opt/GNAT/2020/bin     
➜  Ada gcc -c main.adb                   
xcode-select: error trying to exec 'xcode-select': execvp: No such file or directory
gcc: error trying to exec 'as': execvp: No such file or directory
➜  Ada PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH
➜  Ada gcc -c main.adb                          
error: invalid value 'ada' in '-x ada'
➜  Ada 
1 Answers

Just do

PATH=/Users/Ryan/opt/GNAT/2020/bin:${PATH}

instead of

PATH=/Users/Ryan/opt/GNAT/2020/bin

You need to preppend path to GNAT, not replace whole PATH.

Related