[Home]

Summary:ASTERISK-25290: Build System does not respect CFLAGS and CXXFLAGS placed on the command line
Reporter:Jeffrey Walton (noloader@gmail.com)Labels:
Date Opened:2015-07-28 22:31:36Date Closed:2015-07-29 05:10:07
Priority:MajorRegression?
Status:Closed/CompleteComponents:Core/BuildSystem
Versions:13.4.0 Frequency of
Occurrence
Constant
Related
Issues:
duplicatesASTERISK-25289 Build System does not respect CFLAGS and CXXFLAGS when building menuselect
Environment:Fedora 22, x86_64; but any distro with a compiler with sanitizers will do (excpet maybe Clang, since it reject's the use of trampolines that Asterisk uses).Attachments:
Description:GCC added sanitizers at 4.8. I'm attempting to build Asterisk with the UBsan (undefined behavior) and Asan (address) sanitizers enabled. UBsan is enabled with `-fsanitize=undefined`, and Asan is enabled with `-fsanitize=address`. (UBasan and Asan are mutually exclusive, so we repeat the steps below twice).

The following commands reveal what Astersik uses as CFLAGS and CXXFLAGS:

./configure
...
make V=2

It appears the options are "-g -D_GNU_SOURCE -Wall". I tried forcing the override on the command line:

make menuselect
localhost asterisk-13.4.0]$ make "CXXFLAGS=-g2 -O2 -D_GNU_SOURCE -Wall -fsanitize=undefined" CFLAGS="$CXXFLAGS" V=2
CC="cc" CXX="g++" LD="" AR="" RANLIB="" CFLAGS="" LDFLAGS="" make -C menuselect CONFIGURE_SILENT="--silent" makeopts
make[1]: Entering directory '/home/jwalton/Desktop/asterisk-13.4.0/menuselect'
make[1]: 'makeopts' is up to date.
make[1]: Leaving directory '/home/jwalton/Desktop/asterisk-13.4.0/menuselect'
menuselect/menuselect --check-deps menuselect.makeopts
menuselect/menuselect --check-deps menuselect.makeopts
Generating embedded module rules ...
  [CC] astcanary.c -> astcanary.o
  [LD] astcanary.o -> astcanary
  [CC] astdb2sqlite3.c -> astdb2sqlite3.o
  [CC] hash/hash.c -> hash/hash.o
  [CC] hash/hash_bigkey.c -> hash/hash_bigkey.o
  [CC] hash/hash_buf.c -> hash/hash_buf.o
  [CC] hash/hash_func.c -> hash/hash_func.o
  [CC] hash/hash_log2.c -> hash/hash_log2.o
  [CC] hash/hash_page.c -> hash/hash_page.o
  [CC] hash/ndbm.c -> hash/ndbm.o
  [CC] btree/bt_close.c -> btree/bt_close.o
  [CC] btree/bt_conv.c -> btree/bt_conv.o
  [CC] btree/bt_debug.c -> btree/bt_debug.o
  [CC] btree/bt_delete.c -> btree/bt_delete.o
  [CC] btree/bt_get.c -> btree/bt_get.o
  [CC] btree/bt_open.c -> btree/bt_open.o
  [CC] btree/bt_overflow.c -> btree/bt_overflow.o
  [CC] btree/bt_page.c -> btree/bt_page.o
  [CC] btree/bt_put.c -> btree/bt_put.o
  [CC] btree/bt_search.c -> btree/bt_search.o
  [CC] btree/bt_seq.c -> btree/bt_seq.o
  [CC] btree/bt_split.c -> btree/bt_split.o
  [CC] btree/bt_utils.c -> btree/bt_utils.o
  [CC] db/db.c -> db/db.o
  [CC] mpool/mpool.c -> mpool/mpool.o
  [CC] recno/rec_close.c -> recno/rec_close.o
  [CC] recno/rec_delete.c -> recno/rec_delete.o
  [CC] recno/rec_get.c -> recno/rec_get.o
  [CC] recno/rec_open.c -> recno/rec_open.o
  [CC] recno/rec_put.c -> recno/rec_put.o
  [CC] recno/rec_search.c -> recno/rec_search.o
  [CC] recno/rec_seq.c -> recno/rec_seq.o
  [CC] recno/rec_utils.c -> recno/rec_utils.o

Failure to respect CFLAGS and CXXFLAGS is making it difficult to acceptance test the package. Its also depriving the project of the sanitizer findings.

Note that the sanitizers perform dynamic analysis using actual generated code. They do not produce false positives.
Comments:By: Asterisk Team (asteriskteam) 2015-07-28 22:31:37.486-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].