[ python-Bugs-781614 ] Windows _bsddb link warnings

SourceForge.net noreply at sourceforge.net
Wed Apr 12 22:50:05 CEST 2006


Bugs item #781614, was opened at 2003-08-01 10:04
Message generated for change (Comment added) made by greg
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=781614&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Windows
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Robin Dunn (robind)
Assigned to: Nobody/Anonymous (nobody)
Summary: Windows _bsddb link warnings

Initial Comment:
Hi,

The PCbuild/readme.txt says this:

'''
    XXX We're actually linking against
Release_static\libdb41s.lib.
    XXX This yields the following warnings:
"""
Compiling...
_bsddb.c
Linking...
   Creating library ./_bsddb.lib and object ./_bsddb.exp
LINK : warning LNK4049: locally defined symbol
"_malloc" imported
LINK : warning LNK4049: locally defined symbol "_free"
imported
LINK : warning LNK4049: locally defined symbol
"_fclose" imported
LINK : warning LNK4049: locally defined symbol "_fopen"
imported
_bsddb.pyd - 0 error(s), 4 warning(s)
"""
    XXX This isn't encouraging, but I don't know what
to do about it.
'''

The cause of this is the fact that libdb41s.lib is
built with the flags for using the "Multithreaded" C
RTL but Python uses the "MUltithreaded DLL" C RTL.  In
other words, libdb is specifying that the C RTL should
be linked statically but Python wants to link to it
statically. 

To avoid these warnings the instructions can be changed
to specify that the builder should change the flags in
the Berkeley_DB project.  Also you should probably link
with the Debug_static\libdb41sd.lib when building the
debug version of Python.


----------------------------------------------------------------------

>Comment By: Gregory P. Smith (greg)
Date: 2006-04-12 13:50

Message:
Logged In: YES 
user_id=413

I believe BerkeleyDB 4.4 when compiled on windows uses the
multithreaded DLL C RTL by default even for its static
library now so this error should go away?  i think this
problem is gone for the latest BerkeleyDB and is just a
PCbuild readme.txt documentation problem for older
BerkeleyDB versions.

in the past for stand alone pybsddb bsddb3 packages i always
had to change the static build settings of BerkeleyDB to use
multi-threaded DLL code generation (/MD flag on cl.exe). 
With 4.4 i didn't need to do that.

(note we weren't linking with the berkeleydb DLL; its the
berkeleydb static library, its just that a python extension
module is a DLL so the static library code needed to use the
same memory model)

----------------------------------------------------------------------

Comment By: Thomas Heller (theller)
Date: 2004-02-18 12:18

Message:
Logged In: YES 
user_id=11105

Potentially dangerous - of course.  The question is whether
this is responsible for some bugs or not.

If we cannot link to the DLL then we have to change the
build settings for the static builds of libdb41s.lib.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2004-02-18 11:58

Message:
Logged In: YES 
user_id=21627

I think we should avoid linking with the DLL if possible; in
some application context, it may be impossible to find the
DLL dynamically, or there might be confusion which DLL to load.

The linker warning means that there is a conflict between
the static (libc.a) and dynamic (msvcr71.dll) version of
_free, etc, which potentially means that we are linking
conflicting copies of the CRT, which is potentially dangerous.

----------------------------------------------------------------------

Comment By: Thomas Heller (theller)
Date: 2004-02-18 09:41

Message:
Logged In: YES 
user_id=11105

It looks to me like we could link to the import library
build_win32\Release\libdb41.lib instead of  the static
library build_win32\Release_static\libdb41s.lib.

The former is built with 'multithreaded dll' flags.  The
downside is that libdb41.dll plus MSVCP60.DLL would have to
be distributed.

Are the linker warnings a real problem, or only cosmetical?

Of course we have to update the build procedure for 2.4
anyway...

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2004-02-16 15:54

Message:
Logged In: YES 
user_id=31435

Thomas, you have any insight into this one?

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2003-08-01 12:50

Message:
Logged In: YES 
user_id=21627

Can you propose a specific patch?

Also, it would be preferable if changing the source code of
the Sleepycat distribution would not be necessary.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=781614&group_id=5470


More information about the Python-bugs-list mailing list