Boost logo

Boost Users :

From: Yongwei Wu (wuyongwei_at_[hidden])
Date: 2007-09-18 22:19:38


Hi all,

I read about the following discussion when I encountered a similar
issue (using -MTd -D_STLP_DEBUG=1 on the command line) and googled:

John Maddock wrote:
> Jason Ivey wrote:
> > 1>LINK : fatal error LNK1104: cannot open file
> > 'stlportstld_x.5.1.lib'
> >
> > The problem is that all of the stlport libraries are named
> > stlportstld.5.1.lib or similar. I did try to just rename the
> > library to make it match but, of course, I got a boat load of
> > unresolved external linker errors pointing to names such as
> > "stlpdx_std::basic_string." Looking at a dumpbin output of the
> > actual regex library it is linking against,
> > libboost_regex-vc80-mt-sgdp-1_34_1.lib, I found linker directives of
> > the form:
>
> Not sure, but I believe the debug versions of Boost lib's built against
> STLPort are built with __STL_DEBUG defined, so you will need to do likewise
> when building your application. Also don't forget that Boost.Regex is "Just
> a bunch of sources" so you could turn auto-linking off (define
> BOOST_REGEX_NO_LIB or BOOST_ALL_NO_LIB) and link against your own build of
> the regex sources (just build all of libs/regex/src/*.cpp into a static
> lib).

It seems to me the reason for the failure is that there are some
DLL-related conflicts. In _detect_dll_or_lib.h:

# if defined (_STLP_RUNTIME_DLL)
# if !defined (_STLP_USE_STATIC_LIB)
# if !defined (_STLP_USE_DYNAMIC_LIB)
# define _STLP_USE_DYNAMIC_LIB
# endif
# else
/* The user is forcing use of STLport as a dynamic library. We signal
 * it so that the STLport namespace will be modify to report such a
 * combination and force the user to link with the rebuilt STLport
 * library.
 */
# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
# endif
# else
# if !defined(_STLP_USE_DYNAMIC_LIB)
# if !defined (_STLP_USE_STATIC_LIB)
# define _STLP_USE_STATIC_LIB
# endif
# else
/* Idem previous remark but the user forces use of the static native
 * runtime.
 */
# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB
# endif
# endif

Is it possible that such a conflict exists when
libboost_regex-vc71-mt-sgdp-1_34_1.lib (my case) or
libboost_regex-vc80-mt-sgdp-1_34_1.lib (OP's case) is being built?

And, according to your suggestion, if I manually build
libboost_regex-vc71-mt-sgdp-1_34_1.lib with

  cl /MTd /D_STLP_DEBUG=1 *.cpp

followed by

  lib /out:libboost_regex-vc71-mt-sgdp-1_34_1.lib *.obj

Everything is fine.

Another thing to notice here is that unlike the case of STLport 4.6.2,
files like boost*p-1_34_1.lib and boost*p-1_34_1.dll are NOT created.
Is it related?

BTW, without -D__STL_DEBUG=1 or -D_STLP_DEBUG=1 Boost will complain
"STLPort debug versions are built with /D_STLP_DEBUG=1" and "Build
options aren't compatible with pre-built libraries", so this should
not be an issue.

Comments?

Best regards,

Yongwei

-- 
Wu Yongwei
URL: http://wyw.dcweb.cn/

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net