I have an C project on github, I`m trying to build the code in Travis-CI but I get this error:
Using worker: worker-linux-9-2.bb.travis-ci.org:travis-linux-2
$ export CC=gcc
git.1
$ git clone --depth=50 --branch=someDevs git://github.com/luizfilipe/ffb-cglib.git luizfilipe/ffb-cglib
Cloning into 'luizfilipe/ffb-cglib'...
remote: Counting objects: 114, done.
remote: Compressing objects: 100% (93/93), done.
remote: Total 114 (delta 27), reused 80 (delta 12)
Receiving objects: 100% (114/114), 2.53 MiB | 0 bytes/s, done.
Resolving deltas: 100% (27/27), done.
Checking connectivity... done.
$ cd luizfilipe/ffb-cglib
git.3
$ git checkout -qf f76cd622418a75003d1aa6326c38039c1f556ee8
$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ make
gcc -c -pendantic examples/environment/main.c -I/usr/bin/Mesa-5.0/include -g
make: gcc: Command not found
make: *** [main.o] Error 127
The command "make" exited with 2.
Done. Your build exited with 1.
Reading the error i notice that gcc
wasn't found, but the .travis.yml is cofigured like following:
language: c
compiler:
- gcc
script: make
Makefile is configured like follows:
# Variables
MESA = /usr/bin/Mesa-5.0
PATH = examples/environment/main
EXAMPLE_ENVIRONMENT = examples/environment/main.c
INCPATH = -I$(MESA)/include
LIBPATH = -L$(MESA)/lib
LIBS = -lglut -lGLU -lGL -lm
CFLAGS = $(INCPATH) -g
LFLAGS = $(LIBPATH) $(LIBS)
# Main targets
all: main.o
$(CC) -o $(PATH) main.o $(LFLAGS)
# Source targets
main.o: $(EXAMPLE_ENVIRONMENT)
$(CC) -c -pendantic $(EXAMPLE_ENVIRONMENT) $(CFLAGS)
Any thoughts?
UPDATE: I just cut off the clang and put the Makefile more agnostic and I still getting the same issue.
The problem is that you hard code your compiler then ask travis to build against two compilers. This means that travis will try to build your code with gcc then again with clang. You have two options remove clang as a compiler from your .travis.yml
or change your makefile to be compiler agnostic. To change you makefile just replace all instances of gcc with $(CC)
Also $PATH
contains the locations to look in for executables. If you overwrite it make can't find anything. so you need to rename $PATH to something like example_path eg
# Variables
MESA = /usr/bin/Mesa-5.0
example_path = examples/environment/
EXAMPLE_ENVIRONMENT = examples/environment/main.c
INCPATH = -I$(MESA)/include
LIBPATH = -L$(MESA)/lib
LIBS = -lglut -lGLU -lGL -lm
CFLAGS = $(INCPATH) -g
LFLAGS = $(LIBPATH) $(LIBS)
# Main targets
all: main.o
$(CC) -o $(example_path)/main.o $(LFLAGS)
# Source targets
main.o: $(EXAMPLE_ENVIRONMENT)
$(CC) -c -pendantic $(EXAMPLE_ENVIRONMENT) $(CFLAGS)
You will also need to add a before_install section to your .travis.yml
file to install Mesa as the travis images are very minimal.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments