| 導購 | 订阅 | 在线投稿
分享
 
 
當前位置: 王朝網路 >> perl >> Perl/TkFAQ-6.如何編譯安裝
 

Perl/TkFAQ-6.如何編譯安裝

2008-05-18 21:55:30  編輯來源:互聯網  简体版  手機版  評論  字體: ||
 
 
  原文:

  6. How do I build it?

  Assuming you are not running a binary distribution then, in general, building perl/Tk requires:

  1. A made & installed perl (requires a C language compiler). You may need different versions of perl depending on which version of Tk you wish to run.

  2. A C language compiler for the Tk code itself.

  3. A linkable Xlib (.o, .so, .a, etc.) for X-windows.

  Perl/Tk has been successfully built using various vendors' cc compilers, as well as with the free GNU gcc compiler. A make utility of some sort (make/gmake) will be extremely helpful.

  [OBSOLETE] Step - by - step the commands to build the Tk extension to Perl are (for the dynamically linked version) roughly as follows:

  1. make install # the appropriate version of perl.

  2. uninstall # prior versions of the Tk extension to perl.

  3. gunzip -c Tk400.*.tar.gz | tar xvf - (tar options may vary esp. on SysV)

  4. cd Tk400.*

  5. read INSTALL

  6. perl Makefile.PL

  7. make

  8. make test

  9. make install

  For the statically linked version you would `make tkperl` just after executing the `make` step and before the `make test` step.

  Note carefully that this process leaves behind a large amount of documentation and examples in various sub-directories. You are strongly encouraged to look carefully through your build tree for docs, examples, etc. and keep those valuable files in a safe place. You might consider tar-ing them off and installing in a webserver directory tree.

  A relatively easy way to determine if the perl on your system allows for dynamic linking was mentioned by Kenneth Albanowski <kjahds@kjahds.com>. If any of the following does not say "dl_none.xs" then you probably do have dynamically linked perl (or perhaps a very non-Unixy perl): perl -V:dlsrcor perl -MConfig -e 'print $Config{dlsrc},"\n"'or perl -e 'use Config; print $Config{dlsrc},"\n"'

  (thanks to Paul Lussier <plussier@isd.3com.com> for the correction!).

  Here is a little more detailed discussion of each the steps just given:

  * Install Perl Read the Tk files (Tk*/README, etc.) for info on which version of perl is required for the perl/Tk kit you obtained.) For code locations see a CPAN site (separate question in this FAQ), the actual installation instructions come bundled in the perl***.tar.gz distribution file. (Perl Configure & make troubles are beyond the scope of this FAQ - please see the Perl FAQ itself or the INSTALL file for more help with this critical step.)

  You can install perl almost anywhere you like by specifying the -Dprefix=/path argument to sh Configure

  * [OBSOLETE] Unpack perl/Tk outside the Perl distribution

  (i.e. outside the perl build, perl install, or perl lib areas).

  gunzip Tk400.*.tar.gz

  tar -xvf Tk400.*.tar

  (Your tar program may not take -xvf. The resultant directory area will be referred to as your ``Tk build'' directory throughout this document.)

  * [OBSOLETE] Read INSTALL carefully

  cd Tk400.*

  pager INSTALL

  where pager is the program you use to scroll through text files more or less. Be sure to read it and don't just pound away on the spacebar.

  * If necessary remove any previously installed version of perl/Tk

  If you had a previously working version of Tk installed, you may need to resurrect the Makefile for it and execute:

  make uninstall

  make realclean

  before you unpack the new version. (The uninstall target of MakeMaker is relatively new so please be careful here.)

  * Have perl generate a custom Makefile.

  perl Makefile.PL

  (see below for more on this step.)

  * Compile.

  make

  (if and only if building static: make tkperl

  * Test.

  make test

  * Install.

  make install

  * Play with it.

  basic_demo

  (modify #! line if necessary, or specify /path/to/perl ./basic_demo)

  (warning if you build Tk-b9.01 with perl5.002gamma then change the line in basic_demo from

  use lib ./blib;

  to

  use lib qw(blib/arch blib/lib);)

  * Save the documentation and examples in a safe accessible place.

  use tar, cp, mv, chmod or whatever you prefer to save the valuable ancillary files from your Tk build tree.

  On the perl Makefile.PL step it may be necessary to give explicit locations of the required X11 libraries and/or include headers. For example: perl Makefile.PL X11=/usr/local/X11R5

  or perhaps different directory tree specification is necessary with your X installation: perl Makefile.PL X11INC=/usr/local/share/X11R5/include \ X11LIB=/usr/local/arch/X11R5/lib

  There are system and site dependencies in all of the above steps. However, the largest single source of build trouble comes from not using the latest versions of the various utilities (C compiler, make, etc.). In particular ensure that when you say perl Makefile.PL that the perl that gets invoked is up to date - use which perl (or whence perl) and perl -v to determine this. If necessary specify the full path name to your perl5 interpreter/compiler. (Some people do not rm their older perl interpreters when upgrading to a more recent version - beware.)

  If you still run into trouble take a look at the INSTALL, the README and the README file for your specific system (e.g. README.AIX, README.OSF, etc.). You might also find your system mentioned in the ptk hyper-mail archive at: http://www.rosat.mpe-garching.mpg.de/mailing-lists/ptk/or http://pubweb.bnl.gov/~ptk/or ftp://ftp.ccd.bnl.gov/pub/ptk/archives/

  or the Perl 5 Porters page at one of the following URLs: http://www.rosat.mpe-garching.mpg.de/mailing-lists/Perl5-Porters/ http://www.hut.fi/~jhi/perl5-porters.html

  If you wish to discuss your Tk build problems with others run and save the output from the myConfig script in the Tk build directory (the output may already be in the myConfig.out file from your perl/Tk build directory), as well as the myconfig script in your perl build directory (or the output of perl -V with a capitol V). It is often helpful to include the output of either (or both) of these scripts in your discussion.

  Presented here are the beginnings of a list of problems associated with building perl/Tk on various platforms (for help building perl itself please refer to the Perl FAQ). This list is in no way complete nor authoritative (nor is it necessarily even up-to-date!) but simply lists problems people have reported. Keep in mind that your installation may differ (e.g. location differences such as /usr/bin/perl vs. /usr/local/bin/perl) even if its the same platform listed here: A Sampling of Perl/Tk Platforms: AIX: As of perl5.002b & Tk-b9.01 README.AIX says no patching is necessary.

  For Tk-b8: modifying the perl.exp file may be necessary. There is a patch in Tk-b8/README.AIX. It may be necessary to make regen_headers after the patch. FreeBSD: [OBSOLETE] Nate Patwardhan <nvp@nfic.com> reports no trouble at all with Tk400.200 on FreeBSD-2.1.5 or FreeBSD-2.2.1. HPUX: For Tk-b11: One person reports a need to add #define TIMEOFDAY_TZ to the tkConfig.h header file in order to compile on HPUX 9.05.

  Previous versions: Most people seem to prefer the dynamic linking afforded by a recent version of the gcc compiler on this system. Linux: John C. Wingenbach indicates that should you encounter an error message like Cannot find -lX11 anywhere at ./myConfig line 184 when running your perl Makefile.PL (under Slakware 3.0) that you should be more specific about -l/path/to/libX11.a.

  Adam Wasserman <awasser@hermes.sgc.com> has graciously provided a compilation of Linux compilation trials & tribulations. It is an (as yet un-edited) document available at: http://www.perltk.org/contrib/hints/linux_compile.txt MachTen: Mark Pease mailto:pease@act.sps.mot.com mentions that:

  I was able to get Tk-b11.02 running under MachTen 2.2 perl5.002_01. I did need to make one change to get a round a MachTen problem. In pTk/tclUnix.h, pwd.h is included, but it is also included in pTk/tkPort.h (which is included in Lang.h, which is use by tclUnixUtil.c, whew!)

  MachTen's pwd.h can't be included more that once or you get an error.

  It looked to me like tclUnix.h was only used in tclUnixUtil.c, so I commented out the #include <pwd.h> in tclUnix.h. NetBSD: Jesus M. Gonzalez <jgb@gsyc.inf.uc3m.es> mentions success with:

  Tk-b11.01 compiles, installs and runs just out of the box in NetBSD-1.1/i386. I just followed the INSTALL instructions. NeXTSTEP: Gerd Knops recently posted a discussion of the steps to get perl running on several NeXTSTEPs to p5p. OS/2: Ilya Zakharevich mailto:ilya@math.ohio-state.edu has compiled a modified form of Tk-b11.02 to work with the Xfree86 client/server package, as well more advanced versions working with the Open32 PM package. OSF/1: As of perl5.002b & Tk-b9.01 you will probably be able to follow the usual instructions. John Stoffel <john@wpi.edu> reports that if you use gcc (rather than cc) you should use at least version 2.7.2

  For Tk-b8: make is reputedly not up to the task on this system. Tk-b8/README.OSF recommends gmake instead.

  Stephane Bortzmeyer mailto:bortzmeyer@pasteur.fr reports a successful build with Perl 5.001m, xsubpp 1.922, MakeMaker 4.23. He points out that it was necessary for him to upgrade the xsubpp and MakeMaker that he received with his copy of Perl5.001m. SCO: For Tk-b8: Eric J. Bohm mailto:bohm@cs.Buffalo.EDU reported a need to comment out line(s) from myConfig and GNUMakefiles using GNU make 3.67. (See Tk-b8/README.SCO for specifics.) SGI (Irix): For Tk-b11.02: Phillip Moore <wpm@morgan.com> reports a clean build on IRIX 5.3.

  Matthew Black mailto:black@csulb.edu recently mentioned a need to apply "patchSG0000596" to get perl sockets to work. His message was copyrighted and is not included here. Send e-mail to him to find out where the get "patchSG0000596". Suns: SunOS (BSD):

  For Tk-b10 on SunOS 4.1.3_U1

  using SparcWorks acc 3.0.1 Frederick L. Wagner <derf@ti.com> reports needing to use the perl malloc rather than the system malloc() when building perl.

  For Tk-b8: Tom Tignor mailto:tpt2@BBN.COM reports the following on SunOS (sun4m sparc): Tue, 28 Nov 1995 13:19:42

  In trying to make, I got a "write: argument mismatch" error for the file ptK/Lang.h. I looked at the file and found the offending function, Tcl_GetOpenFile, which has a third argument called "doWrite" (not "write") in tkGlue.c. I changed the argument from "write" to "doWrite" in Lang.h and it's compiling fine (for the moment. :)

  Solaris (System V):

  For Tk-b8: There is trouble getting perl to use Socket routines (i.e. trouble with make perl itself not necessarily trouble with Tk-b8). See the perl FAQ for more info or the .shar file that Tom Christiansen occasionally posts to comp.lang.perl.misc. Further information on perl inter process communication can be found in the perlipc* files at: ftp://ftp.perl.com/perl/info/everything_to_know/. SVR4: For Tk-b8: Martha G. Armour and Len Reed report on two separate hardware platforms running SVR4 - extensive details in Tk-b8/README.SVR4. Interestingly, they report no trouble at all on Linux. Ultrix: Peter Prymmer reports that with Tk-b11 it was necessary to change the line in Makefile.PL that reads:

  'LIBS' => ["$xlib -lX11 -lpt -lsocket -lnsl -lm"],

  to read:

  'LIBS' => ["$xlib -lX11 -lpt -lsocket -lnsl -lm -ldnet"],

  because of a newer X11 in /usr/local that needed the DECnet protocol linking.

  John Stoffel reports a successful build of static Tk-b10 on Ultrix 4.5. Windows NT: [OBSOLETE] Nick Ing-Simmons reports success with the alpha Tk404.000 kit, perl5.004, and Visual C++. Gurusamy Sarathy has distributed a binary kit with perl,Tk,etc. precompiled for Windows 32. Support is continuing to allow extension by the Borland C++ compiler as well as cross compiler extendability. non-Unix(ish)es:

  Information on non-Unix(ish) perl platforms may be obtained from newsgroups and email lists as well as a few world wide web sites. For example, try the Perl 5 Porters (p5p) [page|archives] at one of: http://www.rosat.mpe-garching.mpg.de/mailing-lists/Perl5-Porters/ http://www.hut.fi/~jhi/perl5-porters.html

  In general your non-Unix platform must be able to support perl 5 and Xlib (a C compiler and a make utility are tremendously useful too). If you want to run perl/Tk on another computer and simply have the display show up on yours then all you need on your computer is an "X server" The long list of UNIX and non-unix perl 5 ports, Tcl/Tk ports, and Perl/Tk ports that used to appear in this FAQ has now moved to a separate web page at: http://www.perltk.org/contrib/ptkPORT.html

  譯文:

  6. 如何編譯安裝?

  如果你不是用的二進制版本,那麽一般說來,編譯安裝Perl/Tk需要:

  1. 已經編譯安裝好的Perl環境(需要C的編譯器)。根據你所選擇的Tk的版本,你可能會需要不同版本的Perl環境。

  2. C編譯器(爲了編譯Tk本身的代碼)。

  3. 圖形窗口的鏈接庫Xlib(.o,.so,.a等等)。

  Perl/Tk已經被用很多不同的cc編譯器上成功的安裝(包括免費的GNU的gcc編譯器)。同時一個make工具會對安裝非常有幫助。

  編譯Perl的Tk模塊的一步一步的命令大致如下(動態鏈接版本):

  1. make install (先安裝適當版本的Perl)

  2. uninstall (卸載原有的舊版本的Tk)

  3. gunzip –c Tk400.*.tar.gz | tar xvf - (tar的參數在如SysV等的系統上可能會不同)

  4. cd Tk400.*

  5. 閱讀INSTALL文件

  6. perl Makefile.PL

  7. make

  8. make test

  9. make install

  對于「靜態鏈接」版本的安裝,你應該在執行完make之後而執行make test之前執行「make tkperl」。

  請注意,在上面的步驟中我們沒有提到大量的相關文檔和在那些子目錄中的例子。我們強烈推薦你仔細的閱讀安裝目錄裏的docs,examples等內容,並且把它們保留在一個安全的地方。你也可以考慮把它們打包安裝到一個網絡服務器的目錄中去。

  Kenneth Albanowski提供了一個相對簡單的方法用來測試是否你系統上的Perl允許動態鏈接。如果下面的任何一個命令沒有顯示「dl_none.xs」,那麽你應該已經安裝的動態鏈接的Perl:

  perl –V:dlsrc

  或

  perl –Mconfig –e 『print $Config{dlsrc},」\n」』

  或

  perl –e 『use Config; print $Config{dlsrc},」\n」』

  (感謝Paul Lussier的更正!)。

  下面是關于上面給出的步驟的一些更詳細的討論:

  l 安裝Perl: 應該先閱讀你獲取到Perl/Tk包中的說明文件(Tk*/README等等)來了解它所要求的Perl的版本。相應的Perl代碼可以從CPAN得到,其實際的安裝說明在perl*.tar.gz的包裏面。(關于Perl的配置和安裝等問題已經超出來我們這個FAQ的範圍,詳情請參閱Perl FAQ文件)

  l 在Perl的安裝目錄以外解開Perl/Tk的包

  gunzip Tk400.*.tar.gz

  tar –xvf Tk400.*.tar

  (注意:你的tar程序也許會不認-xvf選項。另外,解開以後的目錄我們在下面的文檔中將稱之爲「Tk安裝目錄」。)

  l 仔細閱讀INSTALL文件

  cd Tk400.*

  pager INSTALL

  注:這裏的pager是指你用來閱讀整個文本的工具,請務必仔細閱讀此文檔而不要簡單跳過!

  l 如果存在,請先清除所有原先安裝的Perl/Tk!

  如果你原來曾經安裝使用過Tk,你可能需要再使用原來的Makfile文件執行如下:

  make uninstall

  make realclean

  注:此操作應該在你解開新版本的包之前(另外,請注意這裏make的uninstall屬性相對比較新)。

  l 讓Perl按照你的系統情況産生一個Makefile文件

  perl Makefile.PL

  (注:關于此步驟地詳細說明請參閱下面的部分)。

  l 編譯

  make

  (注:只有在做靜態編譯的時候才使用:make tkperl)

  l 測試

  make test

  l 安裝

  make install

  l 開始使用

  basic_demo(譯者注:建議直接使用perl basic_demo)

  (注:請根據需要修改首行#!後面的內容,或指定/path/to/perl ./basic_demo)

  (警告:如果你使用的是Tk-b9.01和perl5.002gamma,請把basic_demo中的use lib ./blib;行改成use lib qw(blib/arch blib/lib);)

  l 把這些文檔和例子保存到一個安全可用的地方

  你可以使用tar,cp,mv,chmod等等一些命令來把Tk安裝目錄裏的這些有用的輔助文件保存起來。

  另外,在「perl Makefile.PL」的一步中,有時可能需要明確指明X11庫或頭文件的位置。例如:

  perl Makefile.PL X11=/usr/local/X11R5

  或者,可能你的X安裝的頭文件和庫在其它不同的目錄中:

  perl Makefile.PL X11INC=/usr/local/share/X11R5/include X11LIB=/usr/local/arch/X11R5/lib

  以上的所有步驟實際的成功與否實際主要依賴于你的系統。但是,最多的安裝錯誤通常是由于沒有使用最新版本的各種工具而造成的(例如C編譯器、make等等)。特別是在你執行「perl Makefile.PL」前,先確定你調用的是哪裏的perl(用which perl)以及它的版本(用perl -v)。如果必要的話,甚至可以給出你的Perl5解釋器的全路徑(因爲,有些人在升級perl的時候並沒有刪除掉老的版本,所以要特別小心)。

  如果你的安裝仍有問題,閱讀一下INSTALL文件、README文件和與你的系統對應的README文件(例如,README.AIX、README.OSF等等)。你可能也可以在下面的地址找到與你的系統對應的ptk的超文本檔案文件:

  http://www.rosat.mpe-garching.mpg.de/mailing-lists/ptk/

  或

  http://pubweb.bnl.gov/~ptk/

  或

  ftp://ftp.ccd.bnl.gov/pub/ptk/archives/

  或者下面的任何一個地址:

  http://www.rosat.mpe-garching.mpg.de/mailing-lists/Perl5-Porters/

  http://www.hut.fi/~jhi/perl5-porters.html

  如果你希望和其它人討論你在安裝Tk時遇到的問題,可以運行Tk安裝目錄中的myConfig腳本,並保存其輸出結果(可能已經被保存在你的Tk安裝目錄中的myConfig.out文件中了)。同樣的,運行perl安裝目錄中的myconfig腳本(或perl –V),並保存其結果。因爲一般說來,在與別人討論的時候,出示上面的任何一個(或全部)結果會非常有幫助的。

  (譯者注:原文下面的部分是一些在各種系統上發現的Tk安裝中的問題,但是都已經比較老了,可能不太適用了,所以就不譯了……累得不行了,偷點懶咯:P)
 
 
 
上一篇《Perl/TkFAQ-5.CPAN是什麽?在哪裏》
下一篇《Perl/TkFAQ-7.哪裏有Perl/Tk的文檔》
 
 
 
 
 
 
日版寵物情人插曲《Winding Road》歌詞

日版寵物情人2017的插曲,很帶節奏感,日語的,女生唱的。 最後聽見是在第8集的時候女主手割傷了,然後男主用嘴幫她吸了一下,插曲就出來了。 歌手:Def...

兄弟共妻,我成了他們夜裏的美食

老鍾家的兩個兒子很特別,就是跟其他的人不太一樣,魔一般的執著。兄弟倆都到了要結婚的年齡了,不管自家老爹怎麽磨破嘴皮子,兄弟倆說不娶就不娶,老父母爲兄弟兩操碎了心...

如何磨出破洞牛仔褲?牛仔褲怎麽剪破洞?

把牛仔褲磨出有線的破洞 1、具體工具就是磨腳石,下面墊一個硬物,然後用磨腳石一直磨一直磨,到把那塊磨薄了,用手撕開就好了。出來的洞啊很自然的。需要貓須的話調幾...

我就是掃描下圖得到了敬業福和愛國福

先來看下敬業福和愛國福 今年春節,支付寶再次推出了“五福紅包”活動,表示要“把欠大家的敬業福都還給大家”。 今天該活動正式啓動,和去年一樣,需要收集“五福”...

冰箱異味産生的原因和臭味去除的方法

有時候我們打開冰箱就會聞到一股異味,冰箱裏的這種異味是因爲一些物質發出的氣味的混合體,聞起來讓人惡心。 産生這些異味的主要原因有以下幾點。 1、很多人有這種習...

《極品家丁》1-31集大結局分集劇情介紹

簡介 《極品家丁》講述了現代白領林晚榮無意回到古代金陵,並追隨蕭二小姐化名“林三”進入蕭府,不料卻陰差陽錯上演了一出低級家丁拼搏上位的“林三升職記”。...

李溪芮《極品家丁》片尾曲《你就是我最愛的寶寶》歌詞

你就是我最愛的寶寶 - 李溪芮 (電視劇《極品家丁》片尾曲) 作詞:常馨內 作曲:常馨內 你的眉 又鬼馬的挑 你的嘴 又壞壞的笑 上一秒吵鬧 下...

烏梅的功效與作用以及烏梅的食用禁忌有哪些?

烏梅,又稱春梅,中醫認爲,烏梅味酸,性溫,無毒,具有安心、除熱、下氣、祛痰、止渴調中、殺蟲的功效,治肢體痛、肺痨病。烏梅泡水喝能治傷寒煩熱、止吐瀉,與幹姜一起制...

什麽是脂肪粒?如何消除臉部脂肪粒?

什麽是脂肪粒 在我們的臉上總會長一個個像脂肪的小顆粒,弄也弄不掉,而且顔色還是白白的。它既不是粉刺也不是其他的任何痘痘,它就是脂肪粒。 脂肪粒雖然也是由油脂...

網絡安全治理:國家安全保障的主要方向是打擊犯罪,而不是處置和懲罰受害者

來源:中國青年報 新的攻擊方法不斷湧現,黑客幾乎永遠占據網絡攻擊的上風,我們不可能通過技術手段杜絕網絡攻擊。國家安全保障的主要方向是打擊犯罪,而不是處置和懲罰...

河南夫妻在溫嶺網絡直播“造人”內容涉黃被刑事拘留

夫妻網絡直播“造人”爆紅   1月9日,溫嶺城北派出所接到南京警方的協查通告,他們近期打掉了一個涉黃直播APP平台。而根據掌握的線索,其中有一對涉案的夫妻主播...

如何防止牆紙老化?牆紙變舊變黃怎麽辦?

如何防止牆紙老化? (1)選擇透氣性好的牆紙 市場上牆紙的材質分無紡布的、木纖維的、PVC的、玻璃纖維基材的、布面的等,相對而言,PVC材質的牆紙最不透氣...

鮮肌之謎非日本生産VS鮮肌之謎假日貨是謠言

觀點一:破日本銷售量的“鮮肌之謎” 非日本生産 近一段時間,淘寶上架了一款名爲“鮮肌之謎的” 鲑魚卵巢美容液,號稱是最近日本的一款推出的全新護膚品,産品本身所...

中國最美古詩詞精選摘抄

系腰裙(北宋詞人 張先) 惜霜蟾照夜雲天,朦胧影、畫勾闌。人情縱似長情月,算一年年。又能得、幾番圓。 欲寄西江題葉字,流不到、五亭前。東池始有荷新綠,尚小如...

關于女人的經典語句

關于女人的經典語句1、【做一個獨立的女人】 思想獨立:有主見、有自己的人生觀、價值觀。有上進心,永遠不放棄自己的理想,做一份自己喜愛的事業,擁有快樂和成就...

未來我們可以和性愛機器人結婚嗎?

你想體驗機器人性愛嗎?你想和性愛機器人結婚嗎?如果你想,機器人有拒絕你的權利嗎? 近日,第二屆“國際人類-機器人性愛研討會”大會在倫敦金史密斯大學落下帷幕。而...

全球最變態的十個地方

10.土耳其地下洞穴城市 變態指數:★★☆☆☆ 這是土耳其卡帕多西亞的一個著名景點,傳說是當年基督教徒們爲了躲避戰爭而在此修建。裏面曾住著20000人,...

科學家稱,人類死亡後意識將在另外一個宇宙中繼續存活

據英國《每日快報》報道,一位科學家兼理論家Robert Lanza博士宣稱,世界上並不存在人類死亡,死亡的只是身體。他認爲我們的意識借助我們體內的能量生存,而且...

《屏裏狐》片頭曲《我愛狐狸精》歌詞是什麽?

《我愛狐狸精》 - 劉馨棋   (電視劇《屏裏狐》主題曲)   作詞:金十三&李旦   作曲:劉嘉   狐狸精 狐狸仙   千年修...

 
 
 
  原文:   6. How do I build it?   Assuming you are not running a binary distribution then, in general, building perl/Tk requires:   1. A made & installed perl (requires a C language compiler). You may need different versions of perl depending on which version of Tk you wish to run.   2. A C language compiler for the Tk code itself.   3. A linkable Xlib (.o, .so, .a, etc.) for X-windows.   Perl/Tk has been successfully built using various vendors' cc compilers, as well as with the free GNU gcc compiler. A make utility of some sort (make/gmake) will be extremely helpful.   [OBSOLETE] Step - by - step the commands to build the Tk extension to Perl are (for the dynamically linked version) roughly as follows:   1. make install # the appropriate version of perl.   2. uninstall # prior versions of the Tk extension to perl.   3. gunzip -c Tk400.*.tar.gz | tar xvf - (tar options may vary esp. on SysV)   4. cd Tk400.*   5. read INSTALL   6. perl Makefile.PL   7. make   8. make test   9. make install   For the statically linked version you would `make tkperl` just after executing the `make` step and before the `make test` step.   Note carefully that this process leaves behind a large amount of documentation and examples in various sub-directories. You are strongly encouraged to look carefully through your build tree for docs, examples, etc. and keep those valuable files in a safe place. You might consider tar-ing them off and installing in a webserver directory tree.   A relatively easy way to determine if the perl on your system allows for dynamic linking was mentioned by Kenneth Albanowski <kjahds@kjahds.com>. If any of the following does not say "dl_none.xs" then you probably do have dynamically linked perl (or perhaps a very non-Unixy perl): perl -V:dlsrcor perl -MConfig -e 'print $Config{dlsrc},"\n"'or perl -e 'use Config; print $Config{dlsrc},"\n"'   (thanks to Paul Lussier <plussier@isd.3com.com> for the correction!).   Here is a little more detailed discussion of each the steps just given:   * Install Perl Read the Tk files (Tk*/README, etc.) for info on which version of perl is required for the perl/Tk kit you obtained.) For code locations see a CPAN site (separate question in this FAQ), the actual installation instructions come bundled in the perl***.tar.gz distribution file. (Perl Configure & make troubles are beyond the scope of this FAQ - please see the Perl FAQ itself or the INSTALL file for more help with this critical step.)   You can install perl almost anywhere you like by specifying the -Dprefix=/path argument to sh Configure   * [OBSOLETE] Unpack perl/Tk outside the Perl distribution   (i.e. outside the perl build, perl install, or perl lib areas).   gunzip Tk400.*.tar.gz   tar -xvf Tk400.*.tar   (Your tar program may not take -xvf. The resultant directory area will be referred to as your ``Tk build'' directory throughout this document.)   * [OBSOLETE] Read INSTALL carefully   cd Tk400.*   pager INSTALL   where pager is the program you use to scroll through text files more or less. Be sure to read it and don't just pound away on the spacebar.   * If necessary remove any previously installed version of perl/Tk   If you had a previously working version of Tk installed, you may need to resurrect the Makefile for it and execute:   make uninstall   make realclean   before you unpack the new version. (The uninstall target of MakeMaker is relatively new so please be careful here.)   * Have perl generate a custom Makefile.   perl Makefile.PL   (see below for more on this step.)   * Compile.   make   (if and only if building static: make tkperl   * Test.   make test   * Install.   make install   * Play with it.   basic_demo   (modify #! line if necessary, or specify /path/to/perl ./basic_demo)   (warning if you build Tk-b9.01 with perl5.002gamma then change the line in basic_demo from   use lib ./blib;   to   use lib qw(blib/arch blib/lib);)   * Save the documentation and examples in a safe accessible place.   use tar, cp, mv, chmod or whatever you prefer to save the valuable ancillary files from your Tk build tree.   On the perl Makefile.PL step it may be necessary to give explicit locations of the required X11 libraries and/or include headers. For example: perl Makefile.PL X11=/usr/local/X11R5   or perhaps different directory tree specification is necessary with your X installation: perl Makefile.PL X11INC=/usr/local/share/X11R5/include \ X11LIB=/usr/local/arch/X11R5/lib   There are system and site dependencies in all of the above steps. However, the largest single source of build trouble comes from not using the latest versions of the various utilities (C compiler, make, etc.). In particular ensure that when you say perl Makefile.PL that the perl that gets invoked is up to date - use which perl (or whence perl) and perl -v to determine this. If necessary specify the full path name to your perl5 interpreter/compiler. (Some people do not rm their older perl interpreters when upgrading to a more recent version - beware.)   If you still run into trouble take a look at the INSTALL, the README and the README file for your specific system (e.g. README.AIX, README.OSF, etc.). You might also find your system mentioned in the ptk hyper-mail archive at: http://www.rosat.mpe-garching.mpg.de/mailing-lists/ptk/or http://pubweb.bnl.gov/~ptk/or ftp://ftp.ccd.bnl.gov/pub/ptk/archives/   or the Perl 5 Porters page at one of the following URLs: http://www.rosat.mpe-garching.mpg.de/mailing-lists/Perl5-Porters/ http://www.hut.fi/~jhi/perl5-porters.html   If you wish to discuss your Tk build problems with others run and save the output from the myConfig script in the Tk build directory (the output may already be in the myConfig.out file from your perl/Tk build directory), as well as the myconfig script in your perl build directory (or the output of perl -V with a capitol V). It is often helpful to include the output of either (or both) of these scripts in your discussion.   Presented here are the beginnings of a list of problems associated with building perl/Tk on various platforms (for help building perl itself please refer to the Perl FAQ). This list is in no way complete nor authoritative (nor is it necessarily even up-to-date!) but simply lists problems people have reported. Keep in mind that your installation may differ (e.g. location differences such as /usr/bin/perl vs. /usr/local/bin/perl) even if its the same platform listed here: A Sampling of Perl/Tk Platforms: AIX: As of perl5.002b & Tk-b9.01 README.AIX says no patching is necessary.   For Tk-b8: modifying the perl.exp file may be necessary. There is a patch in Tk-b8/README.AIX. It may be necessary to make regen_headers after the patch. FreeBSD: [OBSOLETE] Nate Patwardhan <nvp@nfic.com> reports no trouble at all with Tk400.200 on FreeBSD-2.1.5 or FreeBSD-2.2.1. HPUX: For Tk-b11: One person reports a need to add #define TIMEOFDAY_TZ to the tkConfig.h header file in order to compile on HPUX 9.05.   Previous versions: Most people seem to prefer the dynamic linking afforded by a recent version of the gcc compiler on this system. Linux: John C. Wingenbach indicates that should you encounter an error message like Cannot find -lX11 anywhere at ./myConfig line 184 when running your perl Makefile.PL (under Slakware 3.0) that you should be more specific about -l/path/to/libX11.a.   Adam Wasserman <awasser@hermes.sgc.com> has graciously provided a compilation of Linux compilation trials & tribulations. It is an (as yet un-edited) document available at: http://www.perltk.org/contrib/hints/linux_compile.txt MachTen: Mark Pease mailto:pease@act.sps.mot.com mentions that:   I was able to get Tk-b11.02 running under MachTen 2.2 perl5.002_01. I did need to make one change to get a round a MachTen problem. In pTk/tclUnix.h, pwd.h is included, but it is also included in pTk/tkPort.h (which is included in Lang.h, which is use by tclUnixUtil.c, whew!)   MachTen's pwd.h can't be included more that once or you get an error.   It looked to me like tclUnix.h was only used in tclUnixUtil.c, so I commented out the #include <pwd.h> in tclUnix.h. NetBSD: Jesus M. Gonzalez <jgb@gsyc.inf.uc3m.es> mentions success with:   Tk-b11.01 compiles, installs and runs just out of the box in NetBSD-1.1/i386. I just followed the INSTALL instructions. NeXTSTEP: Gerd Knops recently posted a discussion of the steps to get perl running on several NeXTSTEPs to p5p. OS/2: Ilya Zakharevich mailto:ilya@math.ohio-state.edu has compiled a modified form of Tk-b11.02 to work with the Xfree86 client/server package, as well more advanced versions working with the Open32 PM package. OSF/1: As of perl5.002b & Tk-b9.01 you will probably be able to follow the usual instructions. John Stoffel <john@wpi.edu> reports that if you use gcc (rather than cc) you should use at least version 2.7.2   For Tk-b8: make is reputedly not up to the task on this system. Tk-b8/README.OSF recommends gmake instead.   Stephane Bortzmeyer mailto:bortzmeyer@pasteur.fr reports a successful build with Perl 5.001m, xsubpp 1.922, MakeMaker 4.23. He points out that it was necessary for him to upgrade the xsubpp and MakeMaker that he received with his copy of Perl5.001m. SCO: For Tk-b8: Eric J. Bohm mailto:bohm@cs.Buffalo.EDU reported a need to comment out line(s) from myConfig and GNUMakefiles using GNU make 3.67. (See Tk-b8/README.SCO for specifics.) SGI (Irix): For Tk-b11.02: Phillip Moore <wpm@morgan.com> reports a clean build on IRIX 5.3.   Matthew Black mailto:black@csulb.edu recently mentioned a need to apply "patchSG0000596" to get perl sockets to work. His message was copyrighted and is not included here. Send e-mail to him to find out where the get "patchSG0000596". Suns: SunOS (BSD):   For Tk-b10 on SunOS 4.1.3_U1   using SparcWorks acc 3.0.1 Frederick L. Wagner <derf@ti.com> reports needing to use the perl malloc rather than the system malloc() when building perl.   For Tk-b8: Tom Tignor mailto:tpt2@BBN.COM reports the following on SunOS (sun4m sparc): Tue, 28 Nov 1995 13:19:42   In trying to make, I got a "write: argument mismatch" error for the file ptK/Lang.h. I looked at the file and found the offending function, Tcl_GetOpenFile, which has a third argument called "doWrite" (not "write") in tkGlue.c. I changed the argument from "write" to "doWrite" in Lang.h and it's compiling fine (for the moment. :)   Solaris (System V):   For Tk-b8: There is trouble getting perl to use Socket routines (i.e. trouble with make perl itself not necessarily trouble with Tk-b8). See the perl FAQ for more info or the .shar file that Tom Christiansen occasionally posts to comp.lang.perl.misc. Further information on perl inter process communication can be found in the perlipc* files at: ftp://ftp.perl.com/perl/info/everything_to_know/. SVR4: For Tk-b8: Martha G. Armour and Len Reed report on two separate hardware platforms running SVR4 - extensive details in Tk-b8/README.SVR4. Interestingly, they report no trouble at all on Linux. Ultrix: Peter Prymmer reports that with Tk-b11 it was necessary to change the line in Makefile.PL that reads:   'LIBS' => ["$xlib -lX11 -lpt -lsocket -lnsl -lm"],   to read:   'LIBS' => ["$xlib -lX11 -lpt -lsocket -lnsl -lm -ldnet"],   because of a newer X11 in /usr/local that needed the DECnet protocol linking.   John Stoffel reports a successful build of static Tk-b10 on Ultrix 4.5. Windows NT: [OBSOLETE] Nick Ing-Simmons reports success with the alpha Tk404.000 kit, perl5.004, and Visual C++. Gurusamy Sarathy has distributed a binary kit with perl,Tk,etc. precompiled for Windows 32. Support is continuing to allow extension by the Borland C++ compiler as well as cross compiler extendability. non-Unix(ish)es:   Information on non-Unix(ish) perl platforms may be obtained from newsgroups and email lists as well as a few world wide web sites. For example, try the Perl 5 Porters (p5p) [page|archives] at one of: http://www.rosat.mpe-garching.mpg.de/mailing-lists/Perl5-Porters/ http://www.hut.fi/~jhi/perl5-porters.html   In general your non-Unix platform must be able to support perl 5 and Xlib (a C compiler and a make utility are tremendously useful too). If you want to run perl/Tk on another computer and simply have the display show up on yours then all you need on your computer is an "X server" The long list of UNIX and non-unix perl 5 ports, Tcl/Tk ports, and Perl/Tk ports that used to appear in this FAQ has now moved to a separate web page at: http://www.perltk.org/contrib/ptkPORT.html   譯文:   6. 如何編譯安裝?   如果你不是用的二進制版本,那麽一般說來,編譯安裝Perl/Tk需要:   1. 已經編譯安裝好的Perl環境(需要C的編譯器)。根據你所選擇的Tk的版本,你可能會需要不同版本的Perl環境。   2. C編譯器(爲了編譯Tk本身的代碼)。   3. 圖形窗口的鏈接庫Xlib(.o,.so,.a等等)。   Perl/Tk已經被用很多不同的cc編譯器上成功的安裝(包括免費的GNU的gcc編譯器)。同時一個make工具會對安裝非常有幫助。   編譯Perl的Tk模塊的一步一步的命令大致如下(動態鏈接版本):   1. make install (先安裝適當版本的Perl)   2. uninstall (卸載原有的舊版本的Tk)   3. gunzip –c Tk400.*.tar.gz | tar xvf - (tar的參數在如SysV等的系統上可能會不同)   4. cd Tk400.*   5. 閱讀INSTALL文件   6. perl Makefile.PL   7. make   8. make test   9. make install   對于「靜態鏈接」版本的安裝,你應該在執行完make之後而執行make test之前執行「make tkperl」。   請注意,在上面的步驟中我們沒有提到大量的相關文檔和在那些子目錄中的例子。我們強烈推薦你仔細的閱讀安裝目錄裏的docs,examples等內容,並且把它們保留在一個安全的地方。你也可以考慮把它們打包安裝到一個網絡服務器的目錄中去。   Kenneth Albanowski提供了一個相對簡單的方法用來測試是否你系統上的Perl允許動態鏈接。如果下面的任何一個命令沒有顯示「dl_none.xs」,那麽你應該已經安裝的動態鏈接的Perl:   perl –V:dlsrc   或   perl –Mconfig –e 『print $Config{dlsrc},」\n」』   或   perl –e 『use Config; print $Config{dlsrc},」\n」』   (感謝Paul Lussier的更正!)。   下面是關于上面給出的步驟的一些更詳細的討論:   l 安裝Perl: 應該先閱讀你獲取到Perl/Tk包中的說明文件(Tk*/README等等)來了解它所要求的Perl的版本。相應的Perl代碼可以從CPAN得到,其實際的安裝說明在perl*.tar.gz的包裏面。(關于Perl的配置和安裝等問題已經超出來我們這個FAQ的範圍,詳情請參閱Perl FAQ文件)   l 在Perl的安裝目錄以外解開Perl/Tk的包   gunzip Tk400.*.tar.gz   tar –xvf Tk400.*.tar   (注意:你的tar程序也許會不認-xvf選項。另外,解開以後的目錄我們在下面的文檔中將稱之爲「Tk安裝目錄」。)   l 仔細閱讀INSTALL文件   cd Tk400.*   pager INSTALL   注:這裏的pager是指你用來閱讀整個文本的工具,請務必仔細閱讀此文檔而不要簡單跳過!   l 如果存在,請先清除所有原先安裝的Perl/Tk!   如果你原來曾經安裝使用過Tk,你可能需要再使用原來的Makfile文件執行如下:   make uninstall   make realclean   注:此操作應該在你解開新版本的包之前(另外,請注意這裏make的uninstall屬性相對比較新)。   l 讓Perl按照你的系統情況産生一個Makefile文件   perl Makefile.PL   (注:關于此步驟地詳細說明請參閱下面的部分)。   l 編譯   make   (注:只有在做靜態編譯的時候才使用:make tkperl)   l 測試   make test   l 安裝   make install   l 開始使用   basic_demo(譯者注:建議直接使用perl basic_demo)   (注:請根據需要修改首行#!後面的內容,或指定/path/to/perl ./basic_demo)   (警告:如果你使用的是Tk-b9.01和perl5.002gamma,請把basic_demo中的use lib ./blib;行改成use lib qw(blib/arch blib/lib);)   l 把這些文檔和例子保存到一個安全可用的地方   你可以使用tar,cp,mv,chmod等等一些命令來把Tk安裝目錄裏的這些有用的輔助文件保存起來。   另外,在「perl Makefile.PL」的一步中,有時可能需要明確指明X11庫或頭文件的位置。例如:   perl Makefile.PL X11=/usr/local/X11R5   或者,可能你的X安裝的頭文件和庫在其它不同的目錄中:   perl Makefile.PL X11INC=/usr/local/share/X11R5/include   X11LIB=/usr/local/arch/X11R5/lib   以上的所有步驟實際的成功與否實際主要依賴于你的系統。但是,最多的安裝錯誤通常是由于沒有使用最新版本的各種工具而造成的(例如C編譯器、make等等)。特別是在你執行「perl Makefile.PL」前,先確定你調用的是哪裏的perl(用which perl)以及它的版本(用perl -v)。如果必要的話,甚至可以給出你的Perl5解釋器的全路徑(因爲,有些人在升級perl的時候並沒有刪除掉老的版本,所以要特別小心)。   如果你的安裝仍有問題,閱讀一下INSTALL文件、README文件和與你的系統對應的README文件(例如,README.AIX、README.OSF等等)。你可能也可以在下面的地址找到與你的系統對應的ptk的超文本檔案文件:   http://www.rosat.mpe-garching.mpg.de/mailing-lists/ptk/   或   http://pubweb.bnl.gov/~ptk/   或   ftp://ftp.ccd.bnl.gov/pub/ptk/archives/   或者下面的任何一個地址:   http://www.rosat.mpe-garching.mpg.de/mailing-lists/Perl5-Porters/   http://www.hut.fi/~jhi/perl5-porters.html   如果你希望和其它人討論你在安裝Tk時遇到的問題,可以運行Tk安裝目錄中的myConfig腳本,並保存其輸出結果(可能已經被保存在你的Tk安裝目錄中的myConfig.out文件中了)。同樣的,運行perl安裝目錄中的myconfig腳本(或perl –V),並保存其結果。因爲一般說來,在與別人討論的時候,出示上面的任何一個(或全部)結果會非常有幫助的。   (譯者注:原文下面的部分是一些在各種系統上發現的Tk安裝中的問題,但是都已經比較老了,可能不太適用了,所以就不譯了……累得不行了,偷點懶咯:P)
󰈣󰈤
 
 
 
  免責聲明:本文僅代表作者個人觀點,與王朝網路無關。王朝網路登載此文出於傳遞更多信息之目的,並不意味著贊同其觀點或證實其描述,其原創性以及文中陳述文字和內容未經本站證實,對本文以及其中全部或者部分內容、文字的真實性、完整性、及時性本站不作任何保證或承諾,請讀者僅作參考,並請自行核實相關內容。
 
 
暖暖的午後美女(2)
一個人的生活
妩媚動人的女生
秀氣迷人的模特
巧合的對稱
擁抱明天
十二月,有陽光
董子讀書台
 
>>返回首頁<<
 
 
 
 熱帖排行
 
 
 
 
© 2005- 王朝網路 版權所有