This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Windows _bsddb link warnings
Type: Stage:
Components: Windows Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: gregory.p.smith, loewis, robind, theller, tim.peters
Priority: normal Keywords:

Created on 2003-08-01 17:04 by robind, last changed 2022-04-10 16:10 by admin. This issue is now closed.

Messages (8)
msg17564 - (view) Author: Robin Dunn (robind) Date: 2003-08-01 17:04
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.
msg17565 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-08-01 19:50
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.
msg17566 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2004-02-16 23:54
Logged In: YES 
user_id=31435

Thomas, you have any insight into this one?
msg17567 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2004-02-18 17:41
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...
msg17568 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-02-18 19:58
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.
msg17569 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2004-02-18 20:18
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.
msg17570 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2006-04-12 20:50
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)
msg17571 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-04-13 05:11
Logged In: YES 
user_id=21627

Right. This problem was fixed with r43002.
History
Date User Action Args
2022-04-10 16:10:27adminsetgithub: 38995
2003-08-01 17:04:02robindcreate