Passing defines to b2 ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Passing defines to b2 ?

Boost - Build mailing list
Hi.

I'm currently exploring options for how I build all my packages
(linux, basically Beyond Linux From Scratch). After successfully using

./b2 stage cxxflags="$CXXFLAGS" threading=multi link=shared -d+2

with CXXFLAGS of initially -O2 -march=native, later reduced to
 -march=native to keep the default -O3, I started to look at hardening
options to find out where the problems are, and if any cost is
worthwhile. And no,
-march=native is not necessarily a good idea, but in verbose builds it
tells me if my flags are being used.

Now I'm looking at the first of the cheap hardening options (on gcc) :
-D_FORTIFY_SOURCE=2 but b2 has a strong dislike of  -D.

After looking around, it appears that this needs to be in a jam file,
possibly in a form like <define>\_FORTIFY\_SOURCE\=2 but I'm making no
progress on this. Also, I could not find any guide to whether the
underscores need to be escaped, I just started with those and found
that the = definitely needed to be escaped. I've created
user-config.jam:

using gcc : : : <compileflags>-march=native<compileflags>_FORTIFY_SOURCE\=2 ;
project user-config ;

(using gcc through to 2; is all on one line, gmail insists on breaking it up)

Any guidance, please ?
_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Passing defines to b2 ?

Boost - Build mailing list
On Fri, 31 May 2019 at 11:44, Ken Moffat via Boost-build
<[hidden email]> wrote:
>
> Now I'm looking at the first of the cheap hardening options (on gcc) :
> -D_FORTIFY_SOURCE=2 but b2 has a strong dislike of  -D.

b2 app optimization=full define=USE_ASM

see that example (and explanation) in this section
https://boostorg.github.io/build/manual/develop/index.html#bbv2.tutorial.libs

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Passing defines to b2 ?

Boost - Build mailing list
On Fri, 31 May 2019 at 10:48, Mateusz Loskot via Boost-build
<[hidden email]> wrote:

>
> On Fri, 31 May 2019 at 11:44, Ken Moffat via Boost-build
> <[hidden email]> wrote:
> >
> > Now I'm looking at the first of the cheap hardening options (on gcc) :
> > -D_FORTIFY_SOURCE=2 but b2 has a strong dislike of  -D.
>
> b2 app optimization=full define=USE_ASM
>
> see that example (and explanation) in this section
> https://boostorg.github.io/build/manual/develop/index.html#bbv2.tutorial.libs
>
> Best regards,
>
Thanks. For building boost itself, a quick partial build with a bit more
than the things I'm currently testing:

./b2 stage cxxflags="-march=native -fstack-protector-strong" \
define=_FORTIFY_SOURCE=2  define=_GLIBCXX_ASSERTIONS threading=multi \
link=shared -d+2

showed the process works (all get added to the existing -O3). I've
spelled that out in the hope google can find it - unfortunately most
of my searching for b2 boost fortify came up with stuff about
vitamins. And I've made a note of where the manual is.
_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build