Boost logo

Boost-Build :

Subject: Re: [Boost-build] how to remove properties
From: Fabien Chêne (fabien.chene_at_[hidden])
Date: 2015-10-12 07:29:45


Hi Steven,

Thank you for your answer.

2015-10-10 18:29 GMT+02:00 Steven Watanabe <watanabesj_at_[hidden]>:
>> To achieve that, I have created a feature to handle the sanitizer:
>> feature sanitize : off address thread : composite propagated link-incompatible ;
>> feature.compose <sanitize>thread : <cxxflags>-fsanitize=thread
>> <linkflags>-fsanitize=thread ;
>> feature.compose <sanitize>address : <cxxflags>-fsanitize=address
>> <linkflags>-fsanitize=address ;
>> Then I am able to specify the sanitize feature on the command line, ie
>> b2 sanitize=thread. The problem I am facing is that I have got an exe
>> that links to a static third party library which is not compiled with
>> -fPIC. Therefore, it cannot work because the -fsanitize=thread option
>> requires that the exe be a PIE (compiled with -pie). Hence, I would
>> like to be able to remove the <sanitize>thread property from the exe's
>> properties. I have tried with -<sanitize>thread, no success.
>
> The -<xxx>yyy syntax only works for removing
> requirements inherited from the project. It
> doesn't do anything about properties from
> the command line. Anyway, why don't you just
> use <sanitize>off in this case?

I forgot to mention that it was precisely my first attempt to solve
that issue, but it does not work in my case.
I have reduced the issue in the testcase below:

$ cat jamroot
import feature : feature ;

feature sanitize : off address thread : composite propagated link-incompatible ;
feature.compose <sanitize>thread : <cxxflags>-fsanitize=thread
<linkflags>-fsanitize=thread ;
feature.compose <sanitize>address : <cxxflags>-fsanitize=address
<linkflags>-fsanitize=address ;

project xxx
: requirements
: default-build debug
;

exe toto
:
toto.cpp
:
<sanitize>off
;

$ b2 -an sanitize=thread produced the following output on linux x86_64

b2 toolset=gcc -an sanitize=thread
...found 7 targets...
...updating 2 targets...
gcc.compile.c++ bin/gcc-4.4.7/debug/toto.o

    "g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -g -fPIC
-fsanitize=thread -c -o "bin/gcc-4.4.7/debug/toto.o" "toto.cpp"

gcc.link bin/gcc-4.4.7/debug/toto

    "g++" -o "bin/gcc-4.4.7/debug/toto" -Wl,--start-group
"bin/gcc-4.4.7/debug/toto.o" -Wl,-Bstatic -Wl,-Bdynamic
-Wl,--end-group -g -fsanitize=thread

...updated 2 targets...

-- 
Fabien

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk