lion03 / thrust

Automatically exported from code.google.com/p/thrust
Apache License 2.0
0 stars 0 forks source link

CUDA 4.0 RC / thrust and dynamic runtime libraries under MSVC /MD #321

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

a code compiling with cuda3.2 is no longer with cuda 4.0 if the windows runtime 
libraries as choosen as dynamic.

In the cuda 4.0 SDK, the marching cube example is using thrust and is 
compiling/working.

By default, this project is using static runtime libraries /MT
A soon as I compiles with dynamic runtime libraries /MD, I obtain a bunch of 
warnings relatives to std::basic_string and linking errors...
(since my software uses compiled libraries that link dynamically I have no 
choice on this option)

This happens, as soon as the project and .cu files are compiled with /MD and 
only one thrust header file is included (a function call is not even required)

COMPILATION WARNINGS

1>tmpxft_00000564_00000000-6_marchingCubes_kernel.compute_10.cudafe1.cpp
1>tmpxft_00000564_00000000-23_marchingCubes_kernel.compute_10.ii
1>c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocinfo(193) : 
warning C4251: 'std::_Locinfo::_Days' : class 
'std::basic_string<_Elem,_Traits,_Ax>' nécessite une interface DLL pour être 
utilisé(e) par les clients de class 'std::_Locinfo'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>,
1>            _Ax=std::allocator<char>
1>     

LINKING ERRORS

1>Édition des liens en cours...
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall 
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> 
>::basic_string<char,struct std::char_traits<char>,class std::allocator<char> 
>(void)" 
(??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) déjà 
défini(e) dans marchingCubes_kernel.cu.obj
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall 
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> 
>::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> 
>(void)" 
(??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) déjà 
défini(e) dans marchingCubes_kernel.cu.obj
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: class 
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> 
> & __thiscall std::basic_string<char,struct std::char_traits<char>,class 
std::allocator<char> >::operator=(class std::basic_string<char,struct 
std::char_traits<char>,class std::allocator<char> > const &)" 
(??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@ABV01@
@Z) déjà défini(e) dans marchingCubes_kernel.cu.obj
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: class 
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> 
> & __thiscall std::basic_string<char,struct std::char_traits<char>,class 
std::allocator<char> >::operator=(char const *)" 
(??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z)
 déjà défini(e) dans marchingCubes_kernel.cu.obj
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: char const * __thiscall 
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> 
>::c_str(void)const " 
(?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) 
déjà défini(e) dans marchingCubes_kernel.cu.obj
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall 
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> 
>::basic_string<char,struct std::char_traits<char>,class std::allocator<char> 
>(char const *)" 
(??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) 
déjà défini(e) dans marchingCubes_kernel.cu.obj
1>msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall 
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> 
>::basic_string<char,struct std::char_traits<char>,class std::allocator<char> 
>(class std::basic_string<char,struct std::char_traits<char>,class 
std::allocator<char> > const &)" 
(??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) 
déjà défini(e) dans marchingCubes_kernel.cu.obj

(sorry for the french output...)

PLEASE HELP ME!!!

Original issue reported on code.google.com by matthieu.nesme@gmail.com on 9 Mar 2011 at 12:53

GoogleCodeExporter commented 8 years ago
This is not a Thrust issue.

You need to ensure that all your project's source files are compiled with 
consistent code generation options such that the same MS runtime library is 
linked in.

Original comment by jaredhoberock on 9 Mar 2011 at 6:30

GoogleCodeExporter commented 8 years ago
All the sources ARE compiled with consistent code generation.

Please try the "marching cube" example in the cuda 4.0, there is only 2 source 
files.
By default they are compiled with /MT -> no problem
and now try to compile them with /MD -> link errors

There is no problem when no Thrust files are included. And the same code is 
working correctly with cuda 3.2 + Thrust 1.3.

So please reconsider the question ;)

Original comment by matthieu.nesme@gmail.com on 10 Mar 2011 at 8:14

GoogleCodeExporter commented 8 years ago
Actually I simply tried to compile it with cuda 3.2 and the Thrust library 
distributed in the cuda 4.0 RC toolkit and it is working.
So you should have right, it is not a Thrust issue.
Do you think the problem can come from cuda 4.0 nvcc?

Original comment by matthieu.nesme@gmail.com on 10 Mar 2011 at 8:27

GoogleCodeExporter commented 8 years ago
It's possible this is an nvcc issue.

Original comment by jaredhoberock on 10 Mar 2011 at 7:03