[Bug driver/87769] New: GCC build from source uses headers and libraries from directories host machine.

mte.zych at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Oct 27 01:23:00 GMT 2018


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

            Bug ID: 87769
           Summary: GCC build from source uses headers and libraries from
                    directories host machine.
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mte.zych at gmail dot com
  Target Milestone: ---

Hi ;)

I'm building GCC from source using the following commands:

    $ cd /home/mzych
    $ git clone https://github.com/gcc-mirror/gcc.git gcc-source
    $ cd gcc-source
    $ ./contrib/download_prerequisites
    $ cd ..
    $ mkdir gcc-build
    $ cd gcc-build
    $ ../gcc-source/configure -v \
                              --build=x86_64-linux-gnu \
                              --host=x86_64-linux-gnu \
                              --target=x86_64-linux-gnu \
                              --prefix=/home/mzych/gcc \
                              --enable-languages=c,c++ \
                              --disable-multilib
    $ make -j 4
    $ make install

However, I've noticed that GCC build from source
includes system headers and links system libraries:

    $ /home/mzych/gcc/bin/g++ -x c++ -E -v -
      ...
 ---> ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
      ignoring nonexistent directory
"/home/mzych/gcc/lib/gcc/x86_64-linux-gnu/9.0.0/../../../../x86_64-linux-gnu/include"
      #include "..." search starts here:
      #include <...> search starts here:
     
/home/mzych/gcc/lib/gcc/x86_64-linux-gnu/9.0.0/../../../../include/c++/9.0.0
     
/home/mzych/gcc/lib/gcc/x86_64-linux-gnu/9.0.0/../../../../include/c++/9.0.0/x86_64-linux-gnu
     
/home/mzych/gcc/lib/gcc/x86_64-linux-gnu/9.0.0/../../../../include/c++/9.0.0/backward
      /home/mzych/gcc/lib/gcc/x86_64-linux-gnu/9.0.0/include
 ---> /usr/local/include
      /home/mzych/gcc/include
      /home/mzych/gcc/lib/gcc/x86_64-linux-gnu/9.0.0/include-fixed
 ---> /usr/include/x86_64-linux-gnu
 ---> /usr/include

    $ /home/mzych/gcc/bin/g++-std=c++14 -E foo.cpp
      # 1 "foo.cpp"
      ...
      # 1 "/home/mzych/gcc/include/c++/9.0.0/cstdint" 1 3
      # 32 "/home/mzych/gcc/include/c++/9.0.0/cstdint" 3
      ...
 ---> # 1 "/usr/include/features.h" 1 3 4
 ---> # 424 "/usr/include/features.h" 3 4
 ---> # 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4
 ---> # 427 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4
      ...

I would expect GCC build from source to be standalone and independent from host
machine.
Mixing C++ standard library headers from
GCC installed on host machine and GCC build from source can cause conflicts,
because they could be in competently different versions.

BTW, I observed the same behavior with link directories,
which results in GCC using link directories from host machine.

Am I doing something incorrectly (like not configuring GCC properly)
or this is actual issue with GCC?

Thanks, Mateusz


More information about the Gcc-bugs mailing list