Use CPAN BerkeleyDB module on Windows 7 (64 bit)

2019-08-10 11:30发布

问题:

I have been trying to install the BerkeleyDB CPAN module on my Windows 7 (x86_64) PC without any luck (BerkeleyDB::Hash is what I need). I have 64 bit ActivePerl and Oracle Berkeley DB 11gR2 5.3.15 installed. First I tried installing using the command :

*cpan install BerkeleyDB*

This came back with the error:

*It looks like the installation of dmake and MinGW has failed.  You will not be
able to run Makefile commands or compile C extension code.  Please check your
internet connection and your proxy settings!*

So I installed Microsoft Windows SDK for Windows 7 and .NET Framework 4.

Then I installed cpanm

*cpan App::cpanminus*

And when I tried running:

*cpanm BerkeleyDB*

I got the error:

*Note (probably harmless): No library found for -llibdb
Note (probably harmless): No library found for bufferoverflowU.lib*

So I edited the config.in file and changed the lib and include paths to:

*INCLUDE    =  C:\PROGRA~2\Oracle\BERKEL~1.15\include
LIB =  C:\PROGRA~2\Oracle\BERKEL~1.15\lib*

Now when I ran perl makefile.pl, the warning about -llibdb went away.

When I tried running:

 *nmake* 

I got errors:

  *Creating library blib\arch\auto\BerkeleyDB\BerkeleyDB.lib and object blib\arc
h\auto\BerkeleyDB\BerkeleyDB.exp
BerkeleyDB.obj : error LNK2001: unresolved external symbol __heap_exist
BerkeleyDB.obj : error LNK2001: unresolved external symbol db_version
BerkeleyDB.obj : error LNK2001: unresolved external symbol db_strerror
BerkeleyDB.obj : error LNK2001: unresolved external symbol db_env_create
BerkeleyDB.obj : error LNK2001: unresolved external symbol db_create
BerkeleyDB.obj : error LNK2001: unresolved external symbol db_sequence_create
blib\arch\auto\BerkeleyDB\BerkeleyDB.dll : fatal error LNK1120: 6 unresolved ext
ernals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\Bin\amd64\link.EXE"' : return code '0x460'
Stop.*

I've nearly lost all hope of ever building this module successfully on my PC. Has anyone been lucky with this?

Many thanks,

SN

回答1:

All following claims untested/unverified. Competent advice is available from #win32 on MagNET <irc://irc.perl.org/win32> (Web chat).

libdb needs patching for 64-bit. Installing a whole new compiler toolchain before installing the dependent library and its headers made the problem worse. If you continue to have problems linking after applying the patch, uninstall the MS tools and try again with MinGW.