[pybsddb] Windows compilation error?
hasanyasin
hasanyasin at cubicpen.com
Thu Mar 10 05:36:14 CET 2011
Hello Everybody,
I had some time today and built it on virtualbox successfully. I also
tried to write everything I did during the process. You can download the
binary from:
http://code.google.com/p/pybsddb-win/downloads/list
If you want to build it yourself here is what I did:
Download and install Python:
I have downloaded windows installer from:
http://www.python.org/download/
Then install it to the default folder which is created
automatically on root of C: driver.
Download and install MS Visual C++ Express from microsoft website:
I have downloaded it from http://www.microsoft.com/express/
It is just a small installer which itself downloads the required
files during installation.
For now, python buildtools does not support 2010 version, so, you
should install 2008.
Download pybsddb3 Package from python.org:
I have downloaded the zip file from
http://pypi.python.org/pypi/bsddb3/ then extracted it.
Now I have a folder which contains pybsddb3 source and setup files.
Download berkely db from oracle. Free member registration is required.
I have downloaded windows installer from
http://www.oracle.com/technetwork/database/berkeleydb/downloads/index.html
to not to be have to build bdb too. If you want to have a custom
build bdb, then you can download zip/tar.gz files from that page and
follow the very clear instructions in docs.
After installing the bdb using automatic installer with default
settings, I copied the files from bdb installation folder to pybsddb3
source folder and renamed it to "db"
c:\bsddb3-5.1.2\
bsddb3.egg-info <dir>
db <dir> # the folder I copied from C:\Program
Files\Oracle\Berkeley DB 11gR2 5.1.25 to here.
include <dir> # in db folder
lib <dir> # in db folder
docs <dir>
Lib <dir>
Lib3 <dir>
Modules <dir>
ChangeLog
make3.py
MANIFEST.in
PKG-INFO
README
... etc.
There are many other files such as setup.py, setup2.py, etc. I gave
the partial contents here to make clear the folder structure we will use.
I also copied db/lib/libdb51.lib file in the same folder as
db/lib/libdb51s.lib because of a simple bug at somewhere I don't remember.
I then open a command promt (win+r, cmd, run) and cd into the folder:
C:\Documents and Settings\hasanyasin>cd \bsddb3-5.1.2
C:\bsddb3-5.1.2>\Python27\python.exe setup.py bdist --formats=wininst
Now this should work and after building is done, there should be the
executable automatic installer in newly-created "dist" folder.
However, it stopped throwing an exception about db_ver_list is not
defined in setup2.py on line 321.
After having a look at setup2.py source, I thought that this part was
not updated for a long time. The problematic part was to check db
version and
pybsddb compability. Since we already know that we had compatible
components, I safely removed lines 321, 322, and 323 from the code as a
temporary lazy-man solution.
315 for line in db_h_lines:
316 match = db_ver_re.match(line)
317 if not match:
318 continue
319 fullverstr = match.group(1)
320 ver = fullverstr[0] + fullverstr[2] # 31 == 3.1, 32 == 3.2,
etc.
--- assert (fullverstr[0], fullverstr[2]) in db_ver_list, (
--- "pybsddb untested with this Berkeley DB version", ver)
--- print 'Detected Berkeley DB version', ver, 'from db.h'
324
325 if debug:
326 libname = ['libdb%ssd' % ver] # Debug, static
327 else:
328 libname = ['libdb%ss' % ver] # Release, static
For some other problem, again a dirty and ugly trick: Changing
runtime_library_dirs parameter's value with None from [ libdir ] as below:
385 runtime_library_dirs = None, #[ libdir ],
After these ugly changes,
C:\bsddb3-5.1.2>\Python27\python.exe setup.py bdist --formats=wininst
worked without any problems and I got the installer in dist folder which
was created during build process.
Now you have your installer. A friendly suggestion: Leave windows as
soon as possible switching to a free posix system such as bsd or linux.
hasanyasin.phila
On 03/09/2011 08:00 PM, Jesus Cea wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 09/03/11 09:49, sujoy chaudhuri wrote:
>> "error: Python was built with Visual Studio 2003; extensions must be built with a compiler than can generate compatible binaries. Visual Studio 2003 was not found on this system. If you have Cygwin installed, you can try compiling with MingW32, by passing "-c mingw32" to setup.py."
> I can't help you. I have zero experience compiling in Windows.
>
> Can I suggest you ask in python-list how to compile python sourcecode in
> MS Windows?. Knowing that would help you to compile pybsddb.
>
> And sure there are people out there that actually know how to compile
> python on Microsoft platform :).
>
> After that, please document the steps to relieve other people's pains.
>
> Sorry. I would like to be more useful. Good luck.
>
> - --
> Jesus Cea Avion _/_/ _/_/_/ _/_/_/
> jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/
> jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/_/_/_/
> . _/_/ _/_/ _/_/ _/_/ _/_/
> "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/
> "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/
> "El amor es poner tu felicidad en la felicidad de otro" - Leibniz
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iQCVAwUBTXgiwJlgi5GaxT1NAQLsugP/UWlbqO2OKaq0YV2mIB28V13yx2FGSsoV
> kT4XH/UlizRbyPGnStZ3n3LHIPKYoGTS0ACiY0IottcSgLb3QLR9SvBF9unauzJ+
> XqpSsEp+2VEOYZLbxcWWQ49wBER4vOxWxuy7Ktz0aHUIJDXhS64uhrRtlVNUFE9O
> /vf/ywKQB9M=
> =lGbU
> -----END PGP SIGNATURE-----
> _______________________________________________
> pybsddb mailing list
> pybsddb at jcea.es
> https://mailman.jcea.es/listinfo/pybsddb
> http://www.jcea.es/programacion/pybsddb.htm
More information about the pybsddb
mailing list