perlcc - generate executables from Perl programs
perlcc hello # Compiles into executable 'a.out' perlcc -o hello hello.pl # Compiles into executable 'hello' perlcc -O file # Compiles using the optimised CC backend perlcc -Wb=-O2 file # Compiles with C, using -O2 optimizations perlcc -B file # Compiles using the bytecode backend perlcc -B -m file.pm # Compiles a module to file.pmc perlcc -c file # Creates a C file, 'file.c' perlcc -S -o hello file # Creates a C file, 'file.c', # then compiles it to executable 'hello' perlcc -c out.c file # Creates a C file, 'out.c' from 'file' perlcc --staticxs -r -o hello hello.pl # Compiles,links and runs with # XS modules static/dynaloaded perlcc -e 'print q//' # Compiles a one-liner into 'a.out' perlcc -c -e 'print q//' # Creates a C file 'a.out.c' perlcc -I /foo hello # extra headers (notice the space after -I) perlcc -L /foo hello # extra libraries (notice the space after -L) perlcc -r hello # compiles 'hello' into 'a.out', runs 'a.out'. perlcc -r hello a b c # compiles 'hello' into 'a.out', runs 'a.out'. # with arguments 'a b c' perlcc hello -log c.log # compiles 'hello' into 'a.out' logs compile # log into 'c.log'. perlcc -h # help, only SYNOPSIS perlcc -v 2 -h # verbose help, also DESCRIPTION and OPTIONS
perlcc creates standalone executables from Perl programs, using the code generators provided by the B module. At present, you may either create executable Perl bytecode, using the
-B option, or generate and compile C files using the standard and 'optimised' C backends.
The code generated in this way is not guaranteed to work. The whole codegen suite (
perlcc included) should be considered very experimental. Use for production purposes is strongly discouraged.
Adds the given directories to the library search path when C code is passed to your C compiler.
Adds the given directories to the include file search path when C code is passed to your C compiler; when using the Perl bytecode option, adds the given directories to Perl's include path.
Specifies the file name for the final compiled executable.
Create C code only; do not compile to a standalone binary.
Compile a one-liner, much the same as
perl -e '...'
"Keep source". Do not delete generated C code after compilation.
Use the Perl bytecode code generator.
Use the 'optimised' C code generator B::CC. This is more experimental than everything else put together, and the code created is not guaranteed to compile in finite time and memory, or indeed, at all.
Pass the numeric optimisation option to the compiler backend. Shortcut for
This does not enforce B::CC.
Set verbosity of output from 0 to max. 6.
Run the resulting compiled script after compiling it.
Log the output of compiling to a file rather than to stdout.
Pass the options to the compiler backend, such as --Wb=-O2,-v
Pass comma-seperated options to cc.
Pass comma-seperated options to ld.
run the backend using perl -T or -t
Add package(s) to compiler and force linking to it.
Skip package(s). Do not compile and link.
Detect external packages automatically via B::Stash
Link to static libperl.a
Link to static XS if available. If the XS libs are only available as shared libs link to those ("prelink").
Systems without rpath (windows, cygwin) must be extend LD_LIBRARY_PATH/PATH at run-time. Together with -static, purely static modules and no run-time eval or require this will gain no external dependencies.
Link to shared libperl
Link shared XSUBs if the linker supports it. No DynaLoader needed. This will still require the shared XSUB libraries to be installed at the client, modification of @INC in the source is probably required. (Not yet implemented)
Create a module, resp. a shared library. Currently only enabled for Bytecode and CC. (not yet tested)
perlcc -r --testsuite t/harness
Benchmark the different phases c (B::* compilation), cc (cc compile + link), and r (runtime).
Do not spawn subprocesses for compilation, because broken shells might not be able to kill its children.