https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71090

            Bug ID: 71090
           Summary: #include <cmath> cannot locate math.h
           Product: gcc
           Version: 6.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mcguire at crsr dot net
  Target Milestone: ---

Created attachment 38478
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38478&action=edit
Simple source file

Using the gcc 6.1.1-1 package from Arch Linux, the attached program math.cc
fails to compile with the following error when compiled with the given command
line:

$ gcc -v --save-temps -o math math.cc -isystem /usr/include
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --disable-multilib --disable-werror
--enable-checking=release
Thread model: posix
gcc version 6.1.1 20160501 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'math' '-isystem' '/usr/include'
'-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/cc1plus -E -quiet -v -D_GNU_SOURCE
-isystem /usr/include math.cc -mtune=generic -march=x86-64 -fpch-preprocess -o
math.ii
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../x86_64-pc-linux-gnu/include"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1

/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/x86_64-pc-linux-gnu
 /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/backward
 /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include
 /usr/local/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include-fixed
End of search list.
In file included from math.cc:1:0:
/usr/include/c++/6.1.1/cmath:45:23: fatal error: math.h: No such file or
directory
 #include_next <math.h>
                       ^
compilation terminated. 

The original problem was discovered while compiling the Pony language compiler,
which uses LLVM and uses -isystem to put the location of the LLVM headers at
the start of the bracket search path.

Reply via email to