文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Install BerkeleyDB on Strawberry Perl

Install BerkeleyDB on Strawberry Perl

时间:2008-07-29  来源:xktop

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 12"><meta name="Originator" content="Microsoft Word 12"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5Ckxu%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"><link rel="themeData" href="file:///C:%5CDOCUME%7E1%5Ckxu%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link rel="colorSchemeMapping" href="file:///C:%5CDOCUME%7E1%5Ckxu%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><style> </style>

Download and install the Oracle/Sleepycat BerkeleyDB for win32

http://www.oracle.com/technology/software/products/berkeley-db/htdocs/popup/db/4.6.21/db-msi.html

Please use version 4.6.21 or later, because I fail to do the same installation process by using BerkeleyDB version 4.4.20.

1.Go to BerkeleyDB directory
       Copy the include directory to C:\strawberry\c\include and rename it from include to db
       Copy the lib\libdb46.lib file to C:\strawberry\c\lib and rename it from libdb46.lib to libdb.a
       Comment out two typedef lines in C:\strawberry\c\include\db\db.h
           line 115: /*typedef u_int32_t uintptr_t;*/
           line 128: /*typedef int32_t ssize_t;*/

2.    Install the BerkeleyDB sources
       C:\>cpan
       cpan>install BerkeleyDB  --will not succeed because we don’t change configuration
       cpan>look BerkeleyDB  --only download source and go into the source directory, not try to install, please use this command
       when source download is done and directory has been changed, please pause on this command window and do step 3

3.    Edit the config.in file
       INCLUDE=C:\strawberry\c\include\db
       LIB=C:\strawberry\c\lib
       DBNAME=-ldb

4.    Compile and install
       Go back to previous command window and run:
           perl Makefile.PL
           dmake
           dmake test
       If test is ok, please install:
           dmake install

After installation, please use below perl script to test if the BerkeleyDB module works well.

use strict;
use lib "C:\strawberry\perl\site\lib\BerkeleyDB";
use BerkeleyDB;

my $db;
$db = new BerkeleyDB::Btree
    -Filename => "user.db",
    -Flags => DB_INIT_LOCK|DB_CREATE
    or die "Cannot open file";
$db->db_put("apple", "red");
my $value;
print $db->db_get("apple",$value);
print $value;
undef $db;

If BerkeleyDB works well, the script should print out “red” on screen.

If you want to uninstall BerkeleyDB 4.6.21 after you got it to work for Perl, please do:
    Copy C:\Program Files\Oracle\Berkeley DB 4.6.21\bin\libdb46.dll C:\strawberry\c\bin
    Copy C:\Program Files\Oracle\Berkeley DB 4.6.21\bin\msvcp71.dll C:\strawberry\c\bin

Reference: http://win32.perl.org/wiki/index.php?title=Install_DB_File_on_Strawberry_Perl

相关阅读 更多 +
排行榜 更多 +
别惹神枪手安卓版

别惹神枪手安卓版

冒险解谜 下载
坦克战争世界

坦克战争世界

模拟经营 下载
丛林反击战

丛林反击战

飞行射击 下载