You are not logged in.

#1 2016-12-03 06:32:29

h454n34
Member
Registered: 2015-01-05
Posts: 40

Ccache problem?

Hi guys;
My install cache <= https://wiki.archlinux.org/index.php/Ccache
My default shell = zsh.
Extra add:

export CCACHE_TEMPDIR="$HOME/.ccache"
export USE_CCACHE=1
export CC="ccache gcc"
export CXX="ccache g++"

alias gcc="ccache gcc"
alias g++="ccache g++"
alias cc="ccache cc"
alias c++="ccache c++"

I Compile any software with terminal

$ g++ main.cpp -lsfml-graphics -lsfml-window -lsfml-system
main.cpp: In function ‘int main()’:
..........................................

No problem.

Now
add compile.sh

#!/bin/bash
g++ main.cpp -lsfml-graphics -lsfml-window -lsfml-system

Run terminal

$ ./compile.sh
open3: exec of ccache g++ main.cpp -lsfml-graphics -lsfml-window -lsfml-system failed: No such file or directory at /usr/lib/colorgcc/bin/g++ line 246.

Another example
Run make

$ make
Can't exec "ccache gcc ": No such file or directory at /usr/lib/colorgcc/bin/gcc line 240.
Couldn't exec at /usr/lib/colorgcc/bin/gcc line 240.
make: *** [Makefile:91: test_build] Error 2

Why can not I compile with a script?
What is the problem?

Offline

#2 2016-12-03 10:22:37

dafero
Member
From: /home/dafero
Registered: 2014-03-22
Posts: 30

Re: Ccache problem?

you probably want to source the .zshrc (or the file where you define those variables) within the compile.sh script

Offline

Board footer

Powered by FluxBB