Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-23881

autoconf incorrectly selects compiler

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Major Major
    • 7.0.0rc1 (master), 7.0 (plan)
    • 5.0.40, 5.0.41rc1, 6.0.25, 6.0.26rc1, 6.4.10, 6.4.11rc1, 7.0.0beta1
    • Packages (C)
    • None
    • Sprint candidates
    • 0.1

      In a04e4948 (ZBX-12793), the AC_PROG_CC macro in the autoconf template (configure.ac) was given a list of specific compilers to test and prefer for compilation.

      The commit message for the change reads:

      Add to the main configuration script the explicit checks for cc
      and c99. The cc utility is, in theory, deprecated, but it's much
      more common to find than c99 in supported systems.
      So add a check for both the standard commands (cc first, c99
      second) and after that for the two specific compilers we test
      (gcc and clang).
      No changes on the usage of the CC and CFLAGS environment

      and the given change lists the compilers in the following order

      cc c99 gcc clang

      A couple of things are wrong with this.

      cc and c99, in contrast to the authors assumption, are standardized utilities, and will be present on IEEE Std 1003.1 (POSIX) compliant systems. cc is "an interface to an unspecified C-language compilation system", while c99 is an interface to a C99 standard compliant C compilation system. Although cc is marked as LEGACY, and by POSIX' advise, should not be used anymore, is often present on modern day unices and clones.

      The list is evaluated in order, meaning cc is tested first, then c99, then gcc, and only then clang. The first one found wins, meaning we will virtually always end up compiling with whatever compiler cc points towards, when in reality, we prefer clang as the default compiler.

      The list should be in the order of preference, with c99 and cc being used as fallbacks when all other preferred options have been exhausted.

            jlambda Juris Lambda
            jlambda Juris Lambda
            Team B
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: