1753816 Members
8065 Online
108805 Solutions
New Discussion юеВ

Re: shc doesn't work

 
SOLVED
Go to solution
chuanpeng.wang
Frequent Advisor

shc doesn't work

I try compile a script to binary file with shc.
But shc doesn't work on my server.
I have installed HP C/aC++ Compiler on the server.
Is there other compiler needed?
The version of shc is 3.8.6.

# ll
total 336
-rw-r--r-- 1 501 501 3549 Jul 10 2006 CHANGES
-rw-r----- 1 501 501 17982 May 10 1996 Copying
-rw-r----- 1 501 501 1525 Jun 16 2005 Makefile
-rwxr-x--- 1 501 501 336 Feb 22 2003 match
-rwxr-x--- 1 501 501 155 Jun 20 2003 pru.sh
-rwxr-xr-x 1 501 501 39767 Jul 10 2006 shc
-rw-r----- 1 501 501 3136 Jul 8 2004 shc.1
-rw-r----- 1 501 501 1544 Jun 19 2003 shc.README
-rw-r----- 1 501 501 24715 Jul 10 2006 shc.c
-rw-r----- 1 501 501 4558 Jul 8 2004 shc.html
-rwxr-xr-x 1 501 501 138 Nov 13 2004 test.bash
-rwxr-x--- 1 501 501 52 Jun 20 2003 test.csh

# make
*** ┬┐Do you want to probe shc with a test script?
*** Please try... make test

# make test
*** Compiling script "match"
CFLAGS="-Wall -O6 -pedantic" ./shc -v -f matchjavascript:postMessageSubmit('submit');
/usr/bin/sh: ./shc: Execute permission denied.
*** Error exit code 1

Stop.

16 REPLIES 16
Gokul Chandola
Trusted Contributor

Re: shc doesn't work

Hi,
There is permission denied.
Please provide the the process to execute, it will better if you can give chmod 777. Then you try further.

Regards,
Gokul Chandola
There is always some scope for improvment.
Dennis Handly
Acclaimed Contributor

Re: shc doesn't work

>Gokul: There is permission denied. it will better if you can give chmod 777.

There is no permission problem. It already is executable: -rwxr-xr-x shc
You should never use 777, at most use "chmod a+x".

Try "file shc". This is probably an executable for IPF (if on PA) or some foreign devil machine.

Deepak Kr
Respected Contributor

Re: shc doesn't work

>> /usr/bin/sh: ./shc: Execute permission denied

provide following:


which shc

ll path to shc

after install shc should have 755...
"There is always some scope for improvement"
chuanpeng.wang
Frequent Advisor

Re: shc doesn't work

I try make test on both PA and IA servers.
The error is identical.

# file shc
shc: ELF-32 executable object file

# which shc
no shc in /usr/sbin /usr/bin /usr/ccs/bin /usr/contrib/bin /usr/contrib/Q4/bin /opt/perl/bin /opt/ipf/bin /opt/hparray/bin /opt/nettladm/bin /opt/fcms/bin /usr/bin/X11 /opt/resmon/bin /opt/perf/bin /usr/contrib/kwdb/bin /opt/wbem/bin /opt/wbem/sbin /opt/graphics/common/bin /opt/prm/bin /opt/sfm/bin /opt/upgrade/bin /opt/wlm/bin /opt/sas/bin /opt/sec_mgmt/bastille/bin /opt/dsau/bin /opt/dsau/sbin /opt/firefox /opt/gnome/bin /opt/mozilla /opt/perl_32/bin /opt/perl_64/bin /opt/sec_mgmt/spc/bin /opt/ssh/bin /opt/swa/bin /opt/hpsmh/bin /opt/thunderbird /opt/gwlm/bin /usr/contrib/bin/X11 /opt/ignite/bin /opt/langtools/bin /opt/omni/bin /opt/omni/sbin /opt/omni/lbin /opt/hpnpl//bin /opt/cfg2html /opt/caliper/bin /tmp/tmp/tmp /opt/mx/bin /opt/aCC/bin /opt/sanmgr/commandview/client/sbin /sbin /home/root
chuanpeng.wang
Frequent Advisor

Re: shc doesn't work

I have installed gcc on the server, the server is rp4440, OS is 11iv1

#make cleanall
rm -f *.o *~ *.x.c
rm -f shc *.x

#make test
/opt/hp-gcc/bin/gcc -Wall -O6 -pedantic shc.c -o shc
*** Compiling script "match"
CFLAGS="-Wall -O6 -pedantic" ./shc -v -f match
shc shll=sh
shc [-i]=-c
shc [-x]=exec '%s' "$@"
shc [-l]=
shc opts=
shc: /opt/hp-gcc/bin/gcc -Wall -O6 -pedantic match.x.c -o match.x
match.x.c:105: warning: string length '931' is greater than the length '509' ISO C90 compilers are required to support
match.x.c: In function 'untraceable':
match.x.c:286: error: too few arguments to function 'ptrace'
./shc: Error 0
*** Error exit code
Stop.
Dennis Handly
Acclaimed Contributor

Re: shc doesn't work

>I try make test on both PA and IA servers.
>The error is identical.
># file shc
>shc: ELF-32 executable object file

This should work fine but only on IPF.
Since shc is small, could you attach it to your reply?
chuanpeng.wang
Frequent Advisor

Re: shc doesn't work

Hi Dennis

These are the files.
Dennis Handly
Acclaimed Contributor

Re: shc doesn't work

>>shc: ELF-32 executable object file

>This should work fine but only on IPF.

Oops, didn't look close enough. This is from some foreign devil machine, most likely x86 linux. HP-UX IPF has:
/usr/bin/ksh: ELF-32 executable object file - IA64

elfdump doesn't like it either:
$ elfdump -f shc
*** ELF Header ***
Class: ELF-32
Data: Little-endian
OS: 0
ABI Version: 0
Type: EXEC
elfdump: Bad machine: 3 (elfdumperr 3004)

You need to remove shc, then make it.
chuanpeng.wang
Frequent Advisor

Re: shc doesn't work

The server is Rx7640, OS is 11.23.
I have remove shc.

# make cleanall
rm -f *.o *~ *.x.c
rm -f shc *.x

# make test
cc -Wall -O6 -pedantic shc.c -o shc
cc: error 1914: bad form for `-W' option
*** Error exit code 1

Stop.

# ll
total 256
-rw-r--r-- 1 501 501 3549 Jul 10 2006 CHANGES
-rw-r----- 1 501 501 17982 May 10 1996 Copying
-rw-r----- 1 501 501 1525 Jun 16 2005 Makefile
-rwxr-x--- 1 501 501 336 Feb 22 2003 match
-rwxr-x--- 1 501 501 155 Jun 20 2003 pru.sh
-rw-r----- 1 501 501 3136 Jul 8 2004 shc.1
-rw-r----- 1 501 501 1544 Jun 19 2003 shc.README
-rw-r----- 1 501 501 24715 Jul 10 2006 shc.c
-rw-r----- 1 501 501 4558 Jul 8 2004 shc.html
-rwxr-xr-x 1 501 501 138 Nov 13 2004 test.bash
-rwxr-x--- 1 501 501 52 Jun 20 2003 test.csh