public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/54725] New: cross gfortran always searches host paths (e.g. /usr/include)
@ 2012-09-27  5:30 vapier at gentoo dot org
  2012-09-27  5:45 ` [Bug fortran/54725] " kargl at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: vapier at gentoo dot org @ 2012-09-27  5:30 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54725

             Bug #: 54725
           Summary: cross gfortran always searches host paths (e.g.
                    /usr/include)
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vapier@gentoo.org
                CC: toolchain@gentoo.org
              Host: x86_64-linux-gnu
            Target: armv7a-linux-gnu


simple test case:
$ >test.F90
$ armv7a-unknown-linux-gnueabi-gfortran -v -c test.F90 
...
ignoring nonexistent directory "/usr/local/include"
...
#include <...> search starts here:
 /usr/lib/gcc/armv7a-unknown-linux-gnueabi/4.6.3/finclude
 /usr/lib/gcc/armv7a-unknown-linux-gnueabi/4.6.3/include
 /usr/lib/gcc/armv7a-unknown-linux-gnueabi/4.6.3/include-fixed
 /usr/include
End of search list.
...

that doesn't seem right considering gcc/g++ don't do this:
$ >test.c
$ armv7a-unknown-linux-gnueabi-gcc -c test.c -v
...
ignoring nonexistent directory
"/usr/armv7a-unknown-linux-gnueabi/usr/local/include"
...
#include <...> search starts here:
 /usr/lib/gcc/armv7a-unknown-linux-gnueabi/4.6.3/include
 /usr/lib/gcc/armv7a-unknown-linux-gnueabi/4.6.3/include-fixed
 /usr/armv7a-unknown-linux-gnueabi/usr/include
End of search list.
...


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/54725] cross gfortran always searches host paths (e.g. /usr/include)
  2012-09-27  5:30 [Bug fortran/54725] New: cross gfortran always searches host paths (e.g. /usr/include) vapier at gentoo dot org
@ 2012-09-27  5:45 ` kargl at gcc dot gnu.org
  2012-09-27  6:00 ` xarthisius.kk at gmail dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kargl at gcc dot gnu.org @ 2012-09-27  5:45 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54725

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |kargl at gcc dot gnu.org
         Resolution|                            |INVALID

--- Comment #1 from kargl at gcc dot gnu.org 2012-09-27 05:45:11 UTC ---
You forgot to explain what you think is not quite right.
gfortran searches only directories where it may have
installed some modules and directories that you explicitly
add via -I.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/54725] cross gfortran always searches host paths (e.g. /usr/include)
  2012-09-27  5:30 [Bug fortran/54725] New: cross gfortran always searches host paths (e.g. /usr/include) vapier at gentoo dot org
  2012-09-27  5:45 ` [Bug fortran/54725] " kargl at gcc dot gnu.org
@ 2012-09-27  6:00 ` xarthisius.kk at gmail dot com
  2012-09-27 15:11 ` vapier at gentoo dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: xarthisius.kk at gmail dot com @ 2012-09-27  6:00 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54725

Kacper Kowalik <xarthisius.kk at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xarthisius.kk at gmail dot
                   |                            |com

--- Comment #2 from Kacper Kowalik <xarthisius.kk at gmail dot com> 2012-09-27 06:00:32 UTC ---
(In reply to comment #1)
> You forgot to explain what you think is not quite right.
> gfortran searches only directories where it may have
> installed some modules and directories that you explicitly
> add via -I.
Because when you do cross compilation you don't want your compiler to pick up
host modules. Apart from that ^^ shouldn't frontends behave in a consistent
manner?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/54725] cross gfortran always searches host paths (e.g. /usr/include)
  2012-09-27  5:30 [Bug fortran/54725] New: cross gfortran always searches host paths (e.g. /usr/include) vapier at gentoo dot org
  2012-09-27  5:45 ` [Bug fortran/54725] " kargl at gcc dot gnu.org
  2012-09-27  6:00 ` xarthisius.kk at gmail dot com
@ 2012-09-27 15:11 ` vapier at gentoo dot org
  2012-09-28 14:16 ` burnus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: vapier at gentoo dot org @ 2012-09-27 15:11 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54725

Mike Frysinger <vapier at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |

--- Comment #3 from Mike Frysinger <vapier at gentoo dot org> 2012-09-27 15:11:41 UTC ---
yeah, as Kacper said, cross compilers should not be searching native paths. 
the gcc and g++ frontends are working correctly (they use the sysrooted path)
while the gfortran frontend is broken.

-v output shows:
Target: armv7a-unknown-linux-gnueabi
Configured with:
/var/tmp/portage/cross-armv7a-unknown-linux-gnueabi/gcc-4.6.3/work/gcc-4.6.3/configure
--prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/armv7a-unknown-linux-gnueabi/gcc-bin/4.6.3
--includedir=/usr/lib/gcc/armv7a-unknown-linux-gnueabi/4.6.3/include
--datadir=/usr/share/gcc-data/armv7a-unknown-linux-gnueabi/4.6.3
--mandir=/usr/share/gcc-data/armv7a-unknown-linux-gnueabi/4.6.3/man
--infodir=/usr/share/gcc-data/armv7a-unknown-linux-gnueabi/4.6.3/info
--with-gxx-include-dir=/usr/lib/gcc/armv7a-unknown-linux-gnueabi/4.6.3/include/g++-v4
--host=x86_64-pc-linux-gnu --target=armv7a-unknown-linux-gnueabi
--build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point
--without-ppl --without-cloog --enable-lto --enable-nls
--without-included-gettext --with-system-zlib --enable-obsolete
--disable-werror --enable-secureplt --disable-multilib --disable-libmudflap
--disable-libssp --enable-libgomp
--with-python-dir=/share/gcc-data/armv7a-unknown-linux-gnueabi/4.6.3/python
--enable-poison-system-directories --enable-checking=release --disable-libgcj
--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16
--enable-languages=c,c++,fortran
--with-sysroot=/usr/armv7a-unknown-linux-gnueabi --disable-bootstrap
--enable-__cxa_atexit --enable-clocale=gnu
--with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.6.3 p1.6,
pie-0.5.2'


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/54725] cross gfortran always searches host paths (e.g. /usr/include)
  2012-09-27  5:30 [Bug fortran/54725] New: cross gfortran always searches host paths (e.g. /usr/include) vapier at gentoo dot org
                   ` (2 preceding siblings ...)
  2012-09-27 15:11 ` vapier at gentoo dot org
@ 2012-09-28 14:16 ` burnus at gcc dot gnu.org
  2012-09-28 14:30 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-09-28 14:16 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54725

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-09-28 14:16:37 UTC ---
Untested draft patch. As I don't build cross compilers, I would be happy if
someone could confirm that it works.

--- a/gcc/fortran/cpp.c
+++ b/gcc/fortran/cpp.c
@@ -269,3 +269,3 @@ gfc_cpp_init_options (unsigned int decoded_options_count,
   gfc_cpp_option.prefix = NULL;
-  gfc_cpp_option.sysroot = NULL;
+  gfc_cpp_option.sysroot = TARGET_SYSTEM_ROOT;


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/54725] cross gfortran always searches host paths (e.g. /usr/include)
  2012-09-27  5:30 [Bug fortran/54725] New: cross gfortran always searches host paths (e.g. /usr/include) vapier at gentoo dot org
                   ` (3 preceding siblings ...)
  2012-09-28 14:16 ` burnus at gcc dot gnu.org
@ 2012-09-28 14:30 ` burnus at gcc dot gnu.org
  2012-09-28 23:12 ` vapier at gentoo dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-09-28 14:30 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54725

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-09-28 14:30:09 UTC ---
I forgot half of the patch - the second half is needed when no system root
exists. The patch is still untested.

--- a/gcc/fortran/cpp.c
+++ b/gcc/fortran/cpp.c
@@ -40,2 +40,6 @@ along with GCC; see the file COPYING3.  If not see

+#ifndef TARGET_SYSTEM_ROOT
+# define TARGET_SYSTEM_ROOT NULL
+#endif
+
 #ifndef TARGET_CPU_CPP_BUILTINS
@@ -269,3 +273,3 @@ gfc_cpp_init_options (unsigned int decoded_options_count,
   gfc_cpp_option.prefix = NULL;
-  gfc_cpp_option.sysroot = NULL;
+  gfc_cpp_option.sysroot = TARGET_SYSTEM_ROOT;


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/54725] cross gfortran always searches host paths (e.g. /usr/include)
  2012-09-27  5:30 [Bug fortran/54725] New: cross gfortran always searches host paths (e.g. /usr/include) vapier at gentoo dot org
                   ` (4 preceding siblings ...)
  2012-09-28 14:30 ` burnus at gcc dot gnu.org
@ 2012-09-28 23:12 ` vapier at gentoo dot org
  2012-10-19  8:23 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: vapier at gentoo dot org @ 2012-09-28 23:12 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54725

--- Comment #6 from Mike Frysinger <vapier at gentoo dot org> 2012-09-28 23:12:08 UTC ---
(In reply to comment #5)

that's half the equation.  the other half is the build system support.

in gcc/Makefile.in, they do:
  CFLAGS-c-family/c-opts.o += @TARGET_SYSTEM_ROOT_DEFINE@

but you can't do that in gcc/fortran/Make-lang.in.  you can't use
$(TARGET_SYSTEM_ROOT_DEFINE) either because the variable is only AC_SUBST().

so you could add this line to gcc/Makefile.in:
  CFLAGS-fortran/cpp.o += @TARGET_SYSTEM_ROOT_DEFINE@
and it'd work.  this seems to be how they propagate the define into the
CFLAGS-c-family/c-opts.o variable, so maybe this is OK.

alternatively, gcc/Makefile.in does setup $(COMPILER_DEFINES), so adding this
to gcc/fortran/Make-lang.in works:
  CFLAGS-fortran/cpp.o += $(DRIVER_DEFINES)
but i'm sure that's the wrong answer.

the other alternative is to declare a "static const char *sysroot" inside of
gcc/fortran/gfortranspec.c and then initialize gfc_cpp_option.sysroot via that.
 this works because gfortranspec.c is compiled already with
$(COMPILER_DEFINES).

i'm wait out of my depth, so i don't know what the "right" answer is :).


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/54725] cross gfortran always searches host paths (e.g. /usr/include)
  2012-09-27  5:30 [Bug fortran/54725] New: cross gfortran always searches host paths (e.g. /usr/include) vapier at gentoo dot org
                   ` (5 preceding siblings ...)
  2012-09-28 23:12 ` vapier at gentoo dot org
@ 2012-10-19  8:23 ` burnus at gcc dot gnu.org
  2012-10-20 16:55 ` vapier at gentoo dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-10-19  8:23 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54725

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-10-19
     Ever Confirmed|0                           |1

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-10-19 08:23:21 UTC ---
Can you check whether the following patch works for you?

http://gcc.gnu.org/ml/gcc-patches/2012-10/msg01780.html


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/54725] cross gfortran always searches host paths (e.g. /usr/include)
  2012-09-27  5:30 [Bug fortran/54725] New: cross gfortran always searches host paths (e.g. /usr/include) vapier at gentoo dot org
                   ` (6 preceding siblings ...)
  2012-10-19  8:23 ` burnus at gcc dot gnu.org
@ 2012-10-20 16:55 ` vapier at gentoo dot org
  2012-10-21 10:51 ` burnus at gcc dot gnu.org
  2012-10-21 10:58 ` burnus at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: vapier at gentoo dot org @ 2012-10-20 16:55 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54725

--- Comment #8 from Mike Frysinger <vapier at gentoo dot org> 2012-10-20 16:55:05 UTC ---
(In reply to comment #7)

that patch doesn't work as there is a typo in Make-lang.in.  it needs to be:
CFLAGS-fortran/cpp.o += $(TARGET_SYSTEM_ROOT_DEFINE)

then it works OK


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/54725] cross gfortran always searches host paths (e.g. /usr/include)
  2012-09-27  5:30 [Bug fortran/54725] New: cross gfortran always searches host paths (e.g. /usr/include) vapier at gentoo dot org
                   ` (7 preceding siblings ...)
  2012-10-20 16:55 ` vapier at gentoo dot org
@ 2012-10-21 10:51 ` burnus at gcc dot gnu.org
  2012-10-21 10:58 ` burnus at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-10-21 10:51 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54725

--- Comment #9 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-10-21 10:51:30 UTC ---
Author: burnus
Date: Sun Oct 21 10:51:26 2012
New Revision: 192650

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192650
Log:
gcc/
2012-10-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/54725
        * Makefile.in (TARGET_SYSTEM_ROOT_DEFINE): New.

gcc/fortran
2012-10-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/54725
        * Make-lang.in (CFLAGS-cpp.o): Use TARGET_SYSTEM_ROOT_DEFINE.
        * cpp.o (gfc_cpp_init_options): Use it for
        setting gfc_cpp_option.sysroot.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/Make-lang.in
    trunk/gcc/fortran/cpp.c


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/54725] cross gfortran always searches host paths (e.g. /usr/include)
  2012-09-27  5:30 [Bug fortran/54725] New: cross gfortran always searches host paths (e.g. /usr/include) vapier at gentoo dot org
                   ` (8 preceding siblings ...)
  2012-10-21 10:51 ` burnus at gcc dot gnu.org
@ 2012-10-21 10:58 ` burnus at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-10-21 10:58 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54725

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #10 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-10-21 10:57:50 UTC ---
FIXED on the trunk (4.8).

Thanks for the bug report, the debugging and for testing the patch!


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-10-21 10:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-27  5:30 [Bug fortran/54725] New: cross gfortran always searches host paths (e.g. /usr/include) vapier at gentoo dot org
2012-09-27  5:45 ` [Bug fortran/54725] " kargl at gcc dot gnu.org
2012-09-27  6:00 ` xarthisius.kk at gmail dot com
2012-09-27 15:11 ` vapier at gentoo dot org
2012-09-28 14:16 ` burnus at gcc dot gnu.org
2012-09-28 14:30 ` burnus at gcc dot gnu.org
2012-09-28 23:12 ` vapier at gentoo dot org
2012-10-19  8:23 ` burnus at gcc dot gnu.org
2012-10-20 16:55 ` vapier at gentoo dot org
2012-10-21 10:51 ` burnus at gcc dot gnu.org
2012-10-21 10:58 ` burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).