c1plus: error: unrecognized command line option "-fsanitize=address"

2,499 views
Skip to first unread message

Ramin Farajpour Cami

unread,
Jul 7, 2017, 1:41:37 AM7/7/17
to address-sanitizer
Hi,

I going to enable ASAN for my C++ program,i install libasan package, i get this error message, i don't know how to resolve it?

[root@localhost usb]# ./configure CXXFLAGS="-fsanitize=address -ggdb"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking for C++ compiler default output file name...
configure: error: in `/root/usb':
configure: error: C++ compiler cannot create executables
See `config.log' for more details.
config.log

Yuri Gribov

unread,
Jul 7, 2017, 1:52:56 AM7/7/17
to address-...@googlegroups.com
On Fri, Jul 7, 2017 at 6:41 AM, Ramin Farajpour Cami
<ramin.b...@gmail.com> wrote:
> Hi,
>
> I going to enable ASAN for my C++ program,i install libasan package, i get
> this error message, i don't know how to resolve it?

You need a newer compiler (gcc 4.7 at least, newer versions are better).

-Y

Ramin Farajpour Cami

unread,
Jul 7, 2017, 2:29:18 AM7/7/17
to address-sanitizer
i have g++ version :

[root@localhost src]# g++ --version
g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Ok Thank you!

Ramin Farajpour Cami

unread,
Jul 7, 2017, 2:32:50 AM7/7/17
to address-sanitizer
Yuri,

again i have error:

[root@localhost usb]# ./configure CXXFLAGS="-fsanitize=address -ggdb"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for C++ compiler default output file name... 
configure: error: in `/root/usb':
configure: error: C++ compiler cannot create executables
See `config.log' for more details.
[root@localhost usb]# gcc -version
gcc: error: unrecognized command line option ‘-version’
gcc: fatal error: no input files
compilation terminated.
[root@localhost usb]# gcc --version
gcc (GCC) 4.9.1 20140922 (Red Hat 4.9.1-10)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@localhost usb]# g++ --version
g++ (GCC) 4.9.1 20140922 (Red Hat 4.9.1-10)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



On Friday, July 7, 2017 at 10:22:56 AM UTC+4:30, Yuri Gribov wrote:

Yuri Gribov

unread,
Jul 7, 2017, 2:48:33 AM7/7/17
to address-...@googlegroups.com
On Fri, Jul 7, 2017 at 7:32 AM, Ramin Farajpour Cami
<ramin.b...@gmail.com> wrote:
> Yuri,
>
> again i have error:
>
> [root@localhost usb]# ./configure CXXFLAGS="-fsanitize=address -ggdb"
> checking for a BSD-compatible install... /usr/bin/install -c
> checking whether build environment is sane... yes
> checking for a thread-safe mkdir -p... /bin/mkdir -p
> checking for gawk... gawk
> checking whether make sets $(MAKE)... yes
> checking for C++ compiler default output file name...
> configure: error: in `/root/usb':
> configure: error: C++ compiler cannot create executables
> See `config.log' for more details.

Ramin,

First of all, you should add -fsanitize=address to CFLAGS, CXXFLAGS and LDFLAGS.

If that does not help, you'll need to investigate why compiler test
inside configure fails. You can find particular source code and
command line options which cause your g++ compilation to abort in
config.log.

-Y

Ramin Farajpour Cami

unread,
Jul 7, 2017, 5:22:14 AM7/7/17
to address-sanitizer
i don't know, i spend many time for resolve it, but nothing,


so i use : ./configure --disable-shared CFLAGS="-fsanitize=address -ggdb" CXXFLAGS="-fsanitize=address -ggdb"

again i got error:

c++: error: unrecognized command line option '-fsanitize=address'

Yuri Gribov

unread,
Jul 7, 2017, 5:30:50 AM7/7/17
to address-...@googlegroups.com
On Fri, Jul 7, 2017 at 10:22 AM, Ramin Farajpour Cami
<ramin.b...@gmail.com> wrote:
> i don't know, i spend many time for resolve it, but nothing,
>
> please look : https://fuzzing-project.org/tutorial2.html

The instructions aren't quite correct, they miss the LDFLAGS setting.
I emailed Hanno, not sure when he fixes this.

> so i use : ./configure --disable-shared CFLAGS="-fsanitize=address -ggdb"
> CXXFLAGS="-fsanitize=address -ggdb"
>
> again i got error:
>
> c++: error: unrecognized command line option '-fsanitize=address'

Please try to execute
gcc --version
g++ --version
c++ --version
and report your findings.

> On Friday, July 7, 2017 at 11:18:33 AM UTC+4:30, Yuri Gribov wrote:
>>
>> On Fri, Jul 7, 2017 at 7:32 AM, Ramin Farajpour Cami
>> <ramin.b...@gmail.com> wrote:
>> > Yuri,
>> >
>> > again i have error:
>> >
>> > [root@localhost usb]# ./configure CXXFLAGS="-fsanitize=address -ggdb"
>> > checking for a BSD-compatible install... /usr/bin/install -c
>> > checking whether build environment is sane... yes
>> > checking for a thread-safe mkdir -p... /bin/mkdir -p
>> > checking for gawk... gawk
>> > checking whether make sets $(MAKE)... yes
>> > checking for C++ compiler default output file name...
>> > configure: error: in `/root/usb':
>> > configure: error: C++ compiler cannot create executables
>> > See `config.log' for more details.
>>
>> Ramin,
>>
>> First of all, you should add -fsanitize=address to CFLAGS, CXXFLAGS and
>> LDFLAGS.
>>
>> If that does not help, you'll need to investigate why compiler test
>> inside configure fails. You can find particular source code and
>> command line options which cause your g++ compilation to abort in
>> config.log.
>>
>> -Y
>
> --
> You received this message because you are subscribed to the Google Groups
> "address-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to address-saniti...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Ramin Farajpour Cami

unread,
Jul 7, 2017, 5:48:20 AM7/7/17
to address-sanitizer
Ok Thanks a lot Yuri,

you say work ASAN in the version GCC > 4.7.*  but i have GCC = 4.9.1

do you think i should install GCC 5 resolve my issue?

 
[root@localhost usb]# gcc --version
gcc (GCC) 4.9.1 20140922 (Red Hat 4.9.1-10)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Ramin Farajpour Cami

unread,
Jul 7, 2017, 5:53:51 AM7/7/17
to address-sanitizer

Yuri Gribov

unread,
Jul 7, 2017, 7:55:44 AM7/7/17
to address-...@googlegroups.com
On Fri, Jul 7, 2017 at 10:48 AM, Ramin Farajpour Cami
<ramin.b...@gmail.com> wrote:
> Ok Thanks a lot Yuri,
>
> you say work ASAN in the version GCC > 4.7.* but i have GCC = 4.9.1
>
> do you think i should install GCC 5 resolve my issue?
>
>
> [root@localhost usb]# gcc --version

So what about version of g++ and c++?

Ramin Farajpour Cami

unread,
Jul 7, 2017, 8:00:17 AM7/7/17
to address-...@googlegroups.com
g++ and c++ is version 4.9.1-10


> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "address-sanitizer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/address-sanitizer/vEKMbOz7qqs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to address-sanitizer+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Security researcher, Web developer, Linux kernel developer
Ramin Farajpour Cami

Yuri Gribov

unread,
Jul 7, 2017, 8:38:35 AM7/7/17
to address-...@googlegroups.com
On Fri, Jul 7, 2017 at 1:00 PM, Ramin Farajpour Cami
<ramin.b...@gmail.com> wrote:
> g++ and c++ is version 4.9.1-10

For some reason configure script has different opinion on this, it
seems to use an older version:
c++: error: unrecognized command line option '-fsanitize=address'
To understand what's going on, you probly need to inspect config.log
and see which command is failing and why.
>> You received this message because you are subscribed to a topic in the
>> Google Groups "address-sanitizer" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/address-sanitizer/vEKMbOz7qqs/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> address-saniti...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> Security researcher, Web developer, Linux kernel developer
> Ramin Farajpour Cami
>
Reply all
Reply to author
Forward
0 new messages