All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [ERROR] perf build failure on current tip:perf/core
Date: Sun, 08 Jan 2012 23:50:08 +0900	[thread overview]
Message-ID: <1326034208.1508.15.camel@leonhard> (raw)
In-Reply-To: <20120108140318.GA15654@elte.hu>

2012-01-08 (Sun), 15:03 +0100, Ingo Molnar wrote:
> * Namhyung Kim <namhyung@gmail.com> wrote:
> 
> > >>   $ map pwrite
> > >>   The program 'map' is currently not installed.  You can install it by
> > >> typing:
> > >>   sudo apt-get install sgt-puzzles
> > >> 
> > >> I don't think this is the package what you said. Anyway quick grep'ing
> > >> pwrite tells me it's in the unistd.h:
> > >> 
> > >>   $ grep pwrite /usr/include/unistd.h
> > >>   extern ssize_t pwrite (int __fd, __const void *__buf, size_t __n,
> > >>   extern ssize_t __REDIRECT (pwrite, (int __fd, __const void *__buf,
> > >> 			     pwrite64) __wur;
> > >>   #   define pwrite pwrite64
> > >
> > > There's multiple definitions there, and we get lost somehow - as 
> > > unistd.h is included:
> > >
> > >   ~/tip/tools/perf> grep -n unistd.h util/trace-event-info.c
> > >   34:#include <unistd.h>
> > >
> > > Thanks,
> > >
> > > 	Ingo
> > 
> > This is the content of my /usr/include/unistd.h:
> > 
> > #ifdef __USE_UNIX98
> > # ifndef __USE_FILE_OFFSET64
> > extern ssize_t pread (int __fd, void *__buf, size_t __nbytes,
> > 		      __off_t __offset) __wur;
> > extern ssize_t pwrite (int __fd, __const void *__buf, size_t __n,
> > 		       __off_t __offset) __wur;
> > # else
> > #  ifdef __REDIRECT
> > extern ssize_t __REDIRECT (pread, (int __fd, void *__buf, size_t __nbytes,
> > 				   __off64_t __offset),
> > 			   pread64) __wur;
> > extern ssize_t __REDIRECT (pwrite, (int __fd, __const void *__buf,
> > 				    size_t __nbytes, __off64_t __offset),
> > 			   pwrite64) __wur;
> > #  else
> > #   define pread pread64
> > #   define pwrite pwrite64
> > #  endif
> > # endif
> > 
> > # ifdef __USE_LARGEFILE64
> > extern ssize_t pread64 (int __fd, void *__buf, size_t __nbytes,
> > 			__off64_t __offset) __wur;
> > extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n,
> > 			 __off64_t __offset) __wur;
> > # endif
> > #endif
> > 
> > I think all of pread/write functions are properly defined here:
> > 
> >   $ echo '#include <unistd.h>' | \
> >   > gcc -xc -E -dM -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 - | \
> >   > grep -e UNIX98 -e LARGEFILE64 -e FILE_OFFSET
> >   #define __ILP32_OFFBIG_CFLAGS "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
> >   #define _LARGEFILE64_SOURCE 1
> >   #define __USE_UNIX98 1
> >   #define __USE_LARGEFILE64 1
> >   #define _FILE_OFFSET_BITS 64
> >   #define __USE_FILE_OFFSET64 1
> 
> So which preprocessor branch within unistd.h does it get into on 
> your system and why isnt there a pwrite()/pwrite64() prototype 
> once it goes along that path?
> 
> You could try an ugly approach and edit your unistd.h and put in 
> debug lines like this:
> 
> #warn got here: __LINE__
> 
> and thus see which branch it really gets into.
> 
> (save a backup copy of unistd.h first ;-)
> 
> Thanks,
> 
> 	Ingo

Hi, Ingo

Putting the debug lines told me __USE_UNIX98 is not defined for the
file. It's because ctype.h gets included without _GNU_SOURCE and then it
includes feature.h AFAICS. Encompassing ctype.h with #define/#undef
_GNU_SOURCE or just adding __USE_UNIX98 before unistd.h makes the file
compiled, but it seems like an improper solution. What is the right way?

Thanks.

-- 
Regards,
Namhyung Kim



  reply	other threads:[~2012-01-08 14:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-07 15:42 [ERROR] perf build failure on current tip:perf/core Namhyung Kim
2012-01-07 17:35 ` Arnaldo Carvalho de Melo
2012-01-08  9:00 ` Ingo Molnar
2012-01-08  9:41   ` Namhyung Kim
2012-01-08 11:34     ` Ingo Molnar
2012-01-08 12:30       ` Namhyung Kim
2012-01-08 14:03         ` Ingo Molnar
2012-01-08 14:50           ` Namhyung Kim [this message]
2012-01-08 15:00             ` Ingo Molnar
2012-01-08 15:10               ` [PATCH] perf tools: Fix compile error on x86_64 Ubuntu Namhyung Kim
2012-01-08 15:12                 ` Arnaldo Carvalho de Melo
2012-01-08 15:32                   ` Ingo Molnar
2012-01-08 15:49                     ` Namhyung Kim
2012-01-09  7:29                 ` [tip:perf/core] " tip-bot for Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1326034208.1508.15.camel@leonhard \
    --to=namhyung@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.