Skip to contentSkip to conversation

perf tools: Fix the NO_64BIT build on pure 64-bit systems

tip:perf/urgent In review Randy Dunlap 3 participants 8 messages Oct 13, 2009 – Oct 19, 2009 1 message not in the archive perf events

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 12 lines · On Mon, 12 Oct 2009 08:34:16 GMT tip-bot for Ingo Molnar wrote:
Commit-ID:  55621ccf2b7a8afe39df8c80f55b28424fd07d13
Gitweb:     http://git.kernel.org/tip/55621ccf2b7a8afe39df8c80f55b28424fd07d13
Author:     Ingo Molnar <[email protected]>
AuthorDate: Mon, 12 Oct 2009 09:57:25 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 12 Oct 2009 10:00:27 +0200

perf tools: Fix the NO_64BIT build on pure 64-bit systems

Randy Dunlap reported that 'make NO_64BIT=1' fails to build a pure 32-b it binary on 64-bit/64-bit x86 systems.

Quoted 6 lines

The reason is that we dont pass in the -m32 and GCC defaults to -m64.

So pass it in - and also extend the warning message about libelf dependencies - glibc-dev[el] is needed as well beyond the libelf library.

Ingo, thanks, I finally got this working, after installing more 32-bit libs etc., like Kyle said that I would need to do.

The error message is still a little misleading/confusing:
Makefile:426: *** No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]. Stop.

when elfutils-libelf-devel.i586 is installed but glibc-devel.i[56]86 is not installed. gcc failed with:
In file included from /usr/include/features.h:376,

                 from /usr/include/sys/types.h:27,
                 from /usr/include/libelf.h:53,
                 from elfdeveltest.c:1:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory

Quoted 50 lines
Cc Peter Zijlstra <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>

LKML-Reference: Message-Id: <[email protected]>

---
 tools/perf/Makefile |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
tools/perf/Makefile +13 -6
index 5881943..742a32e 100644
@@ -157,11 +157,18 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
 uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
 uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
 
-# If we're on a 64-bit kernel, use -m64
-ifndef NO_64BIT
-	ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M))
-	  M64 := -m64
-	endif
+#
+# Add -m32 for cross-builds:
+#
+ifdef NO_64BIT
+  MBITS := -m32
+else
+  #
+  # If we're on a 64-bit kernel, use -m64:
+  #
+  ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M))
+    MBITS := -m64
+  endif
 endif
 
 # CFLAGS and LDFLAGS are for the users to override from the command line.
@@ -194,7 +201,7 @@ EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
 
-CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
+CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
 LDFLAGS = -lpthread -lrt -lelf -lm
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)

tools/perf/Makefile ifeq ($(uname_S),Darwin) · line 429

Quoted 8 lines
tools/perf/Makefile +1 -1
@@ -416,7 +423,7 @@ ifeq ($(uname_S),Darwin)
 endif
 
 ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
-	msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel);
+	msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
 endif
 
 ifdef NO_DEMANGLE

---
~Randy

#2 lore raw
Quoted 27 lines · Randy Dunlap
Quoted 12 lines · On Mon, 12 Oct 2009 08:34:16 GMT tip-bot for Ingo Molnar wrote:
Commit-ID:  55621ccf2b7a8afe39df8c80f55b28424fd07d13
Gitweb:     http://git.kernel.org/tip/55621ccf2b7a8afe39df8c80f55b28424fd07d13
Author:     Ingo Molnar <[email protected]>
AuthorDate: Mon, 12 Oct 2009 09:57:25 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 12 Oct 2009 10:00:27 +0200

perf tools: Fix the NO_64BIT build on pure 64-bit systems

Randy Dunlap reported that 'make NO_64BIT=1' fails to build a pure 32-b it binary on 64-bit/64-bit x86 systems.

Quoted 6 lines

The reason is that we dont pass in the -m32 and GCC defaults to -m64.

So pass it in - and also extend the warning message about libelf dependencies - glibc-dev[el] is needed as well beyond the libelf library.

Ingo, thanks, I finally got this working, after installing more 32-bit libs etc., like Kyle said that I would need to do.

The error message is still a little misleading/confusing:
Makefile:426: *** No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]. Stop.

Quoted 7 lines

when elfutils-libelf-devel.i586 is installed but glibc-devel.i[56]86 is not installed. gcc failed with:
In file included from /usr/include/features.h:376,

                 from /usr/include/sys/types.h:27,
                 from /usr/include/libelf.h:53,
                 from elfdeveltest.c:1:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory

Why is it misleading? It says it very clearly that you need to install both:

please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]. Stop.

Ingo

#3 lore raw
Quoted 38 lines · On Wed, 14 Oct 2009 08:20:52 +0200 Ingo Molnar wrote:
Quoted 27 lines · Randy Dunlap
Quoted 12 lines · On Mon, 12 Oct 2009 08:34:16 GMT tip-bot for Ingo Molnar wrote:
Commit-ID:  55621ccf2b7a8afe39df8c80f55b28424fd07d13
Gitweb:     http://git.kernel.org/tip/55621ccf2b7a8afe39df8c80f55b28424fd07d13
Author:     Ingo Molnar <[email protected]>
AuthorDate: Mon, 12 Oct 2009 09:57:25 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 12 Oct 2009 10:00:27 +0200

perf tools: Fix the NO_64BIT build on pure 64-bit systems

Randy Dunlap reported that 'make NO_64BIT=1' fails to build a pure 32-b it binary on 64-bit/64-bit x86 systems.

Quoted 6 lines

The reason is that we dont pass in the -m32 and GCC defaults to -m64.

So pass it in - and also extend the warning message about libelf dependencies - glibc-dev[el] is needed as well beyond the libelf library.

Ingo, thanks, I finally got this working, after installing more 32-bit libs etc., like Kyle said that I would need to do.

The error message is still a little misleading/confusing:
Makefile:426: *** No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]. Stop.

Quoted 7 lines

when elfutils-libelf-devel.i586 is installed but glibc-devel.i[56]86 is not installed. gcc failed with:
In file included from /usr/include/features.h:376,

                 from /usr/include/sys/types.h:27,
                 from /usr/include/libelf.h:53,
                 from elfdeveltest.c:1:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory

Quoted 4 lines

Why is it misleading? It says it very clearly that you need to install both:

please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]. Stop.

It also says very clearly:

Makefile:426: *** No libelf.h/libelf found

which is not correct.

---
~Randy

#4 lore raw

Em Wed, Oct 14, 2009 at 07:44:04AM -0700, Randy Dunlap escreveu:

Quoted 43 lines · On Wed, 14 Oct 2009 08:20:52 +0200 Ingo Molnar wrote:
Quoted 42 lines · Randy Dunlap
Quoted 28 lines · On Mon, 12 Oct 2009 08:34:16 GMT tip-bot for Ingo Molnar wrote:
Quoted 13 lines
Commit-ID:  55621ccf2b7a8afe39df8c80f55b28424fd07d13
Gitweb:     http://git.kernel.org/tip/55621ccf2b7a8afe39df8c80f55b28424fd07d13
Author:     Ingo Molnar <[email protected]>
AuthorDate: Mon, 12 Oct 2009 09:57:25 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 12 Oct 2009 10:00:27 +0200

perf tools: Fix the NO_64BIT build on pure 64-bit systems

Randy Dunlap reported that 'make NO_64BIT=1' fails to build a pure 32-b it binary on 64-bit/64-bit x86 systems.

Quoted 6 lines

The reason is that we dont pass in the -m32 and GCC defaults to -m64.

So pass it in - and also extend the warning message about libelf dependencies - glibc-dev[el] is needed as well beyond the libelf library.

Ingo, thanks, I finally got this working, after installing more 32-bit libs etc., like Kyle said that I would need to do.

The error message is still a little misleading/confusing:
Makefile:426: *** No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]. Stop.

Quoted 7 lines

when elfutils-libelf-devel.i586 is installed but glibc-devel.i[56]86 is not installed. gcc failed with:
In file included from /usr/include/features.h:376,

                 from /usr/include/sys/types.h:27,
                 from /usr/include/libelf.h:53,
                 from elfdeveltest.c:1:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory

Why is it misleading? It says it very clearly that you need to install both:

Quoted 7 lines
Quoted 1 line

please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]. Stop.

It also says very clearly:

Makefile:426: *** No libelf.h/libelf found

which is not correct.

So the correct way is to first look for the presence of glibc-devel, barf if its not present, then after that, do what is done now and test for the presence of libelf.h :-\

But if one just follows the suggestion, and installs the suggested packages, it should work, no?

- Arnaldo

#5 lore raw
Quoted 50 lines · Arnaldo Carvalho de Melo

Em Wed, Oct 14, 2009 at 07:44:04AM -0700, Randy Dunlap escreveu:

Quoted 49 lines · On Wed, 14 Oct 2009 08:20:52 +0200 Ingo Molnar wrote:
Quoted 39 lines · Randy Dunlap
Quoted 28 lines · On Mon, 12 Oct 2009 08:34:16 GMT tip-bot for Ingo Molnar wrote:
Quoted 13 lines
Commit-ID:  55621ccf2b7a8afe39df8c80f55b28424fd07d13
Gitweb:     http://git.kernel.org/tip/55621ccf2b7a8afe39df8c80f55b28424fd07d13
Author:     Ingo Molnar <[email protected]>
AuthorDate: Mon, 12 Oct 2009 09:57:25 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 12 Oct 2009 10:00:27 +0200

perf tools: Fix the NO_64BIT build on pure 64-bit systems

Randy Dunlap reported that 'make NO_64BIT=1' fails to build a pure 32-b it binary on 64-bit/64-bit x86 systems.

Quoted 6 lines

The reason is that we dont pass in the -m32 and GCC defaults to -m64.

So pass it in - and also extend the warning message about libelf dependencies - glibc-dev[el] is needed as well beyond the libelf library.

Ingo, thanks, I finally got this working, after installing more 32-bit libs etc., like Kyle said that I would need to do.

The error message is still a little misleading/confusing:
Makefile:426: *** No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]. Stop.

Quoted 7 lines

when elfutils-libelf-devel.i586 is installed but glibc-devel.i[56]86 is not installed. gcc failed with:
In file included from /usr/include/features.h:376,

                 from /usr/include/sys/types.h:27,
                 from /usr/include/libelf.h:53,
                 from elfdeveltest.c:1:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory

Quoted 4 lines

Why is it misleading? It says it very clearly that you need to install both:

please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]. Stop.

It also says very clearly:

Makefile:426: *** No libelf.h/libelf found

Quoted 8 lines
Quoted 1 line

which is not correct.

So the correct way is to first look for the presence of glibc-devel, barf if its not present, then after that, do what is done now and test for the presence of libelf.h :-\

But if one just follows the suggestion, and installs the suggested packages, it should work, no?

well .. send me a patch that makes the message more ambigious, so that we output something like:

Quoted 1 line

Makefile:426: *** No ELF support found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]. Stop.

that should make it useful enough, without complicating the make rules.

Ingo

#6 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 50 lines · On Wed, 14 Oct 2009 12:58:48 -0300 Arnaldo Carvalho de Melo wrote:

Em Wed, Oct 14, 2009 at 07:44:04AM -0700, Randy Dunlap escreveu:

Quoted 49 lines · On Wed, 14 Oct 2009 08:20:52 +0200 Ingo Molnar wrote:
Quoted 39 lines · Randy Dunlap
Quoted 28 lines · On Mon, 12 Oct 2009 08:34:16 GMT tip-bot for Ingo Molnar wrote:
Quoted 13 lines
Commit-ID:  55621ccf2b7a8afe39df8c80f55b28424fd07d13
Gitweb:     http://git.kernel.org/tip/55621ccf2b7a8afe39df8c80f55b28424fd07d13
Author:     Ingo Molnar <[email protected]>
AuthorDate: Mon, 12 Oct 2009 09:57:25 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 12 Oct 2009 10:00:27 +0200

perf tools: Fix the NO_64BIT build on pure 64-bit systems

Randy Dunlap reported that 'make NO_64BIT=1' fails to build a pure 32-b it binary on 64-bit/64-bit x86 systems.

Quoted 6 lines

The reason is that we dont pass in the -m32 and GCC defaults to -m64.

So pass it in - and also extend the warning message about libelf dependencies - glibc-dev[el] is needed as well beyond the libelf library.

Ingo, thanks, I finally got this working, after installing more 32-bit libs etc., like Kyle said that I would need to do.

The error message is still a little misleading/confusing:
Makefile:426: *** No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]. Stop.

Quoted 7 lines

when elfutils-libelf-devel.i586 is installed but glibc-devel.i[56]86 is not installed. gcc failed with:
In file included from /usr/include/features.h:376,

                 from /usr/include/sys/types.h:27,
                 from /usr/include/libelf.h:53,
                 from elfdeveltest.c:1:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory

Quoted 4 lines

Why is it misleading? It says it very clearly that you need to install both:

please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]. Stop.

It also says very clearly:

Makefile:426: *** No libelf.h/libelf found

Quoted 8 lines
Quoted 1 line

which is not correct.

So the correct way is to first look for the presence of glibc-devel, barf if its not present, then after that, do what is done now and test for the presence of libelf.h :-\

But if one just follows the suggestion, and installs the suggested packages, it should work, no?

Yes, it's just the confusing message...

---
~Randy

#7 lore raw

PATCH 1/1 perf tools: better error messages on missing packages

In reply to Arnaldo Carvalho de Melo

From: Randy Dunlap <[email protected]>

Check for libelf headers and glibc headers separately so that the error message correctly identifies which package installation is missing/needed.

---
 tools/perf/Makefile |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/Makefile +5 -1
@@ -422,8 +422,12 @@ ifeq ($(uname_S),Darwin)
 	PTHREAD_LIBS =
 endif
 
+ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
+	msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]);
+endif
+
 ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
-	msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
+	msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel);
 endif
 
 ifdef NO_DEMANGLE
#8 lore raw

[tip:perf/core] perf tools: Display better error messages on missing packages

Commit-ID:  1abc7f5500fff8422f34826a006648d8741d83d3
Gitweb:     http://git.kernel.org/tip/1abc7f5500fff8422f34826a006648d8741d83d3
Author:     Randy Dunlap <[email protected]>
AuthorDate: Sun, 18 Oct 2009 19:20:24 -0700
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 19 Oct 2009 10:06:37 +0200

perf tools: Display better error messages on missing packages

Check for libelf headers and glibc headers separately so that the error message correctly identifies which package installation is missing/needed.

LKML-Reference: <[email protected]>

---
 tools/perf/Makefile |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
tools/perf/Makefile +5 -1
index 2400e50..db89a6d 100644
@@ -431,8 +431,12 @@ ifeq ($(uname_S),Darwin)
 	PTHREAD_LIBS =
 endif
 
+ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
+	msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]);
+endif
+
 ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
-	msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
+	msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel);
 endif
 
 ifdef NO_DEMANGLE