public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15118] New: precompiled headers problem (clalling fdopen: Bad file descriptor)
@ 2004-04-24 18:54 gcc-bugzilla at gcc dot gnu dot org
  2004-04-24 19:09 ` [Bug c++/15118] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-04-24 18:54 UTC (permalink / raw)
  To: gcc-bugs

	When trying to compile some headers g++ says:
	calling fdopen: Bad file descriptor

	See fix for more information.

Environment:
System: Linux hell.hell.gr 2.6.5 #31 Sun Apr 11 18:07:49 EEST 2004 i686 unknown unknown GNU/Linux
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.4.0/configure --enable-threads=posix --prefix=/usr --enable-languages=c,c++ --enable-shared --with-arch=pentium3 --with-cpu=pentium3 --enable-__cxa_atexit

How-To-Repeat:
	Use this Makefile in qt-3.2.1 include directory:
---
CC=g++ -c -pipe -I/usr/local/postgre/include -I/usr/local/include -I/usr/local/X11/include -I/usr/local/progs/CUPS/include -I/usr/X11R6/include -I/usr/local/ssl/include -fno-exceptions -w -O3 -fprofile-generate -mmmx -ffast-math -fmessage-length=0 -fomit-frame-pointer -D_REENTRANT -fPIC -DQT_SHARED -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_NIS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DQT_NO_XINERAMA -DQT_BUILTIN_GIF_READER=1 -DQT_NO_STYLE_MAC -DQT_NO_STYLE_AQUA -DQT_NO_STYLE_INTERLACE -DQT_NO_STYLE_WINDOWSXP -DQT_NO_STYLE_COMPACT -I/mnt/extra/usr/local/qt-x11-free-3.2.3/mkspecs/linux-g++ -I. -I../../include/freetype2 -I3rdparty/opentype -I../include -I/usr/X11R6/include -I/usr/X11R6/include -I../src/.moc/release-shared-mt/
gch:
        for fn in *.h ; do \
                if ! test -f $$fn.gch || test $$fn -nt $$fn.gch ; then \
                        echo "${CC} $$fn -o $$fn.gch  || true "; \
                        ${CC} $$fn -o $$fn.gch  || true ; \
                fi ; \
        done

%.h.gch: %.h
        ${CC} $< -o $@

all: gch
---
	This will work on most headers but will give fdopen errors on some of them.
------- Additional Comments From v13 at it dot teithe dot gr  2004-04-24 18:47 -------
Fix:
	Let's have an example:

g++ -c -pipe -I/usr/local/postgre/include -I/usr/local/include -I/usr/local/X11/include -I/usr/local/progs/CUPS/include -I/usr/X11R6/include -I/usr/local/ssl/include -fno-exceptions -w -O3 -fprofile-generate -mmmx -ffast-math -fmessage-length=0 -fomit-frame-pointer -D_REENTRANT -fPIC -DQT_SHARED -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_NIS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DQT_NO_XINERAMA -DQT_BUILTIN_GIF_READER=1 -DQT_NO_STYLE_MAC -DQT_NO_STYLE_AQUA -DQT_NO_STYLE_INTERLACE -DQT_NO_STYLE_WINDOWSXP -DQT_NO_STYLE_COMPACT -I/mnt/extra/usr/local/qt-x11-free-3.2.3/mkspecs/linux-g++ -I. -I../../include/freetype2 -I3rdparty/opentype -I../include -I/usr/X11R6/include -I/usr/X11R6/include -I../src/.moc/release-shared-mt/ qftp.h -o qftp.h.gch
In file included from qdatastream.h:42,
                 from qmap.h:44,
                 from qmime.h:43,
                 from qevent.h:45,
                 from qobject.h:45,
                 from qnetworkprotocol.h:45,
                 from qftp.h:44:
qiodevice.h:43:22: calling fdopen: Bad file descriptor

	Next we look at line 43 of qiodevice.h:
#include "qcstring.h"

	Now we remove qcstring.h.gch and it works (!). There are cases where you've to remove more than one .gch files.

	Next we recreate qcstring.h.gch:
g++ -c -pipe -I/usr/local/postgre/include -I/usr/local/include -I/usr/local/X11/include -I/usr/local/progs/CUPS/include -I/usr/X11R6/include -I/usr/local/ssl/include -fno-exceptions -w -O3 -fprofile-generate -mmmx -ffast-math -fmessage-length=0 -fomit-frame-pointer -D_REENTRANT -fPIC -DQT_SHARED -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_NIS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DQT_NO_XINERAMA -DQT_BUILTIN_GIF_READER=1 -DQT_NO_STYLE_MAC -DQT_NO_STYLE_AQUA -DQT_NO_STYLE_INTERLACE -DQT_NO_STYLE_WINDOWSXP -DQT_NO_STYLE_COMPACT -I/mnt/extra/usr/local/qt-x11-free-3.2.3/mkspecs/linux-g++ -I. -I../../include/freetype2 -I3rdparty/opentype -I../include -I/usr/X11R6/include -I/usr/X11R6/include -I../src/.moc/release-shared-mt/ qcstring.h -o qcstring.h.gch

	And retry the qftp.h:
# g++ -c -pipe -I/usr/local/postgre/include -I/usr/local/include -I/usr/local/X11/include -I/usr/local/progs/CUPS/include -I/usr/X11R6/include -I/usr/local/ssl/include -fno-exceptions -w -O3 -fprofile-generate -mmmx -ffast-math -fmessage-length=0 -fomit-frame-pointer -D_REENTRANT -fPIC -DQT_SHARED -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_NIS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DQT_NO_XINERAMA -DQT_BUILTIN_GIF_READER=1 -DQT_NO_STYLE_MAC -DQT_NO_STYLE_AQUA -DQT_NO_STYLE_INTERLACE -DQT_NO_STYLE_WINDOWSXP -DQT_NO_STYLE_COMPACT -I/mnt/extra/usr/local/qt-x11-free-3.2.3/mkspecs/linux-g++ -I. -I../../include/freetype2 -I3rdparty/opentype -I../include -I/usr/X11R6/include -I/usr/X11R6/include -I../src/.moc/release-shared-mt/ qftp.h -o qftp.h.gch  
In file included from qdatastream.h:42,
                 from qmap.h:44,
                 from qmime.h:43,
                 from qevent.h:45,
                 from qobject.h:45,
                 from qnetworkprotocol.h:45,
                 from qftp.h:44:
qiodevice.h:43:22: calling fdopen: Bad file descriptor

	(same thing)

	I ran the g++ command under 'strace -f' and I found this:

[pid 13530] stat64("qstring.h.gch", {st_mode=S_IFREG|0640, st_size=6524666, ...}) = 0
[pid 13530] open("qstring.h.gch", O_RDONLY|O_NOCTTY) = 5
[pid 13530] fstat64(5, {st_mode=S_IFREG|0640, st_size=6524666, ...}) = 0
[pid 13530] read(5, "gpch+012", 8)      = 8
[pid 13530] read(5, "\21\21\5\0\1\0\0\0\240\24\t\10$\0\0\0", 16) = 16
... a lot of read()s ...
... some other stuff (but no close()) ...
[pid 13530] read(5, "\23\0\0\0\21\0\0\0_G_HAVE_PRINTF_FP 1\24\0\0\0\22"..., 4096) = 3834
[pid 13530] brk(0)                      = 0x8580000
[pid 13530] brk(0x8582000)              = 0x8582000
[pid 13530] close(5)                    = 0
[pid 13530] munmap(0x402d9000, 4096)    = 0
[pid 13530] close(5)                    = -1 EBADF (Bad file descriptor)
[pid 13530] open("qvariant.h", O_RDONLY|O_NOCTTY) = 5
[pid 13530] fstat64(5, {st_mode=S_IFREG|0664, st_size=10157, ...}) = 0
[pid 13530] brk(0)                      = 0x8582000
[pid 13530] brk(0x8585000)              = 0x8585000
[pid 13530] read(5, "/*******************************"..., 10157) = 10157
[pid 13530] close(5)                    = 0
[pid 13530] fcntl64(-1, F_GETFL)        = -1 EBADF (Bad file descriptor)
[pid 13530] write(2, "In file included from qdatatable"..., 37In file included from qdatatable.h:42) = 37
[pid 13530] write(2, ":\n", 2:
)          = 2
[pid 13530] write(2, "qvariant.h:42:21:", 17qvariant.h:42:21:) = 17
[pid 13530] write(2, " ", 1 )            = 1
[pid 13530] write(2, "calling fdopen: Bad file descrip"..., 35calling fdopen: Bad file descriptor) = 35

-- 
           Summary: precompiled headers problem (clalling fdopen: Bad file
                    descriptor)
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: v13 at it dot teithe dot gr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/15118] precompiled headers problem (clalling fdopen: Bad file descriptor)
  2004-04-24 18:54 [Bug c++/15118] New: precompiled headers problem (clalling fdopen: Bad file descriptor) gcc-bugzilla at gcc dot gnu dot org
@ 2004-04-24 19:09 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-24 19:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-24 18:54 -------
This is a dup of bug 13675.

*** This bug has been marked as a duplicate of 13675 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE
            Version|3.4                         |2.95


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


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

end of thread, other threads:[~2004-04-24 18:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-24 18:54 [Bug c++/15118] New: precompiled headers problem (clalling fdopen: Bad file descriptor) gcc-bugzilla at gcc dot gnu dot org
2004-04-24 19:09 ` [Bug c++/15118] " pinskia at gcc dot gnu dot 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).