Boost logo

Boost :

Subject: Re: [boost] Clang on Windows
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2018-03-15 18:05:11


> -----Original Message-----
> From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of Edward Diener via Boost
> Sent: 10 March 2018 13:39
> To: boost_at_[hidden]
> Cc: Edward Diener
> Subject: Re: [boost] Clang on Windows
>
> On 3/10/2018 3:38 AM, John Maddock via Boost wrote:
> >
> >> My use of clang-cl with clang-5.0 for x32 compilation looks like:
> >>
> >> using clang : 5.0cl : C:/Utilities/LLVM/500/x32/bin/clang++
> >> :
> >> <cxxflags>-fmacro-backtrace-limit=0
> >> <cxxflags>-Wno-invalid-token-paste
> >> <compileflags>-fmsc-version=1900
> >> <compileflags>--target=i686-pc-windows-msvc
> >> <linkflags>--target=i686-pc-windows-msvc
> >> <linkflags>-fuse-ld=lld
> >> ;
> >>
> >> It works for me pretty well when invoked as toolset=clang-5.0cl on the
> >> b2 command line. Before invoking b2 I am also doing:
> >>
> >> call "C:\Program Files (x86)\Microsoft Visual Studio
> >> 14.0\VC\vcvarsall.bat" x86
> >>
> >> in order to setup vc++.
> >>
> >> For x64 compilation it looks like:
> >>
> >> using clang : 5.0x64cl : C:/Utilities/LLVM/500/x64/bin/clang++
> >> :
> >> <cxxflags>-fmacro-backtrace-limit=0
> >> <cxxflags>-Wno-invalid-token-paste
> >> <compileflags>-fmsc-version=1900
> >> <compileflags>--target=x86_64-pc-windows-msvc
> >> <linkflags>--target=x86_64-pc-windows-msvc
> >> <linkflags>-fuse-ld=lld
> >> ;
> >>
> >
> > Thanks for that, I have things semi-working with:
> >
> > using clang : 6.0 : "C:/Program Files/LLVM/bin/clang.exe" :
> > <cxxflags>-fmacro-backtrace-limit=0
> > <cxxstd>17
> > <cxxflags>-Wno-invalid-token-paste
> > <compileflags>-fmsc-version=1900
> > <compileflags>--target=x86_64-pc-windows-msvc
> > <linkflags>--target=x86_64-pc-windows-msvc
> > <linkflags>-lmsvcrt
> > <linkflags>-lkernel32
> > <linkflags>-luser32
> > ;
> >
> > But:
> >
> > * I can't build dll's, so I need link=static on the command line.
> > * The cxxstd invocation in user-config.jam doesn't work - and clang.jam
> > appends -std=c++11 to the clang command line which breaks several MS
> > headers. Adding cxxstd=17 to the b2 command line fixes that, but it's a
> > pain.
> > * I'm still getting linker errors I haven't been able to resolve for
> > system calls even with the references to Kernal32 and User32 as above.
> >
> > I really think we should be using clang-cl, as I suspect it would solve
> > most of this stuff...

I have also been investigating (fumbling with) this can of worms. (Lots of details attached)

I have got some things to work, but linking libraries produces an inexplicable (to me) link failure when trying to use Boost.Test and Clang.

I have tried this on Codeblocks when I can link to Chrono library OK, but when I try to use Boost.Test using the same test.cpp that passes using GCC7.1.0, I get a final failure

LINK : fatal error LNK1561: entry point must be defined

There is not a int main() but Boost.Test's own entry function

int unit_test_main( init_unit_test_func init_func, int argc, char* argv[] );

that I presume should be fed in place of int main()

Is this a Boost.Test config problem that makes Clang and GCC different , or am I doing something silly.

Suggestions welcome.

Paul

msvcrt.lib




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk