title: Jenkins cannot find g++
body: <p>I am learning all of these new technologies. I have a home server for private development with latest version of centos 7.6 (minimal installation). I am trying to keep the server as light as possible.</p>
  
  <p>I have installed jenkins (v2.164.2) and it is up and running correctly. I have created a new Freestyle project to compile a g++ project hosted on another own gogs server. I have defined gogs url and credentials and then added the following in the execute shell command:</p>
  
  <pre><code>which g++; make clean; make;
  </code></pre>
  
  <p>When I press the "Build Now" button, it fails with the following message:</p>
  
  <blockquote>
    <p>which: no g++ in (/sbin:/usr/sbin:/bin:/usr/bin)</p>
  </blockquote>
  
  <p>Cloning the repository, etc seems to be working fine.</p>
  
  <p>I have NOT installed the default g++ version but instead I have installed the one that comes with devtools-7 (g++ v7.3.1). I have created a new file under /etc/profile.d/devtools.sh with the following text:</p>
  
  <pre><code>!#/bin/bash
  source scl_source enable devtoolset-7
  </code></pre>
  
  <p>If I login into a bash shell in the server and then run which g++, I get the expected output.</p>
  
  <p>Finally, the question: why jenkins is not picking this up? As far as I know, adding that file under /etc/profile.d ensures that everyone will be able to access g++.</p>
  
  <p>Thanks very much in advance for any help.</p>