Solved

Clarification for perlcc installation

Posted on 2004-09-16
10
1,059 Views
Last Modified: 2008-03-17
hello experts,
I need some clarification for installing perlcc on my windows. I am using cygwin and found this page but I am not very sure about the steps:
http://www.perldoc.com/perl5.6/README.cygwin.html

Just tell me I am doing it correctly or not.
1. download the zipped packag and unzip to <PERL_DIR>
2. run configure
3. run make
0
Comment
Question by:jhshukla
  • 5
  • 4
10 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 12079802
Don't bother with perlcc.

Found in /usr/lib/perl5/5.8.0/pod/perlfaq3.pod
       How can I compile my Perl program into byte code or C?

       Malcolm Beattie has written a multifunction backend compiler, available
       from CPAN, that can do both these things.  It is included in the
       perl5.005 release, but is still considered experimental.  This means
       it's fun to play with if you're a programmer but not really for people
       looking for turn-key solutions.

       Merely compiling into C does not in and of itself guarantee that your
       code will run very much faster.  That's because except for lucky cases
       where a lot of native type inferencing is possible, the normal Perl
       run-time system is still present and so your program will take just as
       long to run and be just as big.  Most programs save little more than
       compilation time, leaving execution no more than 10-30% faster.  A few
       rare programs actually benefit significantly (even running several
       times faster), but this takes some tweaking of your code.

       You'll probably be astonished to learn that the current version of the
       compiler generates a compiled form of your script whose executable is
       just as big as the original perl executable, and then some.  That's
       because as currently written, all programs are prepared for a full
       eval() statement.  You can tremendously reduce this cost by building a
       shared libperl.so library and linking against that.  See the INSTALL
       podfile in the Perl source distribution for details.  If you link your
       main perl binary with this, it will make it minuscule.  For example, on
       one author's system, /usr/bin/perl is only 11k in size!

       In general, the compiler will do nothing to make a Perl program
       smaller, faster, more portable, or more secure.  In fact, it can make
       your situation worse.  The executable will be bigger, your VM system
       may take longer to load the whole thing, the binary is fragile and hard
       to fix, and compilation never stopped software piracy in the form of
       crackers, viruses, or bootleggers.  The real advantage of the compiler
       is merely packaging, and once you see the size of what it makes (well,
       unless you use a shared libperl.so), you'll probably want a complete
       Perl install anyway.

Use PAR instead

http://par.perl.org/
0
 
LVL 9

Author Comment

by:jhshukla
ID: 12080638
well, thanks for all the explanation about workings of of CPAN but I really need to translate from Perl to C. The reason is that I have a piece of Perl code connecting to a device driver. and another piece of code in C and I have to write the rest of it. Then I have to put it all together of it and it should work. Since I am more comfortable with C/C++ I want to port the code to C/C++. So what do you recommend - perlcc or CPAN? I don't want the executable, I *need* the source code.

I don't remember where I read this but it said that it is possible to insert Perl code into a C program. That would be absolutely amazing! but then don't we need a Perl interpreter on the machine? (The final binaries will go on a handheld.)

Thanks
0
 
LVL 48

Expert Comment

by:Tintin
ID: 12080728
perlcc like all the other Perl compilers I know of, essentially embed a copy of Perl in the executable, so you aren't getting a true Perl2C conversion.

The best way, really would be to rewrite the code from scratch.  Is it very big?
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 9

Author Comment

by:jhshukla
ID: 12080946
it is five files of ~200 lines of code (stripped of comments) and I know that it would end up at around 2500-3500 and I need results in 2-3 days!
well I actually dloaded Active Perl 5.8.4 a few minutes ago and its is complaining! Here's is the error causing line and the compiler output.

...
use Device::SerialPort;
...


C:\.....\ >perlcc -c nmea.pl
C:\ActivePerl-5.8.4.810\Perl\bin/perlcc.bat: nmea.pl did not compile:
Can't locate Device/SerialPort.pm in @INC (@INC contains: C:/ActivePerl-5.8.4.810/Perl/lib C:/ActivePerl-5.8.4.810/Perl/site/lib . C:/ActivePerl-5.8.4.810/Perl/lib C:/ActivePerl-5.8.4.810/Perl/site/lib .) at nmea.pl line 22.
 BEGIN failed--compilation aborted at nmea.pl line 22.

thanks
0
 
LVL 48

Expert Comment

by:Tintin
ID: 12081097
perlcc was and still is considered to be experimental and not guaranteed to work.
0
 
LVL 6

Assisted Solution

by:holli
holli earned 20 total points
ID: 12081948
you will need to install the module Devcice-SerialPort.

0
 
LVL 9

Author Comment

by:jhshukla
ID: 12084234
@holli
how?
0
 
LVL 48

Accepted Solution

by:
Tintin earned 20 total points
ID: 12090997
ppm install Device::SerialPort

That assumes it is available on ActiveState.
0
 
LVL 9

Author Comment

by:jhshukla
ID: 12091553
what directory must I be in?
0
 
LVL 9

Author Comment

by:jhshukla
ID: 12091560
never mind
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now