* [ERROR] perf build failure on current tip:perf/core
@ 2012-01-07 15:42 Namhyung Kim
2012-01-07 17:35 ` Arnaldo Carvalho de Melo
2012-01-08 9:00 ` Ingo Molnar
0 siblings, 2 replies; 14+ messages in thread
From: Namhyung Kim @ 2012-01-07 15:42 UTC (permalink / raw)
To: Ingo Molnar, Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras
Cc: linux-kernel
Hi,
When I tried to build perf, I was faced with following error:
CC util/trace-event-info.o
cc1: warnings being treated as errors
util/trace-event-info.c: In function ‘record_file’:
util/trace-event-info.c:192: error: implicit declaration of function
‘pwrite’
util/trace-event-info.c:192: error: nested extern declaration of
‘pwrite’
make: *** [util/trace-event-info.o] Error 1
The code I tried was latest tip:perf/core - 9e183426bfb5 ("perf kvm: Fix
copy & paste error in description") and code in mainline (v3.2) doesn't
have this problem. Looking at the code, I couldn't find any clue to
this. Any idea?
FYI, my system is Ubuntu 10.04 on x86_64. gcc version is 4.4.3:
namhyung@leonhard:perf$ gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--enable-shared --enable-multiarch --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
--program-suffix=-4.4 --enable-nls --enable-clocale=gnu
--enable-libstdcxx-debug --enable-plugin --enable-objc-gc
--disable-werror --with-arch-32=i486 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
Thanks.
--
Regards,
Namhyung Kim
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [ERROR] perf build failure on current tip:perf/core
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
1 sibling, 0 replies; 14+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-01-07 17:35 UTC (permalink / raw)
To: Namhyung Kim; +Cc: Ingo Molnar, Peter Zijlstra, Paul Mackerras, linux-kernel
Em Sun, Jan 08, 2012 at 12:42:29AM +0900, Namhyung Kim escreveu:
> Hi,
>
> When I tried to build perf, I was faced with following error:
>
> CC util/trace-event-info.o
> cc1: warnings being treated as errors
> util/trace-event-info.c: In function ‘record_file’:
> util/trace-event-info.c:192: error: implicit declaration of function
> ‘pwrite’
> util/trace-event-info.c:192: error: nested extern declaration of
> ‘pwrite’
> make: *** [util/trace-event-info.o] Error 1
>
> The code I tried was latest tip:perf/core - 9e183426bfb5 ("perf kvm: Fix
> copy & paste error in description") and code in mainline (v3.2) doesn't
> have this problem. Looking at the code, I couldn't find any clue to
> this. Any idea?
>
> FYI, my system is Ubuntu 10.04 on x86_64. gcc version is 4.4.3:
Yeah, yesterday Joerg reported this as well, I managed to reproduce it
on a newly installed ubuntu 10.04.3 (LTS) i686 VM, haven't had time to
investigate yet tho.
- Arnaldo
> namhyung@leonhard:perf$ gcc -v
> Using built-in specs.
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
> 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
> --enable-shared --enable-multiarch --enable-linker-build-id
> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
> --program-suffix=-4.4 --enable-nls --enable-clocale=gnu
> --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
> --disable-werror --with-arch-32=i486 --with-tune=generic
> --enable-checking=release --build=x86_64-linux-gnu
> --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> Thread model: posix
> gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
>
> Thanks.
>
>
> --
> Regards,
> Namhyung Kim
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [ERROR] perf build failure on current tip:perf/core
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
1 sibling, 1 reply; 14+ messages in thread
From: Ingo Molnar @ 2012-01-08 9:00 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras, linux-kernel
* Namhyung Kim <namhyung@gmail.com> wrote:
> Hi,
>
> When I tried to build perf, I was faced with following error:
>
> CC util/trace-event-info.o
> cc1: warnings being treated as errors
> util/trace-event-info.c: In function ‘record_file’:
> util/trace-event-info.c:192: error: implicit declaration of function
> ‘pwrite’
> util/trace-event-info.c:192: error: nested extern declaration of
> ‘pwrite’
> make: *** [util/trace-event-info.o] Error 1
>
> The code I tried was latest tip:perf/core - 9e183426bfb5 ("perf kvm: Fix
> copy & paste error in description") and code in mainline (v3.2) doesn't
> have this problem. Looking at the code, I couldn't find any clue to
> this. Any idea?
>
> FYI, my system is Ubuntu 10.04 on x86_64. gcc version is 4.4.3:
Which header does pwrite() belong to on that system - what does
'map pwrite' say? It ought to be unistd.h, which is directly
included in util/trace-event-info.c.
My guess is that it might be related to:
tools/perf/Makefile:ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
Which introduces pwrite64() and defines pwrite() to them.
Does the patch below help? It's only a workaround really as
pwrite() ought to exist ... Also, i have only tested this on
64-bit.
Thanks,
Ingo
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index ac6830d..ba8b024 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -189,7 +189,7 @@ static void record_file(const char *file, size_t hdr_sz)
if (bigendian())
sizep += sizeof(u64) - hdr_sz;
- if (hdr_sz && pwrite(output_fd, sizep, hdr_sz, hdr_pos) < 0)
+ if (hdr_sz && pwrite64(output_fd, sizep, hdr_sz, hdr_pos) < 0)
die("writing to %s", output_file);
}
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [ERROR] perf build failure on current tip:perf/core
2012-01-08 9:00 ` Ingo Molnar
@ 2012-01-08 9:41 ` Namhyung Kim
2012-01-08 11:34 ` Ingo Molnar
0 siblings, 1 reply; 14+ messages in thread
From: Namhyung Kim @ 2012-01-08 9:41 UTC (permalink / raw)
To: Ingo Molnar
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras, linux-kernel
2012-01-08 (일), 10:00 +0100, Ingo Molnar:
> * Namhyung Kim <namhyung@gmail.com> wrote:
>
> > Hi,
> >
> > When I tried to build perf, I was faced with following error:
> >
> > CC util/trace-event-info.o
> > cc1: warnings being treated as errors
> > util/trace-event-info.c: In function ‘record_file’:
> > util/trace-event-info.c:192: error: implicit declaration of function
> > ‘pwrite’
> > util/trace-event-info.c:192: error: nested extern declaration of
> > ‘pwrite’
> > make: *** [util/trace-event-info.o] Error 1
> >
> > The code I tried was latest tip:perf/core - 9e183426bfb5 ("perf kvm: Fix
> > copy & paste error in description") and code in mainline (v3.2) doesn't
> > have this problem. Looking at the code, I couldn't find any clue to
> > this. Any idea?
> >
> > FYI, my system is Ubuntu 10.04 on x86_64. gcc version is 4.4.3:
>
> Which header does pwrite() belong to on that system - what does
> 'map pwrite' say? It ought to be unistd.h, which is directly
> included in util/trace-event-info.c.
>
> My guess is that it might be related to:
>
> tools/perf/Makefile:ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
>
> Which introduces pwrite64() and defines pwrite() to them.
>
> Does the patch below help? It's only a workaround really as
> pwrite() ought to exist ... Also, i have only tested this on
> 64-bit.
>
> Thanks,
>
> Ingo
>
> diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
> index ac6830d..ba8b024 100644
> --- a/tools/perf/util/trace-event-info.c
> +++ b/tools/perf/util/trace-event-info.c
> @@ -189,7 +189,7 @@ static void record_file(const char *file, size_t hdr_sz)
> if (bigendian())
> sizep += sizeof(u64) - hdr_sz;
>
> - if (hdr_sz && pwrite(output_fd, sizep, hdr_sz, hdr_pos) < 0)
> + if (hdr_sz && pwrite64(output_fd, sizep, hdr_sz, hdr_pos) < 0)
> die("writing to %s", output_file);
> }
>
Hello,
Unfortunately, above patch doesn't work for my system:
CC util/trace-event-info.o
cc1: warnings being treated as errors
util/trace-event-info.c: In function ‘record_file’:
util/trace-event-info.c:192: error: implicit declaration of function
‘pwrite64’
util/trace-event-info.c:192: error: nested extern declaration of
‘pwrite64’
And 'map pwrite' on terminal says:
$ 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
Thanks.
--
Regards,
Namhyung Kim
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [ERROR] perf build failure on current tip:perf/core
2012-01-08 9:41 ` Namhyung Kim
@ 2012-01-08 11:34 ` Ingo Molnar
2012-01-08 12:30 ` Namhyung Kim
0 siblings, 1 reply; 14+ messages in thread
From: Ingo Molnar @ 2012-01-08 11:34 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras, linux-kernel
* Namhyung Kim <namhyung@gmail.com> wrote:
> 2012-01-08 (일), 10:00 +0100, Ingo Molnar:
> > * Namhyung Kim <namhyung@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > When I tried to build perf, I was faced with following error:
> > >
> > > CC util/trace-event-info.o
> > > cc1: warnings being treated as errors
> > > util/trace-event-info.c: In function ‘record_file’:
> > > util/trace-event-info.c:192: error: implicit declaration of function
> > > ‘pwrite’
> > > util/trace-event-info.c:192: error: nested extern declaration of
> > > ‘pwrite’
> > > make: *** [util/trace-event-info.o] Error 1
> > >
> > > The code I tried was latest tip:perf/core - 9e183426bfb5 ("perf kvm: Fix
> > > copy & paste error in description") and code in mainline (v3.2) doesn't
> > > have this problem. Looking at the code, I couldn't find any clue to
> > > this. Any idea?
> > >
> > > FYI, my system is Ubuntu 10.04 on x86_64. gcc version is 4.4.3:
> >
> > Which header does pwrite() belong to on that system - what does
> > 'map pwrite' say? It ought to be unistd.h, which is directly
> > included in util/trace-event-info.c.
> >
> > My guess is that it might be related to:
> >
> > tools/perf/Makefile:ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
> >
> > Which introduces pwrite64() and defines pwrite() to them.
> >
> > Does the patch below help? It's only a workaround really as
> > pwrite() ought to exist ... Also, i have only tested this on
> > 64-bit.
> >
> > Thanks,
> >
> > Ingo
> >
> > diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
> > index ac6830d..ba8b024 100644
> > --- a/tools/perf/util/trace-event-info.c
> > +++ b/tools/perf/util/trace-event-info.c
> > @@ -189,7 +189,7 @@ static void record_file(const char *file, size_t hdr_sz)
> > if (bigendian())
> > sizep += sizeof(u64) - hdr_sz;
> >
> > - if (hdr_sz && pwrite(output_fd, sizep, hdr_sz, hdr_pos) < 0)
> > + if (hdr_sz && pwrite64(output_fd, sizep, hdr_sz, hdr_pos) < 0)
> > die("writing to %s", output_file);
> > }
> >
>
> Hello,
>
> Unfortunately, above patch doesn't work for my system:
>
> CC util/trace-event-info.o
> cc1: warnings being treated as errors
> util/trace-event-info.c: In function ‘record_file’:
> util/trace-event-info.c:192: error: implicit declaration of function
> ‘pwrite64’
> util/trace-event-info.c:192: error: nested extern declaration of
> ‘pwrite64’
>
> And 'map pwrite' on terminal says:
'man pwrite' i wanted to say.
> $ 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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [ERROR] perf build failure on current tip:perf/core
2012-01-08 11:34 ` Ingo Molnar
@ 2012-01-08 12:30 ` Namhyung Kim
2012-01-08 14:03 ` Ingo Molnar
0 siblings, 1 reply; 14+ messages in thread
From: Namhyung Kim @ 2012-01-08 12:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras, linux-kernel
Ingo Molnar <mingo@elte.hu> wrote:
> * Namhyung Kim <namhyung@gmail.com> wrote:
>
>> 2012-01-08 (일), 10:00 +0100, Ingo Molnar:
>> > * Namhyung Kim <namhyung@gmail.com> wrote:
>> >
>> > > Hi,
>> > >
>> > > When I tried to build perf, I was faced with following error:
>> > >
>> > > CC util/trace-event-info.o
>> > > cc1: warnings being treated as errors
>> > > util/trace-event-info.c: In function ‘record_file’:
>> > > util/trace-event-info.c:192: error: implicit declaration of function
>> > > ‘pwrite’
>> > > util/trace-event-info.c:192: error: nested extern declaration of
>> > > ‘pwrite’
>> > > make: *** [util/trace-event-info.o] Error 1
>> > >
>> > > The code I tried was latest tip:perf/core - 9e183426bfb5 ("perf kvm: Fix
>> > > copy & paste error in description") and code in mainline (v3.2) doesn't
>> > > have this problem. Looking at the code, I couldn't find any clue to
>> > > this. Any idea?
>> > >
>> > > FYI, my system is Ubuntu 10.04 on x86_64. gcc version is 4.4.3:
>> >
>> > Which header does pwrite() belong to on that system - what does
>> > 'map pwrite' say? It ought to be unistd.h, which is directly
>> > included in util/trace-event-info.c.
>> >
>> > My guess is that it might be related to:
>> >
>> > tools/perf/Makefile:ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
>> >
>> > Which introduces pwrite64() and defines pwrite() to them.
>> >
>> > Does the patch below help? It's only a workaround really as
>> > pwrite() ought to exist ... Also, i have only tested this on
>> > 64-bit.
>> >
>> > Thanks,
>> >
>> > Ingo
>> >
>> > diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
>> > index ac6830d..ba8b024 100644
>> > --- a/tools/perf/util/trace-event-info.c
>> > +++ b/tools/perf/util/trace-event-info.c
>> > @@ -189,7 +189,7 @@ static void record_file(const char *file, size_t hdr_sz)
>> > if (bigendian())
>> > sizep += sizeof(u64) - hdr_sz;
>> >
>> > - if (hdr_sz && pwrite(output_fd, sizep, hdr_sz, hdr_pos) < 0)
>> > + if (hdr_sz && pwrite64(output_fd, sizep, hdr_sz, hdr_pos) < 0)
>> > die("writing to %s", output_file);
>> > }
>> >
>>
>> Hello,
>>
>> Unfortunately, above patch doesn't work for my system:
>>
>> CC util/trace-event-info.o
>> cc1: warnings being treated as errors
>> util/trace-event-info.c: In function ‘record_file’:
>> util/trace-event-info.c:192: error: implicit declaration of function
>> ‘pwrite64’
>> util/trace-event-info.c:192: error: nested extern declaration of
>> ‘pwrite64’
>>
>> And 'map pwrite' on terminal says:
>
> 'man pwrite' i wanted to say.
Ah, OK :) here it is.
PREAD(2) Linux Programmer's Manual PREAD(2)
NAME
pread, pwrite - read from or write to a file descriptor at a given offset
SYNOPSIS
#define _XOPEN_SOURCE 500
#include <unistd.h>
ssize_t pread(int fd, void *buf, size_t count, off_t offset);
ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
...
And #defining _XOPEN_SOURCE to 500 before the #include doesn't resolve the issue.
>
>> $ 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
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [ERROR] perf build failure on current tip:perf/core
2012-01-08 12:30 ` Namhyung Kim
@ 2012-01-08 14:03 ` Ingo Molnar
2012-01-08 14:50 ` Namhyung Kim
0 siblings, 1 reply; 14+ messages in thread
From: Ingo Molnar @ 2012-01-08 14:03 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras, linux-kernel
* 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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [ERROR] perf build failure on current tip:perf/core
2012-01-08 14:03 ` Ingo Molnar
@ 2012-01-08 14:50 ` Namhyung Kim
2012-01-08 15:00 ` Ingo Molnar
0 siblings, 1 reply; 14+ messages in thread
From: Namhyung Kim @ 2012-01-08 14:50 UTC (permalink / raw)
To: Ingo Molnar
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras, linux-kernel
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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [ERROR] perf build failure on current tip:perf/core
2012-01-08 14:50 ` Namhyung Kim
@ 2012-01-08 15:00 ` Ingo Molnar
2012-01-08 15:10 ` [PATCH] perf tools: Fix compile error on x86_64 Ubuntu Namhyung Kim
0 siblings, 1 reply; 14+ messages in thread
From: Ingo Molnar @ 2012-01-08 15:00 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras, linux-kernel
* Namhyung Kim <namhyung@gmail.com> wrote:
> 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?
Could you just remove the ctype.h include? AFAICS it's not
needed in that file.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] perf tools: Fix compile error on x86_64 Ubuntu
2012-01-08 15:00 ` Ingo Molnar
@ 2012-01-08 15:10 ` Namhyung Kim
2012-01-08 15:12 ` Arnaldo Carvalho de Melo
2012-01-09 7:29 ` [tip:perf/core] " tip-bot for Namhyung Kim
0 siblings, 2 replies; 14+ messages in thread
From: Namhyung Kim @ 2012-01-08 15:10 UTC (permalink / raw)
To: Ingo Molnar
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras, linux-kernel
ctype.h is not needed here and it breaks build on some system
(at least 64bit Ubuntu 10.04) like below. Just get rid of it.
CC util/trace-event-info.o
cc1: warnings being treated as errors
util/trace-event-info.c: In function ‘record_file’:
util/trace-event-info.c:192: error: implicit declaration of function ‘pwrite’
util/trace-event-info.c:192: error: nested extern declaration of ‘pwrite’
make: *** [util/trace-event-info.o] Error 1
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
tools/perf/util/trace-event-info.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index ac6830d8292b..fc22cf5c605f 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -18,7 +18,6 @@
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
-#include <ctype.h>
#include "util.h"
#include <dirent.h>
#include <mntent.h>
--
1.7.8.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] perf tools: Fix compile error on x86_64 Ubuntu
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-09 7:29 ` [tip:perf/core] " tip-bot for Namhyung Kim
1 sibling, 1 reply; 14+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-01-08 15:12 UTC (permalink / raw)
To: Namhyung Kim; +Cc: Ingo Molnar, Peter Zijlstra, Paul Mackerras, linux-kernel
Em Mon, Jan 09, 2012 at 12:10:30AM +0900, Namhyung Kim escreveu:
> ctype.h is not needed here and it breaks build on some system
> (at least 64bit Ubuntu 10.04) like below. Just get rid of it.
Thanks, applying it together with your previous patchset.
- Arnaldo
> CC util/trace-event-info.o
> cc1: warnings being treated as errors
> util/trace-event-info.c: In function ‘record_file’:
> util/trace-event-info.c:192: error: implicit declaration of function ‘pwrite’
> util/trace-event-info.c:192: error: nested extern declaration of ‘pwrite’
> make: *** [util/trace-event-info.o] Error 1
>
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
> tools/perf/util/trace-event-info.c | 1 -
> 1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
> index ac6830d8292b..fc22cf5c605f 100644
> --- a/tools/perf/util/trace-event-info.c
> +++ b/tools/perf/util/trace-event-info.c
> @@ -18,7 +18,6 @@
> *
> * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> */
> -#include <ctype.h>
> #include "util.h"
> #include <dirent.h>
> #include <mntent.h>
> --
> 1.7.8.2
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] perf tools: Fix compile error on x86_64 Ubuntu
2012-01-08 15:12 ` Arnaldo Carvalho de Melo
@ 2012-01-08 15:32 ` Ingo Molnar
2012-01-08 15:49 ` Namhyung Kim
0 siblings, 1 reply; 14+ messages in thread
From: Ingo Molnar @ 2012-01-08 15:32 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Namhyung Kim, Peter Zijlstra, Paul Mackerras, linux-kernel
* Arnaldo Carvalho de Melo <acme@ghostprotocols.net> wrote:
> Em Mon, Jan 09, 2012 at 12:10:30AM +0900, Namhyung Kim escreveu:
> > ctype.h is not needed here and it breaks build on some system
> > (at least 64bit Ubuntu 10.04) like below. Just get rid of it.
>
> Thanks, applying it together with your previous patchset.
Note that there are other ctype.h inclusions elsewhere as well,
which should be considered for removal as well.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] perf tools: Fix compile error on x86_64 Ubuntu
2012-01-08 15:32 ` Ingo Molnar
@ 2012-01-08 15:49 ` Namhyung Kim
0 siblings, 0 replies; 14+ messages in thread
From: Namhyung Kim @ 2012-01-08 15:49 UTC (permalink / raw)
To: Ingo Molnar
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras, linux-kernel
2012-01-08 (일), 16:32 +0100, Ingo Molnar:
> * Arnaldo Carvalho de Melo <acme@ghostprotocols.net> wrote:
>
> > Em Mon, Jan 09, 2012 at 12:10:30AM +0900, Namhyung Kim escreveu:
> > > ctype.h is not needed here and it breaks build on some system
> > > (at least 64bit Ubuntu 10.04) like below. Just get rid of it.
> >
> > Thanks, applying it together with your previous patchset.
>
> Note that there are other ctype.h inclusions elsewhere as well,
> which should be considered for removal as well.
>
> Thanks,
>
> Ingo
Hi,
I'll look into them as well later.
Thanks.
--
Regards,
Namhyung Kim
^ permalink raw reply [flat|nested] 14+ messages in thread
* [tip:perf/core] perf tools: Fix compile error on x86_64 Ubuntu
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-09 7:29 ` tip-bot for Namhyung Kim
1 sibling, 0 replies; 14+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-01-09 7:29 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra,
joerg.roedel, namhyung, tglx, mingo
Commit-ID: 172d1b0b73256551f100fc00c69e356d047103f5
Gitweb: http://git.kernel.org/tip/172d1b0b73256551f100fc00c69e356d047103f5
Author: Namhyung Kim <namhyung@gmail.com>
AuthorDate: Mon, 9 Jan 2012 00:10:30 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sun, 8 Jan 2012 13:34:55 -0200
perf tools: Fix compile error on x86_64 Ubuntu
The ctype.h include is not needed here and it breaks build on some systems (at
least 64bit Ubuntu 10.04) like below. Just get rid of it.
CC util/trace-event-info.o
cc1: warnings being treated as errors
util/trace-event-info.c: In function ‘record_file’:
util/trace-event-info.c:192: error: implicit declaration of function ‘pwrite’
util/trace-event-info.c:192: error: nested extern declaration of ‘pwrite’
make: *** [util/trace-event-info.o] Error 1
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Joerg Roedel <joerg.roedel@amd.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1326035430-7621-1-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/trace-event-info.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index ac6830d..fc22cf5 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -18,7 +18,6 @@
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
-#include <ctype.h>
#include "util.h"
#include <dirent.h>
#include <mntent.h>
^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2012-01-09 7:29 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
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.