Project

General

Profile

Building WT on MSVS2005 for win platform

Added by Alex Private almost 13 years ago

Hello

While building with BOOST_DYNAMIC and SHARED_LIBS on I get

libboost_thread-vc80-mt-1_46_1.lib(thread.obj) : error LNK2005: "void * __cdecl boost::detail::get_tss_data(void const *)" (?get_tss_datadetail@boost@@YAPAXPBXZ) already defined in boost_thread-vc80-mt-1_46_1.lib(boost_thread-vc80-mt-1_46_1.dll)

libboost_thread-vc80-mt-1_46_1.lib(thread.obj) : error LNK2005: "public: __thiscall boost::thread::thread(void)" (??0threadboost@@QAEXZ) already defined in boost_thread-vc80-mt-1_46_1.lib(boost_thread-vc80-mt-1_46_1.dll)

libboost_thread-vc80-mt-1_46_1.lib(thread.obj) : error LNK2005: "public: bool __thiscall boost::thread::joinable(void)const " (?joinablethread@boost@QBE_NXZ) already defined in boost_thread-vc80-mt-1_46_1.lib(boost_thread-vc80-mt-1_46_1.dll)

libboost_thread-vc80-mt-1_46_1.lib(thread.obj) : error LNK2005: "public: __thiscall boost::thread::~thread(void)" (??1threadboost@@QAEXZ) already defined in boost_thread-vc80-mt-1_46_1.lib(boost_thread-vc80-mt-1_46_1.dll)

libboost_thread-vc80-mt-1_46_1.lib(thread.obj) : error LNK2005: "private: void __thiscall boost::thread::start_thread(void)" (?start_threadthread@boost@AAEXXZ) already defined in boost_thread-vc80-mt-1_46_1.lib(boost_thread-vc80-mt-1_46_1.dll)

libboost_thread-vc80-mt-1_46_1.lib(thread.obj) : error LNK2005: "void __cdecl boost::detail::set_tss_data(void const ,class boost::shared_ptr,void,bool)" (?set_tss_datadetail@boost@YAXPBXV?$shared_ptrUtss\_cleanup\_function@detail@boost@@2PAX\_NZ) already defined in boost_thread-vc80-mt-1_46_1.lib(boost_thread-vc80-mt-1_46_1.dll)

libboost_thread-vc80-mt-1_46_1.lib(thread.obj) : error LNK2005: "public: __thiscall boost::gregorian::greg_month::greg_month(unsigned short)" (??0greg_monthgregorian@boost@QAEGZ) already defined in boost_date_time-vc80-mt-1_46_1.lib(boost_date_time-vc80-mt-1_46_1.dll)

libboost_thread-vc80-mt-1_46_1.lib(thread.obj) : error LNK2005: "bool __cdecl boost::this_thread::interruptible_wait(void *,struct boost::detail::timeout)" (?interruptible_waitthis\_thread@boost@YA_NPAXUtimeoutdetail@2@Z) already defined in boost_thread-vc80-mt-1_46_1.lib(boost_thread-vc80-mt-1_46_1.dll)

libboost_thread-vc80-mt-1_46_1.lib(thread.obj) : error LNK2005: "public: void __thiscall boost::thread::join(void)" (?jointhread@boost@QAEXXZ) already defined in boost_thread-vc80-mt-1_46_1.lib(boost_thread-vc80-mt-1_46_1.dll)

(I've followed http://redmine.webtoolkit.eu/wiki/1/Installing_Wt_on_MS_Windows - that generates libboost** static libs, ok, but when compiling WT it wants boost** AND libboost_* to compile the project... so I had to build those too, but then the abovementioned problem appears... I'm totally lost here)

also I have to edit the wrong path in cmake_install.cmake (line 33)

FILE (INSTALL DESTINATION "C:/Program Files/WT/C:/Program Files/CMake 2.8/share/cmake-2.8/Modules" TYPE FILE FILES "D:/devel/lib/MSVC/wt-3.2.1/cmake/FindWt.cmake") - is that a bug or have I configured something wrong?


Replies (9)

RE: Building WT on MSVS2005 for win platform - Added by Alex Private almost 13 years ago

and when building with BOOST_DYNAMIC off I get only

libboost_thread-vc80-mt-1_46_1.lib(thread.obj) : error LNK2005: "bool __cdecl boost::this_thread::interruptible_wait(void *,struct boost::detail::timeout)" (?interruptible_waitthis\_thread@boost@YA_NPAXUtimeoutdetail@2@Z) already defined in boost_thread-vc80-mt-1_46_1.lib(boost_thread-vc80-mt-1_46_1.dll)

in wtdbo project (forgot to mention that in prev post, happens only in wtdbo too, everything else compiles normally)

RE: Building WT on MSVS2005 for win platform - Added by Wim Dumon almost 13 years ago

Hello Alex,

I believe the key to the solution is that little thing you mention about including two versions of the boost libraries. It is clear that they clash; you're not supposed to do that.

Do you only have a problem when building with BOOST_DYNAMIC and SHARED_LIBS? Does a static Wt/Boost combination (=the default) give similar problems?

Wim.

RE: Building WT on MSVS2005 for win platform - Added by Alex Private almost 13 years ago

Hello Wim! Thanks for reply. I've been stydying examples on 3.1.9 (compiled long time ago and not by me) on this PC today, but getting 3.2.1 to compile would be sweet.

The "out of the box" configuration works just fine - compiles without any errors and the result is a bunch of huge .lib files (wt.lib ~120Mb and wtd.lib ~240Mb for example) - is that size normal?..

Btw, tried to compile 3.1.11 half an hour ago - went almost flawlessly except one noncritical unresolved external (wmedia) but generally it compiles and works fine.

But when building 3.2.0 and 3.2.1 I get the clash between libboost_thread-vc80-mt-1_46_1.lib and boost_thread-vc80-mt-1_46_1.lib - is that because of an incorrect BOOST build? To build everything possible in boost 1.46.1 I used the following commands:

bjam -j2 ---build-type=complete ---layout=versioned ---toolset=msvc-8.0 threading=multi link=static runtime-link=static

bjam -j2 ---build-type=complete ---layout=versioned ---toolset=msvc-8.0 threading=multi link=static runtime-link=shared

bjam -j2 ---build-type=complete ---layout=versioned ---toolset=msvc-8.0 threading=multi link=shared runtime-link=shared

then I got

boost_module-vc80-mt-1_46_1.dll

boost_module-vc80-mt-gd-1_46_1.dll

boost_module-vc80-mt-gd.lib

boost_module-vc80-mt.lib

and

libboost_module-vc80-mt-1_46_1.lib

libboost_module-vc80-mt-gd-1_46_1.lib

libboost_module-vc80-mt-gd.lib

libboost_module-vc80-mt-s-1_46_1.lib

libboost_module-vc80-mt-s.lib

libboost_module-vc80-mt-sgd-1_46_1.lib

libboost_module-vc80-mt-sgd.lib

libboost_module-vc80-mt.lib

is that ok?

RE: Building WT on MSVS2005 for win platform - Added by Alex Private almost 13 years ago

update:

got it working with BOOST_DYNAMIC=false, but still, it would be very educative to know why the linker doesn't like it when it's true?

RE: Building WT on MSVS2005 for win platform - Added by Alex Private almost 13 years ago

edit: sigh I have to check things more carefully before posting. Went fine for release, but the problem persists for debug build (should the linker see boost dll's at all if BOOST_DYNAMIC=false?..)

wt debug project:

libboost_thread-vc80-mt-gd-1_46_1.lib(thread.obj) : error LNK2005: "public: __thiscall boost::gregorian::greg_month::greg_month(unsigned short)" (??0greg_monthgregorian@boost@QAEGZ) already defined in boost_date_time-vc80-mt-gd-1_46_1.lib(boost_date_time-vc80-mt-gd-1_46_1.dll)

libboost_thread-vc80-mt-gd-1_46_1.lib(thread.obj) : error LNK2005: "public: __thiscall boost::gregorian::greg_month::operator unsigned short(void)const " (??Bgreg_monthgregorian@boost@QBEGXZ) already defined in boost_date_time-vc80-mt-gd-1_46_1.lib(boost_date_time-vc80-mt-gd-1_46_1.dll)

libboost_thread-vc80-mt-gd-1_46_1.lib(thread.obj) : error LNK2005: "public: __thiscall boost::thread::thread(void)" (??0threadboost@QAEXZ) already defined in boost_thread-vc80-mt-gd-1_46_1.lib(boost_thread-vc80-mt-gd-1_46_1.dll)
libboost_thread-vc80-mt-gd-1_46_1.lib(thread.obj) : error LNK2005: "private: void __thiscall boost::thread::start_thread(void)" (?start_thread
threadboost@AAEXXZ) already defined in boost_thread-vc80-mt-gd-1_46_1.lib(boost_thread-vc80-mt-gd-1_46_1.dll)

libboost_thread-vc80-mt-gd-1_46_1.lib(thread.obj) : error LNK2005: "public: __thiscall boost::thread::~thread(void)" (??1threadboost@QAEXZ) already defined in boost_thread-vc80-mt-gd-1_46_1.lib(boost_thread-vc80-mt-gd-1_46_1.dll)
libboost_thread-vc80-mt-gd-1_46_1.lib(thread.obj) : error LNK2005: "public: bool __thiscall boost::thread::joinable(void)const " (?joinable
threadboost@QBE_NXZ) already defined in boost_thread-vc80-mt-gd-1_46_1.lib(boost_thread-vc80-mt-gd-1_46_1.dll)

libboost_thread-vc80-mt-gd-1_46_1.lib(thread.obj) : error LNK2005: "public: void __thiscall boost::thread::join(void)" (?jointhread@boost@QAEXXZ) already defined in boost_thread-vc80-mt-gd-1_46_1.lib(boost_thread-vc80-mt-gd-1_46_1.dll)

libboost_thread-vc80-mt-gd-1_46_1.lib(thread.obj) : error LNK2005: "bool __cdecl boost::this_thread::interruptible_wait(void *,struct boost::detail::timeout)" (?interruptible_waitthis\_thread@boost@YA_NPAXUtimeoutdetail@2@Z) already defined in boost_thread-vc80-mt-gd-1_46_1.lib(boost_thread-vc80-mt-gd-1_46_1.dll)

libboost_thread-vc80-mt-gd-1_46_1.lib(thread.obj) : error LNK2005: "void * __cdecl boost::detail::get_tss_data(void const *)" (?get_tss_datadetail@boost@YAPAXPBXZ) already defined in boost_thread-vc80-mt-gd-1_46_1.lib(boost_thread-vc80-mt-gd-1_46_1.dll)
libboost_thread-vc80-mt-gd-1_46_1.lib(thread.obj) : error LNK2005: "void __cdecl boost::detail::set_tss_data(void const *,class boost::shared_ptr<struct boost::detail::tss_cleanup_function>,void *,bool)" (?set_tss_data
detailboost@YAXPBXV?$shared_ptrUtss\_cleanup\_function@detail@boost@@2PAX\_NZ) already defined in boost_thread-vc80-mt-gd-1_46_1.lib(boost_thread-vc80-mt-gd-1_46_1.dll)

wtdbo project:

libboost_thread-vc80-mt-gd-1_46_1.lib(thread.obj) : error LNK2005: "public: __thiscall boost::gregorian::greg_month::greg_month(unsigned short)" (??0greg_monthgregorian@boost@QAEGZ) already defined in boost_date_time-vc80-mt-gd-1_46_1.lib(boost_date_time-vc80-mt-gd-1_46_1.dll)

libboost_thread-vc80-mt-gd-1_46_1.lib(thread.obj) : error LNK2005: "public: __thiscall boost::gregorian::greg_month::operator unsigned short(void)const " (??Bgreg_monthgregorian@boost@QBEGXZ) already defined in boost_date_time-vc80-mt-gd-1_46_1.lib(boost_date_time-vc80-mt-gd-1_46_1.dll)

libboost_thread-vc80-mt-gd-1_46_1.lib(thread.obj) : error LNK2005: "bool __cdecl boost::this_thread::interruptible_wait(void *,struct boost::detail::timeout)" (?interruptible_waitthis\_thread@boost@YA_NPAXUtimeoutdetail@2@Z) already defined in boost_thread-vc80-mt-gd-1_46_1.lib(boost_thread-vc80-mt-gd-1_46_1.dll)

RE: Building WT on MSVS2005 for win platform - Added by Alex Private almost 13 years ago

mm, compiling the first example with the 3.2.1 gives

1>main.obj : error LNK2001: unresolved external symbol "struct Wt::WtLibVersion const Wt::WtWT_VERSION" (?WtWT_VERSIONWt@3UWtLibVersion1B)

(triple checked bin, include and lib paths - all pointing to the newly generated 3.2.1 :/) is that somehow related to the previous problems?..

RE: Building WT on MSVS2005 for win platform - Added by Alex Private almost 13 years ago

update: I don't understand the dark magic behind this but adding

_CRT_NONSTDC_NO_WARNINGS

to preprocessor definitions solved all of the previously mentioned problems with boost when compiling WT... I took that one from a working project... It will take quite some time to study all the WT .h files to understand what is happening and why %)

Also, MSVS2005 compiles examples only when all of

WIN32

_WINDOWS

_CRT_NONSTDC_NO_WARNINGS

NOMINMAX

prep. defs are set for a project. Should I know those things before "jumping into the deep" or are they documented somewhere?

RE: Building WT on MSVS2005 for win platform - Added by S van der Hoest almost 13 years ago

Hi Alex,

I succeeded in building Wt with BOOST_DYNAMIC and SHARED_LIBS.

Most of it at least, I still get errors in 3 projects (WtExt, WidgetGallery, and Test).

The 'Hello' example runs fine though.

I updated the following post with instructions:

http://redmine.webtoolkit.eu/boards/2/topics/3574

Hope this helps.

Note that I used VS 2008, as I do not have VS 2005.

RE: Building WT on MSVS2005 for win platform - Added by Wim Dumon almost 13 years ago

Thank you for reporting; patches will be in git soon. I tested with MSVS 2008 and boost 1.50, building Wt DLLs using boost DLLs.

    (1-9/9)