Make for Windows: NMake

原文地址: http://johnbokma.com/perl/make-for-windows.html
心血来潮,就随便翻译以下,仅供自娱自乐.

If a Perl module is not available for the ActiveState version of Perl (ActivePerl), you might be able to download it from the Comprehensive Perl Archive Network (CPAN), and try to build and install it on Microsoft Windows.
如果一个Perl模块在ActiveState版本的Perl(ActivePerl)中找不到,你也许可以从CPAN上下载它,然后试着编译(构建)并安装到MS Windows.

A frequently asked question: "Where can I find make for Windows?". The answer is: "Download and use NMake".
一个经常被提及的问题:"从那里能找到Windows下的make(一种编译命令/工具)". 答案是:"下载并使用NMake".

Downloading NMake

Since Microsoft Windows hasn't in it's default install a make program needed to build the Perl modules, you have to download NMake 1.5 from the Microsoft Knowledge Base, article 132084 page.
因为MS Windows在默认安装时没有自带用于编译Perl模块的make程序,你必须从下面这个网页上下载NMakeMicrosoft Knowledge Base, article 132084.

Installing NMake

Run the downloaded file (exe) to extract it. Copy both the NMAKE.EXE and the NMAKE.ERR file to your Perl bin directory, normally C:/Perl/bin. Make sure that you copy the NMAKE.ERR file as well.
运行下载下来的文件来释放nmake.复制NMAKE.EXE 和NMAKE.ERR到你的Perl bin目录,通常C:/Perl/bin. 确定你同时拷贝了NMAKE.ERR文件.

Example of an NMake session

Normally building Perl modules and installing them consist of the following steps:
通常编译Perl模块并安装他们由以下几个步骤:

  1. perl Makefile.pl
  2. make
  3. make test
  4. make install

Just replace make with nmake, and in many cases this will result in a working module (or modules) installed in the proper location(s).
只要把make替换成nmake,并且在大多数情况下这将把一个可用模块(或几个可用模块)安装到适当的地方(s).

下面的就省略不翻译了.

Below follows an example of building the Net-Google Perl module, and installing it. See Net-Google with ActiveState Perl for more information.

perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Net::Google

nmake

Microsoft (R) Program Maintenance Utility   Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

cp lib/Net/Google/Search.pm blib/lib/Net/Google/Search.pm
cp lib/Net/Google.pm blib/lib/Net/Google.pm
cp lib/Net/Google/tool.pm blib/lib/Net/Google/tool.pm
cp lib/Net/Google/Spelling.pm blib/lib/Net/Google/Spelling.pm
cp lib/Net/Google/Cache.pm blib/lib/Net/Google/Cache.pm
cp lib/Net/Google/Services/GoogleSearch.wsdl blib/lib/Net/Google
/Services/GoogleSearch.wsdl
cp lib/Net/Google/Service.pm blib/lib/Net/Google/Service.pm
cp lib/Net/Google/Response.pm blib/lib/Net/Google/Response.pm

nmake test

Microsoft (R) Program Maintenance Utility   Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

    C:/Perl/bin/perl.exe "-MExtUtils::Command::MM" "-e" "tes
t_harness(0, 'blib/lib', 'blib/arch')" t/000-key.t t/001-search.
t t/002-spelling.t t/003-cache.t t/000-key.........#
# The Google API web service requires that you provide create a
Google Account and obtain a license key
# This key is then passed with each request you make to the Goog
le servers.
# If you do not already have a Google Account, you can sign up f
or one here:

# http://www.google.com/apis/
#
# Please enter your Google API key:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
t/000-key.........ok
t/001-search......ok
t/002-spelling....ok
t/003-cache.......ok
All tests successful.
Files=4, Tests=18, 103 wallclock secs ( 0.00 cusr +  0.00 csys =
0.00 CPU)

nmake install

Microsoft (R) Program Maintenance Utility   Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

Installing C:/Perl/site/lib/Net/Google.pm
Installing C:/Perl/site/lib/Net/Google/Cache.pm
Installing C:/Perl/site/lib/Net/Google/Response.pm
Installing C:/Perl/site/lib/Net/Google/Search.pm
Installing C:/Perl/site/lib/Net/Google/Service.pm
Installing C:/Perl/site/lib/Net/Google/Spelling.pm
Installing C:/Perl/site/lib/Net/Google/tool.pm
Installing C:/Perl/site/lib/Net/Google/Services/GoogleSearch.wsd
l
Appending installation info to C:/Perl/lib/perllocal.pod
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
windows下安装perl模块方法和必备软件nmake dmake devcpp: 方式一: 将 nmake.exe 放到system32目录下 用一下方式: perl Makefile.pl nmake nmake test nmake install 如果成功,将不用看下面内容。 方式二: 手动编译方式 优点:通吃所有模块 缺点:有点麻烦 具体步骤:1安装编译器2设置编译器的环境变量3可能安装dmake 具体方法:如下 1.首先要有个c编译器,推荐dev-cpp(开源免费的,网上自己搜索),记得要下含有mingw的就是了(不懂c,下载含有mingw的因为这个版本的bin目录里有gcc.exe等工具). 1.1安装好了编译器之后,要能在cmd中以命令方式运行的话,必须要设置环境变量,在winxp中[我的电脑]->[属性]->[高级]->[环境变量]里设置,只需要在path里加个你路径,比如你的安装路径是c:\dev-cpp,那你就要加上c:\dev-cpp\bin (path中有很多其他的路径,之间记得用;隔开 )弄完好,在cmd中运行gcc -v 显示出内容表示编译器安装成功,并且可以用命令行编译. 2.编译步骤,在cpan上下载需要的模块,比如Win32::SerialPort,下载好了解压,在cmd中进入这个目录(简单的dos命令应该知道吧),就用常见的方法: perl Makefile.pl make make test make install 如果成功,将不用看下面内容。 方式三: 使用方式二make很可能会出现错误,不能编译,找了很多原因,有高人介绍了解决办法,就是下载一个叫dmake的工具,解压缩,将里面的dmake.exe和startup的文件夹(好象是这个名字)一起复制到c:\dev-cpp\bin 里(因为这个目录注册到环境变量里的),之后安装改成: perl Makefile.pl dmake dmake test dmake install 注意: 如果安装过oracle10g你将会发现出现版本冲突的情况。 解决方案如下:修改%PERL5LIB%环境变量,修改为perl所在目录

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值