Shefy Gur-ary
Shefy Gur-ary

Reputation: 658

Run make command in Jenkins

I'm trying to build c++ project.

When I run the make command in terminal it works, but when I do it through Jenkins, it shows me a message that files are missing.

What can be the problem, and how can I solve it?

The Error:

+ make
make -f enclave_lib.mk SGX_DEBUG=1
make[1]: Entering directory '/home/yoni/Documents/private_ledger-tp/CryptoLib'
mt19937ar.c:44:19: fatal error: stdio.h: No such file or directory

Upvotes: 1

Views: 6191

Answers (2)

Shefy Gur-ary
Shefy Gur-ary

Reputation: 658

It turned out that in our case it was an issue of environment variables.

What I did to solve it is

  1. Getting the data on environment variables both from Terminal and Jenkins, and write them sorted into 2 files.
  2. Comparing the 2 files with meld
  3. Any variables that seemed relevant that the Terminal environment and the Jenkins didn't I placed into /etc/environment file (Jenkins takes additional environment vars from there)

    env | sort > envInTerminal.txt

    env | sort > envInJenkins.txt

    meld envInTerminal.txt envInJenkins.txt

    sudo gedit /etc/environment

Upvotes: 1

Luc
Luc

Reputation: 1433

From your comments, the problem is that Jenkins is executed as root user, and can not find the lib stdio.h.

To fix this you can have several options:

  • locate stdio.h You run this command from your user. It will give you the path to stdio.h. That you can feed in your make
  • sudo apt-get install build-essential

As a root user, you install build-essential. That should install this missing dependency

  • execute Jenkins with your privilege, not with root privilege
  • in your build process, connect to your account (su youruser)

Upvotes: 2

Related Questions