Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

executable files from perl

Status
Not open for further replies.

m4trix

Vendor
Jul 31, 2002
84
CA
I'm on WinXP, and the windows version of perl seems to work fine for me. However, I can't seem to compile my scripts into executables. I've tried using perlcc, and spend quite a long time reading up on it, but it's no use. Would someone mind going over the usage for me? I don't know if it matters that I'm on windows and not a unix-like os
 
Hi m4trix,

I think you need a c or c++ compiler on the system before you can compile under perlcc. Also, you would need all the perl modules that would satisfy the perlcc dependencies.

I am running window XP and I have activestate perl installed on drive D. On my system perlcc.bat is found at:

d:\perl\bin\perlcc.bat

I do not current have c or c++ installed on my windows XP box, so I can't test it. I have used perlcc to compile perl script on my linux box and it works in cases where the scripts do not have do may other module dependencies. I especially would like to compile some perl scripts that use the postgres DBD::pg driver; however, I have not been successful in compiling this, probably because I would also need to compile Pg.pm and Posix.pm and other modules.

Most all of my other perl scripts have compiled OK and they run much faster after being compiled, especially in a web site setting.


Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox
 
Leland,

I'm just reading up on the new(ish) Perl compiler stuff myself.

What version and build of Perl are you using?

What problems are you seeing compiling the DBI scripts?

Just FYI, I got interested in this again because the current ActiveState download details on the compiler backend doesn't seem to have the dire warnings. It still has some, mind you. Mike
________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Hi Mike,

The following is the result of:


perl -V


Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
Platform:
osname=linux, osvers=2.4.17-0.13smp, archname=i386-linux
uname='linux daffy.perf.redhat.com 2.4.17-0.13smp #1 smp fri feb 1 10:30:48 est 2002 i686 unknown '
config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dcccdlflags=-fPIC -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Uusethreads -Uuseithreads -Uuselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Di_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
Compiler:
cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include',
optimize='-O2 -march=i386 -mcpu=i686',
cppflags='-fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.2 2.96-109)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldl -lm -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'

Characteristics of this binary (from libperl):
Compile-time options:
Built under linux
Compiled at Apr 1 2002 12:23:22
@INC:
/usr/lib/perl5/5.6.1/i386-linux
/usr/lib/perl5/5.6.1
/usr/lib/perl5/site_perl/5.6.1/i386-linux
/usr/lib/perl5/site_perl/5.6.1
/usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.6.1/i386-linux
/usr/lib/perl5/vendor_perl/5.6.1
/usr/lib/perl5/vendor_perl
.


The following is the result of:


perlcc -o cc_ver.cgi cc_ver.pl

/tmp/ccTXdzg.o: In function `dl_init'
/tmp/ccTXdzg.o(.text+0x100abc): undefined reference to `boot_DBI'
/tmp/ccTXdzg.o(.test+0x100b72): undefined reference to `boot_DBI__pg'
collet2: ld return 1 exit status

Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox
 
Hi Mike,

One other thing. It takes 10 or 15 minutes for the perlcc command to finish executing. I would imagine that most of that time is used parsing the perl source into C source. Once this is done, I wouldn't think it would take long for the gcc compiler to build the executable binary from the c source.

Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox
 
I have the luxury of using PerlApp on an NT machine. PerlApp is part of the activeState Perl Developer's Kit (which my employer purchased, otherwise I would not have it.) PerlApp works well and, so far, the executables have worked on all Win OS'es from 98 forward. I have not tested them extensively on all Service Packs and such.......but, I have tried most of my executables on 98, NT, 2000, and XP and they have worked.

'Costs money, but it works. 'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Ok, here's what happens. Just as a test, I created the most simple perl script I could think of:
print "Hello World";
and saved it as script.pl

To compile it into an executable file, I've tried many commands, from
perlcc script.pl to perlcc -o script.exe script.pl
and every time I get this:
Note (probably harmless): No library found for 'oldnames.lib'
Note (probably harmless): No library found for 'kernel32.lib'
Note (probably harmless): No library found for 'user32.lib'
Note (probably harmless): No library found for 'gdi32.lib'
Note (probably harmless): No library found for 'winspool.lib'
Note (probably harmless): No library found for 'comdlg32.lib'
Note (probably harmless): No library found for 'advapi32.lib'
Note (probably harmless): No library found for 'shell32.lib'
Note (probably harmless): No library found for 'ole32.lib'
Note (probably harmless): No library found for 'oleaut32.lib'
Note (probably harmless): No library found for 'netapi32.lib'
Note (probably harmless): No library found for 'uuid.lib'
Note (probably harmless): No library found for 'wsock32.lib'
Note (probably harmless): No library found for 'mpr.lib'
Note (probably harmless): No library found for 'winmm.lib'
Note (probably harmless): No library found for 'version.lib'
Note (probably harmless): No library found for 'odbc32.lib'
Note (probably harmless): No library found for 'odbccp32.lib'
Note (probably harmless): No library found for 'msvcrt.lib'
'cl' is not recognized as an internal or external command,
operable program or batch file.

and then it exits to the command line again... I have a free C compiler on here, called DJGPP, and it works for every C script I've ever written (all of which are simple)
so I dunno. I don't know much about libraries (yet) so all those .lib files mean nothing to me.
 
Hi m4trix,

You can do a search for some of these lib files to see whether they exist on your system or not. If the exist on your system, you might try setting up a path statement to them, so perlcc.bat can find them. If they do not exist, you will probably need to install them. Sorry I can't be of more help, but I've never set up perlcc.bat with different compiler in a windows environment. Maybe someone else will read this post and help.

Also, you could open up perlcc.bat to take a look for clues as to what it does to perform the conversion of perl source to c source, etc.





Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox
 
Thanks Leland :)

oh and "Nothing runs like the fox" ..... except Perl maybe :) Mike
________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top