web-dev-qa-db-fra.com

Commande introuvable cc, faire l'erreur 127

J'essaie d'installer shc sur Ubuntu 18.04

wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz
tar xvfz shc-3.8.9.tgz
cd shc-3.8.9
make

Mais recevez l'erreur suivante:

cc -Wall  shc.c -o shc
make: cc: Command not found
makefile:31: recipe for target 'shc' failed
make: *** [shc] Error 127

Le makefile:

# Makefile
#

INSTALL_PATH = /usr/local

# For SCO
CFLAGS = -b elf -O -D_SVID

# For IRIX
CFLAGS = -xansi -fullwarn -O3 -g0

# For Solaris
CFLAGS = -fast -xO4 -s -v -Xa

# For HPUX
CFLAGS = -Wall -O -Ae

# For OSF1
CFLAGS = -w -verbose -fast -std1 -g0

# For GNU C compiler
CFLAGS = -Wall # -O6 -pedantic

#Shell = /bin/sh

SHCFLAGS = -v -T # Add -T option to allow binary to be traceable

all: shc ask_for_test

shc: shc.c
    $(CC) $(CFLAGS) [email protected] -o $@

ask_for_test:
    @echo '***  �Do you want to probe shc with a test script?'
    @echo '***  Please try...   make test'

test: make_the_test ask_for_strings

make_the_test: match.x
    @echo '***  Running a compiled test script!'
    @echo '***  It must show files with substring "sh" in your PATH...'
    ./match.x sh

match.x: shc match
    @echo '***  Compiling script "match"'
    CFLAGS="$(CFLAGS)" ./shc $(SHCFLAGS) -f match

ask_for_strings:
    @echo '***  �Do you want to see strings in the generated binary?'
    @echo '***  Please try...   make strings'

strings: make_the_strings ask_for_expiration

make_the_strings: match.x
    @echo '***  Running: "strings -n 5 'match.x'"'
    @echo '***  It must show no sensible information...'
    strings -n 5 match.x

ask_for_expiration:
    @echo '***  �Do you want to probe expiration date?'
    @echo '***  Please try...   make expiration'

expiration: til_yesterday ask_for_install

til_yesterday: shc match
    @echo '***  Compiling "match" to expired date'
    CFLAGS="$(CFLAGS)" ./shc $(SHCFLAGS) -vv -e `date "+%d/%m/%Y"` -f match
    @echo '***  Running a compiled test script!'
    @echo '***  It must fail showing "./match.x: has expired!"'
    ./match.x

ask_for_install:
    @echo '***  �Do you want to install shc?'
    @echo '***  Please try...   make install'

install: shc
    @echo '***  Installing shc and shc.1 on '$(INSTALL_PATH)
    @echo -n '***   �Do you want to continue? '; read ANS; case "$$ANS" in y|Y|yes|Yes|YES) ;; *) exit 1;; esac;
    install -c -s shc $(INSTALL_PATH)/bin/
    install -c -m 644 shc.1 $(INSTALL_PATH)/man/man1/

clean:
    rm -f *.o *~ *.x.c

cleanall: clean
    rm -f shc *.x

Je ne sais pas comment corriger cette erreur. Quelqu'un peut-il aider?

5
user797940

cc est un alias pour le compilateur GNU C (gcc). Vous pouvez l'installer comme suit:

 Sudo apt install gcc

Si, pour une raison quelconque, le compilateur gcc est déjà installé, mais le lien symbolique /usr/bin/cc est manquant, vous pouvez également faire:

 make CC=gcc
6
Peter Selinger

Sudo apt install build-essential

Cela installera un compilateur C (fournissant la commande cc) ainsi que d'autres outils dont vous pourriez avoir besoin pour créer des logiciels à partir des sources.

2
Mark