On 17.02.2019 6:20, Mark wrote:
>
> I installed clang v9.0 on a windows 7 asset. I installed boost and compiled it as follows:
>
> C:\Temp\boost_1_69_0>bootstrap.bat –toolset=clang
> C:\Temp\boost_1_69_0> b2 -j8 toolset=clang address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --layout=versioned --build-type=complete stage
[...]
>
> Banging my head against a linker issue shown below. One incredibly confusing aspect with the output below is the Visual Studio 2017 Professional references. I'm not interested in using visual studio at all yet it appears Visual Studio 2017 runtime headers are being referenced. This is my first rodeo with clang on a Windows asset and wasn't anticipating this much pain. I suspect I'm not in the right forum but hopeful someone can help. Thoughts?
It appears clang is indeed using Microsoft runtimes on Windows.
From
https://clang.llvm.org/docs/MSVCCompatibility.html :
"If you don’t require MSVC ABI compatibility or don’t want to use
Microsoft’s C and C++ runtimes, the mingw32 toolchain might be a better
fit for your project."
> C:\\lib\\boost_1_69_0\boost/date_time/c_time.hpp:101:23: warning: 'localtime' is deprecated: This function or variable may be unsafe. Consider using localtime_s instead. To disable deprecation, use
> _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
> result = std::localtime(t);
Welcome to the MS world! You will need to define several macros and
pragmas to get standards-conforming code compiling cleanly.
> main-4f7529.o : error LNK2019: unresolved external symbol "__declspec(dllimport) bool __cdecl boost::this_thread::interruptible_wait(void *,struct boost::detail::mono_platform_timepoint const &)" (__imp_?interruptible_wait@this_thread@boost@@YA_NPEAXAEBUmono_platform_timepoint@detail@2@@Z) referenced in function "void __cdecl boost::this_thread::sleep_for<__int64,class boost::ratio<1,1> >(class boost::chrono::duration<__int64,class boost::ratio<1,1> > const &)" (??$sleep_for@_JV?$ratio@$00$00@boost@@@this_thread@boost@@YAXAEBV?$duration@_JV?$ratio@$00$00@boost@@@chrono@1@@Z)
You have instructed the boost libraries to be built as static
(link=static), but here some main program is linked against a
non-existing dynamic library (__declspec(dllimport)). This is likely a
glitch in the boost build system, the support for static libraries has
been flaky all the time. Suggesting to seek help in a Boost forum.
PS. The standard threading support in current C++ compilers, including
VS2017, is pretty good, so you might consider porting your threading
code to standard C++ instead. The main Boost features missing in std are
thread cancellation and implicit detach, both of which are a bit
error-prone and should be avoided anyway.