Armenian Knowledge Base  

Go Back   Armenian Knowledge Base > Technical sections > Operating Systems > Unix
Register

Reply
 
LinkBack Thread Tools
Old 14.09.2002, 04:36   #1
Младенец
 
Join Date: 05 2002
Location: Yerevan
Posts: 40
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Post compiling perl scripts into executable

Lyuboy script, daje takoy prostoy:

#!/usr/bin/perl -w
print "Hallo tipa", "\n";

posle komandy perlcc porc.pl

--------------------------------------------------------------------------------
Compiling porc.pl:
--------------------------------------------------------------------------------
Making C(porc.pl.c) for porc.pl!
/usr/bin/perl -I/usr/lib/perl5/5.6.0/i386-linux -I/usr/lib/perl5/5.6.0 -I/usr/lib/perl5/site_perl/5.6.0/i386-linux -I/usr/lib/perl5/site_perl/5.6.0 -I/usr/lib/perl5/site_perl -I. -MB::Stash -c porc.pl
/usr/bin/perl -I/usr/lib/perl5/5.6.0/i386-linux -I/usr/lib/perl5/5.6.0 -I/usr/lib/perl5/site_perl/5.6.0/i386-linux -I/usr/lib/perl5/site_perl/5.6.0 -I/usr/lib/perl5/site_perl -I. -MO=C,-umain,-uattributes,-uDB porc.pl
Starting compile
Walking tree
Prescan
Saving methods
Bootstrap attributes porc.pl
Writing output
Loaded B
Loaded IO
Loaded Fcntl
porc.pl syntax OK
Compiling C(porc) for porc.pl!
/usr/bin/perl -I/usr/lib/perl5/5.6.0/i386-linux -I/usr/lib/perl5/5.6.0 -I/usr/lib/perl5/site_perl/5.6.0/i386-linux -I/usr/lib/perl5/site_perl/5.6.0 -I/usr/lib/perl5/site_perl -I. /tmp/porc.pl.tst
gcc -fno-strict-aliasing -I/usr/local/include -I/usr/lib/perl5/5.6.0/i386-linux/CORE -o porc porc.pl.c -L/usr/local/lib -L/usr/lib/perl5/5.6.0/i386-linux/CORE -lperl -lnsl -ldl -lm -lc -lcrypt /usr/lib/perl5/5.6.0/i386-linux/auto/IO/IO.so /usr/lib/perl5/5.6.0/i386-linux/auto/Fcntl/Fcntl.so
/tmp/cco0huXg.o: In function `xs_init':
/tmp/cco0huXg.o(.text+0x341d): undefined reference to `boot_DynaLoader'
collect2: ld returned 1 exit status
ERROR: In compiling code for porc.pl.c !
[[email protected] chat2]#

Odnako:
man perlcc
%prompt perlcc a.p -C a.c -gen # generates C code (into a.c) and
# stops without compile.

to est'

perlcc porc.pl -C yesiminch.c -gen

--------------------------------------------------------------------------------
Compiling porc.pl:
--------------------------------------------------------------------------------
Making C(porc.c) for porc.pl!
/usr/bin/perl -I/usr/lib/perl5/5.6.0/i386-linux -I/usr/lib/perl5/5.6.0 -I/usr/lib/perl5/site_perl/5.6.0/i386-linux -I/usr/lib/perl5/site_perl/5.6.0 -I/usr/lib/perl5/site_perl -I. -MB::Stash -c porc.pl
/usr/bin/perl -I/usr/lib/perl5/5.6.0/i386-linux -I/usr/lib/perl5/5.6.0 -I/usr/lib/perl5/site_perl/5.6.0/i386-linux -I/usr/lib/perl5/site_perl/5.6.0 -I/usr/lib/perl5/site_perl -I. -MO=C,-umain,-uattributes,-uDB porc.pl
Starting compile
Walking tree
Prescan
Saving methods
Bootstrap attributes porc.pl
Writing output
Loaded B
Loaded IO
Loaded Fcntl
porc.pl syntax OK
[[email protected] chat2]#
To est' perl v c perevoditsya without compile bez problem.
Oshibka pri kompilyacii lyubogo scripta imenno eta:
/tmp/cco0huXg.o(.text+0x341d): undefined reference to `boot_DynaLoader'
collect2: ld returned 1 exit status
ERROR: In compiling code for porc.pl.c !

Pls help!!!
__________________
http://www.hay.am
Reply With Quote
Old 14.09.2002, 06:02   #2
¡no pasaran!
 
dolphin's Avatar
 
Join Date: 03 2002
Location: localhost
Age: 35
Posts: 540
Downloads: 0
Uploads: 0
Reputation: 13 | 4
Question

stranno.. u menja vse ok.

A u tebja c/c++ progi voobsche kompilirujutsja?
Reply With Quote
Old 14.09.2002, 18:58   #3
Младенец
 
Join Date: 05 2002
Location: Yerevan
Posts: 40
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Post

Da?
Slush, davay ya na drugoy mashine poprobuyu, esli opyat' ne vyidet... poshlyu tebe ty skompil' i prishli mne executable, ok?
On vsego 10 kb vesit ))
A u tebya Mandrake???
Ya davno esh'e na Mandrake 8.2 bez problem kompilil... a budet li executable skompilirovannyj pod mandrake 8.2 rabotat' na redhat 7.2??? karogha library-mibrary problm lini?
pochemu net? doljen rabotat', ne tak???
Reply With Quote
Old 17.09.2002, 01:19   #4
Guru Apprentice
 
Join Date: 02 2002
Location: /dev/null
Age: 41
Posts: 524
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Post

To noch: light googling (Гооглинг если по русски ) нашел следующее:
Quote:
Since I upgraded to perl 5.6.0 my perlcc does not work anymore:

(output a little formatted to fit in 80 columns)

$ cat myprog.pl
print "Hello world\n";
$ perlcc myprog.pl
...
gcc -fno-strict-aliasing -I/opt/local/include \
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O \
-I/opt/local/stow/perl-5.6.0/lib/perl5/5.6.0/sun4-solaris/CORE \
-o myprog myprog.pl.c -L/opt/local/lib \
-L/opt/local/stow/perl-5.6.0/lib/perl5/5.6.0/sun4-solaris/CORE \
-lperl -lsocket -lnsl -lgdbm -ldl -lm -lc -lcrypt -lsec \
/opt/local/lib/perl5/5.6.0/sun4-solaris/auto/IO/IO.so \
/opt/local/lib/perl5/5.6.0/sun4-solaris/auto/Fcntl/Fcntl.so

Undefined first referenced
symbol in file
boot_DynaLoader /var/tmp/ccRvWEI0.o
ld: fatal: Symbol referencing errors. No output written to perlc16931
collect2: ld returned 1 exit status
ERROR: In compiling code for myprog.pl.c !

However, if I manually add the DynaLoader.a file to the gcc command
line, it works:

gcc -fno-strict-aliasing -I/opt/local/include \
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O \
-I/opt/local/stow/perl-5.6.0/lib/perl5/5.6.0/sun4-solaris/CORE \
-o myprog myprog.pl.c -L/opt/local/lib \
-L/opt/local/stow/perl-5.6.0/lib/perl5/5.6.0/sun4-solaris/CORE \
-lperl -lsocket -lnsl -lgdbm -ldl -lm -lc -lcrypt -lsec \
/opt/local/lib/perl5/5.6.0/sun4-solaris/auto/IO/IO.so \
/opt/local/lib/perl5/5.6.0/sun4-solaris/auto/Fcntl/Fcntl.so \
/opt/local/lib/perl5/5.6.0/sun4-solaris/auto/DynaLoader/DynaLoader.a

This compiles fine!
Там много еще чего написано, смотри http://groups.google.ie/groups?q=boo...Lant.be&rnum=1

В частности говорится что компилирование perlcc старым компилятором (из perl-5.005_03) работает нормально.
Reply With Quote
Old 17.09.2002, 05:36   #5
¡no pasaran!
 
dolphin's Avatar
 
Join Date: 03 2002
Location: localhost
Age: 35
Posts: 540
Downloads: 0
Uploads: 0
Reputation: 13 | 4
Post

Quote:
Originally posted by noch:
Da?
Slush, davay ya na drugoy mashine poprobuyu, esli opyat' ne vyidet... poshlyu tebe ty skompil' i prishli mne executable, ok?
On vsego 10 kb vesit ))
A u tebya Mandrake???
Ya davno esh'e na Mandrake 8.2 bez problem kompilil... a budet li executable skompilirovannyj pod mandrake 8.2 rabotat' na redhat 7.2??? karogha library-mibrary problm lini?
pochemu net? doljen rabotat', ne tak???
po idee doljen. shli.
Reply With Quote
Sponsored Links
Reply

Thread Tools


На правах рекламы:
реклама

All times are GMT. The time now is 22:16.


Powered by vBulletin® Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.