WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to install SHC (shell script compiler)  (Read 342 times)

Offline malikawan

  • Full Member
  • ***
  • Posts: 238
    • Learn Linux
How to install SHC (shell script compiler)
« on: October 10, 2017, 01:47:13 AM »
I have compile shc with out any error  :D but when i convert my shell script with shc to binary it gives me error xxx.sh.x: applet not found  :-[
Please any idea about that.

Thanks
Regards
Malik Awan
« Last Edit: October 10, 2017, 01:52:45 AM by malikawan »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 9636
Re: How to install SHC (shell script compiler)
« Reply #1 on: October 10, 2017, 02:11:11 AM »
what does "ldd yourshellscriptbinary" give?

Offline Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 5498
Re: How to install SHC (shell script compiler)
« Reply #2 on: October 10, 2017, 06:20:41 AM »
Hi malikawan
... it gives me error xxx.sh.x: applet not found ...
You're not clear if the error occurs while converting your script or if it occurs when running the executable that was created.

sch  requires a compiler in order to run, so  compiletc.tcz  should be installed.

The output from  shc  is not an independent binary. It still relies on the shell scripting language specified on the first line
of your script. So if the first line of your script reads:
Code: [Select]
#!/bin/bashthen your executable will expect to find  /bin/bash.

Offline polikuo

  • Sr. Member
  • ****
  • Posts: 251
Re: How to install SHC (shell script compiler)
« Reply #3 on: October 22, 2017, 06:42:39 PM »
I believe it's a busybox issue.
In the C code it generated:

Code: [Select]
.....

#define BUSYBOXON 0 /* Define as 1 to enable work with busybox */

.....

#if BUSYBOXON
varg[j++] = "busybox";
varg[j++] = "sh";
#else
varg[j++] = argv[0]; /* My own name at execution */
#endif

.....

You'll need to enable busybox.

Code: [Select]
tc@box:/tmp/hello$ shc -B -f hello.sh -o hello
tc@box:/tmp/hello$ ./hello
Hello world!

I don't really see the benefit of it though, the binaries are bigger than their original source scripts.  :o
« Last Edit: October 22, 2017, 06:48:04 PM by polikuo »

Offline Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 5498
Re: How to install SHC (shell script compiler)
« Reply #4 on: October 22, 2017, 07:21:03 PM »
Hi polikuo
Quote
I don't really see the benefit of it though, the binaries are bigger than their original source scripts.

From what I could tell, it lets you hide a scripts contents and prevent modification. Aside from larger binaries, they would not
run any faster since they are still being passed through the shell interpreter.

Offline polikuo

  • Sr. Member
  • ****
  • Posts: 251
Re: How to install SHC (shell script compiler)
« Reply #5 on: October 23, 2017, 01:24:31 AM »
From what I could tell, it lets you hide a scripts contents and prevent modification. Aside from larger binaries, they would not
run any faster since they are still being passed through the shell interpreter.

Oh!  :o
That could come in handy some day.
I just read the manual:
Quote
shc's main purpose is to protect your shell scripts from modification or inspection. You can use it if you wish to distribute your scripts but don't want them to be easily readable by other people.

BTW, the manual also states that one can set an expiration date.  :o
Quote
If you supply an expiration date with the -e option, the compiled binary will refuse to run after the date specified. The message Please contact your provider will be displayed instead. This message can be changed with the -m option.

Never jump to conclusions.  :P

Offline Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 5498
Re: How to install SHC (shell script compiler)
« Reply #6 on: October 23, 2017, 05:54:10 AM »
Hi polikuo
Quote
BTW, the manual also states that one can set an expiration date.
Forgot about that, but it was 2 weeks ago that I glanced through the manual and my memory isn't what it used to be. ::)