Boost logo

Boost :

Subject: Re: [boost] Clang on Windows
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2018-03-16 12:04:37


> -----Original Message-----
> From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of degski via Boost
> Sent: 16 March 2018 11:20
> To: boost
> Cc: degski
> Subject: Re: [boost] Clang on Windows
>
> On 15 March 2018 at 13:30, Marcel Raad via Boost <boost_at_[hidden]>
> wrote:
>
> > > -----Original Message-----
> > > From: Boost <boost-bounces_at_[hidden]> On Behalf Of Paul A. Bristow
> > > via Boost
> > > Sent: Donnerstag, 15. März 2018 19:05
> > > To: boost_at_[hidden]
> > > Cc: Paul A. Bristow <pbristow_at_[hidden]>
> > > Subject: Re: [boost] Clang on Windows
> > >
> > > 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.
> >
> > I've seen this error when /SUBSYSTEM:CONSOLE wasn't passed to the MSVC
> > linker.
> >
>
> If you'd do that, you'll have an issue, but... I've just tested building an
> app not passing /SUBSYSTEM:CONSOLE. It builds and runs, but of course
> there's no console window (something flashes up, no error or problem).

I see this error on Codeblocks IDE which runs the .exe via a console,
but also when built using bjam/b2. So I'm not sure if this is relevant?
 
> I think the -flto=thin flag is possibly not properly passed around, or the
> vc linker (link.exe) is invoked instead of lld.exe.

I'll look into this. I note that John Maddock has <linkflags>-lmsvcrt

Should I have x86_64-pc-windows-mgwin rather than x86_64-pc-windows-msvc?

> As OP's libs are lto instrumented, they can only be linked with lld and the flag -flto=thin.

This is a useful info. I was unclear if/which linker should be used.
(I hoped that either were useable - always the optimist!)

Thanks

Paul
 


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