Please help with the step by step instructions on "How to compile tcl/ shell code"
(Need to hide original source code)
Please come out with answers considering the following queries
Tools need to accomplish that (Please suggest the best/simple one)
How to compile
How to run the compiled output file
Thanks
Activestate offers a product, the "Tcl Dev Kit" (TDK), which can be used to produce byte-compiled blobs and to otherwise prepare "compiled" applications written in Tcl (also known as "starpacks").
If you are running Linux you can use Freewrap to compile tcl. If your distribution doesn't have it in it's repository download it from http://sourceforge.net/projects/freewrap/ and just pass the name of your tcl script as the argument like this:
freewrap <name>.tcl
This should generate the file <name>, which you can run as any executable. See http://wiki.tcl.tk/855 for other options.
To compile shell scripts use shc. The tool can be downloaded from http://linux.softpedia.com/get/System/Shells/shc-18503.shtml and you compile your shell script with the command
shc -f <name>
This should output two files <name>.x and <name>.x.c. The former is the executable you want and the other is a C code file compiled from your original script that is used to generate the executable.
After almost a decade.
To compile .tcl script, you need TclKit and sdx. You can download them from TclKits: Downloads and Google Code Archive | Downloads. (I used one for RHEL5 x86_64 on Ubuntu.)
After making TclKit executable by
$ chmod +x tclkit-8.*.*-*-*
, the command
$ tclkit-8.*.*-*-* sdx-*.kit qwrap *.tcl
will compile a script file and generate *.kit file. To run it:
$ tclkit-8.*.*-*-* *.kit
Related
I am trying to run one of the example from Beej's Guide to Network Programming (https://beej.us/guide/bgnet/), specifically showip.c (The link to the program is here: https://beej.us/guide/bgnet/examples/showip.c). Using gcc, I've typed in
gcc -o showip showip.c
Then ran the program
showip www.example.net
and I get an error showip: command not found on the same directory where the code and the program is compiled at. I'm not sure why this is the case. I've even cloned the code from his GitHub and used makefile to compile the program and yet I'm getting the same error. What exactly am I doing it wrong here?
This is actually problem with how you're running the program.
On Linux systems (unlike Windows systems) an executable in the current directory is not by default searched by the shell for programs to run. If the given program does not contain a path element (i.e. there are no / characters in the name) then only the directories listed in the PATH environment variable are searched.
Since the current directory is not part of your PATH, prefix the command with the directory:
./showip www.example.net
Is the working directory on your path? Likely not.
Try ./showip
Since the program showip is not in your $PATH you have to tell
your shell that it's in the current directory:
./showip
Or add the current directory to your $PATH but it's a less secure
option:
PATH=:$PATH
or
PATH=.:$PATH
and run it as you're trying now:
showip
I'm currently trying to use Gcov and Gcovr from CMake on Windows using MinGW.
Compiling the files with the right flags works like a charm.
However, CLion uses an out-of-source build which Gcov does not understand.
On Linux I used the following to copy all the *.gcda and *.gcno to the CMAKE_SOURCE_DIR from CMAKE_BINARY_DIR subfolders:
set(GCOV_DATA_DIR "${CMAKE_SOURCE_DIR}/gcov_data")
add_custom_target(prepare_coverage
# Copy necessary files to CMAKE_SOURCE_DIR
COMMAND ${CMAKE_COMMAND} -E make_directory ${GCOV_DATA_DIR}
COMMAND find ${CMAKE_BINARY_DIR} -name \"*.gcda\" -o -name \"*.gcno\" | xargs -l -i cp {} "${GCOV_DATA_DIR}"
)
Note that test binaries are executed in CMAKE_BINARY_DIR.
This works pretty well and I can call Gcovr with some additional flags afterwards to get a nice report.
However, on Windows I do not have xargs (I was already supprised that find did work).
To make this CMake command platform-independent I'm looking for a way to make CMake find and copy/move the files during build time (similar to making the directory).
Can anyone tell me if this is possible and how I should do this?
Of course I can always install additional programs or scripts, but I'd rather solve this within CMake instead of having to instruct all the developers to install different tools.
If you don't use CMAKE_RUNTIME_OUTPUT_PATH in your project, then .gcda and .gcno files are created in the directory with executable, so you may compute this directory with $<TARGET_FILE_DIR:tgt> generator-expression.
Because you know names of source files, you may compute absolute paths of all gcov-related files, and generate appropriate copiing commands without find.
Another approach could be writting xargs-like program/script by yourself, shipping it with your project, and using it in COMMAND. So
... but I'd rather solve this within CMake instead of having to instruct all the developers to install different tools.
wouldn't be a problem.
Hi this question seems to be answered but answers don't resolve my problem.
I try to include lua script into executable by copying it into exe
copy -b a.exe+test.lua output.exe
but when i launch output.exe luaL_dofile() cannot find lua script.
I dont want to use any third party apps to achieve this.
Copying files seems to work because Love2D projects works and I copy files in the same way but i treats them as zip archive (for sake of file hierarchy).
You can append a Lua script to your .exe but you'll need some way to load it into your program. The main problem is how to find the Lua script at the end of the .exe. srlua appends a small signature that contains the size of the Lua script so that the program can read the script at the right offset in the .exe file. Fortunately, the Lua API provides a function to load scripts from arbitrary sources. The convenience function luaL_dofile uses that function. You can use the same technique in your own program.
I'm trying to have CMake either run three bash commands or a bash script. However, I can't seem to get it to work.
The bash commands are:
cd ${CMAKE_SOURCE_DIR}/dependencies/library
make
cd ${CMAKE_BINARY_DIR}
Essentially, I would like CMake to build the library in that directory if it does not already exist.
Here's the CMake code I tried:
if(NOT "${CMAKE_SOURCE_DIR}/dependencies/library/lib.o")
execute_process(COMMAND cd ${CMAKE_SOURCE_DIR}/dependencies/library)
execute_process(COMMAND make)
execute_process(COMMAND cd ${CMAKE_BINARY_DIR})
endif(NOT "${CMAKE_SOURCE_DIR}/dependencies/library/lib.o")
However, it's not building anything. What am I doing wrong?
Also, while I'm here asking this: should the third command, to move to the binary folder, be included?
Thanks!
execute_process() is executed during configure time. But you want this to run at build time, thus add_custom_command() and add_custom_target() is what you're looking for.
In this special case you want to generate an output file, so you should go for add_custom_command() (both are essentially the same, but command produces one or multiple output files, while target does not.
The cmake snippet for this should look something like the following:
add_custom_command(
OUTPUT ${CMAKE_SOURCE_DIR}/dependencies/library/lib.o
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/dependencies/library
COMMAND make
)
You then have to add the output file in another target as dependency, and everything should (hopefully) work as expected.
You can also add DEPENDS statements to the add_custom_command() call to rebuild the object file in case some input sources have changed.
I have a script which was origionally made for Linux, but adapted to run with Cygwin in windows, and if you already have the executables (sh, cp, mv, etc.) then you can run it without Cygwin. The only problem is that the script also uses a few hundred (yes hundreds) of other executables. Is there any way I can compile this script into a regular executable and pack these other supporting files in as resources?
The script is ~1600 lines long which is probably too long to confortably re-implement by hand in C++. I am looking to compile the script into something which windows can execute without having to make edits to the path to include a bunch of third party executables. A way to contain all this.
I doubt that the solution you have in mind is feasible.
Instead, I'd modify the script so that the first thing it does is figure out where all those hundreds of executables are. Then either set $PATH appropriately, or invoke each one by its full pathname.
Or you can have an installer that installs the executables in a specified or user-chosen location, then re-generates the script (from an input file) so it knows where the executables are. Ship with the-script.in, then have the installer perform textual substitutions to generate the-script from the-script.in.
I point out:
RPM and SHC
as a possible solution for your problem. Maybe this tools helps you to do the job.
Using SHC to Cygwin is possible to compile bash to exe
Ok. Realy old, but I was looking for it and decide to do my self and make it public.
http://goo.gl/M1NSY
Use ports of the required utils and use some application virtualization tool to package it all up. Cameyo is a free one. Forget Cygwin, that thing is huuuge :)