[问题]SHC怎么不能运行在UBUNTU啊?

sh/bash/dash/ksh/zsh等Shell脚本
回复
kismet
帖子: 16
注册时间: 2006-01-11 17:37

[问题]SHC怎么不能运行在UBUNTU啊?

#1

帖子 kismet » 2008-01-23 19:06

提问: SHC怎么不能运行在UBUNTU啊?

问题描述: 我的操作过程是这样的,首选sudo apt-get install shc
然后用shc -r -f XXX.sh 最后却怎么都运行不了xxx.sh.x.c有那位高手指教啊!
头像
iblicf
帖子: 3766
注册时间: 2007-01-15 17:15

#2

帖子 iblicf » 2008-01-23 19:30

代码: 全选

example% shc -v -r -T -f myscript
我还要感谢你呢,,我都不知道有这种东西 ,,:)
.c 当然不能运行了,c 的源文件,, xx.sh.x 是 bin 文件,可以执行
aBiNg
帖子: 1331
注册时间: 2006-07-09 12:22
来自: 南京

#3

帖子 aBiNg » 2008-01-23 19:33

代码: 全选

It's function really isn't a compiler: instead, it encrypts the shell script, and puts a C wrapper around it that, when run, decrypts the script and calls the requested shell for execution. Therefore, you must have a shebang line (#!/bin/sh or whatever). That also means it isn't limited to shell scripts: you can "compile" a Perl script just as easily.
the "script.x" is your executable and the ".c" is the source code.
kismet
帖子: 16
注册时间: 2006-01-11 17:37

#4

帖子 kismet » 2008-01-23 19:44

但是只生成一个.x.c的文件没有.x的文件啊,是怎么会事呢?
头像
iblicf
帖子: 3766
注册时间: 2007-01-15 17:15

#5

帖子 iblicf » 2008-01-23 19:51

戴上眼镜,打开台灯
kismet
帖子: 16
注册时间: 2006-01-11 17:37

#6

帖子 kismet » 2008-01-23 20:05

kismet@SerVer:~$ sudo shc -v -T -r -f kk
shc shll=sh
shc [-i]=-c
shc [-x]=exec '%s' "$@"
shc [-l]=
shc opts=
shc: cc kk.x.c -o kk.x
kk.x.c:103:22: error: sys/stat.h: No such file or directory
kk.x.c:104:23: error: sys/types.h: No such file or directory
kk.x.c:106:19: error: errno.h: No such file or directory
kk.x.c:107:19: error: stdio.h: No such file or directory
kk.x.c:108:20: error: stdlib.h: No such file or directory
kk.x.c:109:20: error: string.h: No such file or directory
kk.x.c:110:18: error: time.h: No such file or directory
kk.x.c:111:20: error: unistd.h: No such file or directory
kk.x.c: In function 'key_with_file':
kk.x.c:173: error: array type has incomplete element type
kk.x.c:174: error: array type has incomplete element type
kk.x.c:180: warning: incompatible implicit declaration of built-in function 'memset'
kk.x.c: In function 'chkenv':
kk.x.c:225: warning: incompatible implicit declaration of built-in function 'sprintf'
kk.x.c:226: warning: assignment makes pointer from integer without a cast
kk.x.c:230: warning: incompatible implicit declaration of built-in function 'strlen'
kk.x.c:234: warning: incompatible implicit declaration of built-in function 'strdup'
kk.x.c:237: warning: incompatible implicit declaration of built-in function 'sscanf'
kk.x.c: In function 'xsh':
kk.x.c:305: error: 'time_t' undeclared (first use in this function)
kk.x.c:305: error: (Each undeclared identifier is reported only once
kk.x.c:305: error: for each function it appears in.)
kk.x.c:305: error: expected expression before ')' token
kk.x.c:306: error: expected expression before ')' token
kk.x.c:321: warning: incompatible implicit declaration of built-in function 'calloc'
kk.x.c:337: warning: incompatible implicit declaration of built-in function 'malloc'
kk.x.c:340: warning: incompatible implicit declaration of built-in function 'memset'
kk.x.c:341: warning: incompatible implicit declaration of built-in function 'memcpy'
kk.x.c:347: warning: incompatible implicit declaration of built-in function 'malloc'
kk.x.c:350: warning: incompatible implicit declaration of built-in function 'sprintf'
kk.x.c: In function 'main':
kk.x.c:384: warning: incompatible implicit declaration of built-in function 'fprintf'
kk.x.c:384: error: 'stderr' undeclared (first use in this function)
kk.x.c:385: error: 'errno' undeclared (first use in this function)
shc: Success
kismet
帖子: 16
注册时间: 2006-01-11 17:37

#7

帖子 kismet » 2008-01-23 20:25

呵呵,搞定!原来我没有安装gcc..呵呵,感谢二楼的大大
回复