All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix build failures of python/perf.so.
@ 2013-07-22 11:45 Oliver Yang
  2013-07-22 15:02 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Yang @ 2013-07-22 11:45 UTC (permalink / raw)
  To: acme; +Cc: linux-kernel, linux-perf-users, Oliver Yang

If gcc and python are not under the standard path, it could cause
the build failure of perf.so.

Signed-off-by: Oliver Yang <yangoliver@gmail.com>
---
 tools/perf/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 641fccd..9f88f6f 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -151,7 +151,7 @@ PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
 PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBLK)
 
 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
-	$(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \
+	$(QUIET_GEN)CFLAGS='$(CROSS_COMPILE)' '$(CFLAGS)' $(PYTHON_WORD) util/setup.py \
 	  --quiet build_ext; \
 	mkdir -p $(OUTPUT)python && \
 	cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/
-- 
1.8.1.2


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

* Re: [PATCH] Fix build failures of python/perf.so.
  2013-07-22 11:45 [PATCH] Fix build failures of python/perf.so Oliver Yang
@ 2013-07-22 15:02 ` Arnaldo Carvalho de Melo
  2013-07-22 18:40   ` Oliver Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-07-22 15:02 UTC (permalink / raw)
  To: Oliver Yang; +Cc: linux-kernel, linux-perf-users

Em Mon, Jul 22, 2013 at 07:45:59PM +0800, Oliver Yang escreveu:
> If gcc and python are not under the standard path, it could cause
> the build failure of perf.so.

How can just adding the prefix to the compiler like that fix something?

Looking at the references to CROSS_COMPILE in tools/perf/Makefile:

-----------------------------------

# Define CROSS_COMPILE as prefix name of compiler if you want
# cross-builds.

<SNIP>

CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar

-----------------------------------

Can you provide the make command line you're using that makes it work
for you with this patch?

Thanks,

- Arnaldo
 
> Signed-off-by: Oliver Yang <yangoliver@gmail.com>
> ---
>  tools/perf/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index 641fccd..9f88f6f 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -151,7 +151,7 @@ PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
>  PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBLK)
>  
>  $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
> -	$(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \
> +	$(QUIET_GEN)CFLAGS='$(CROSS_COMPILE)' '$(CFLAGS)' $(PYTHON_WORD) util/setup.py \
>  	  --quiet build_ext; \
>  	mkdir -p $(OUTPUT)python && \
>  	cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/
> -- 
> 1.8.1.2

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

* Re: [PATCH] Fix build failures of python/perf.so.
  2013-07-22 15:02 ` Arnaldo Carvalho de Melo
@ 2013-07-22 18:40   ` Oliver Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Oliver Yang @ 2013-07-22 18:40 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: linux-kernel, linux-perf-users

于 7/22/2013 11:02 PM, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jul 22, 2013 at 07:45:59PM +0800, Oliver Yang escreveu:
>> If gcc and python are not under the standard path, it could cause
>> the build failure of perf.so.
> 
> How can just adding the prefix to the compiler like that fix something?

Sorry for causing the confusions. I sent out a wrong patch.

The one I want to send out was,

 $(OUTPUT)python/perf.so: $(PYRF_OBJS)
-       $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \
+       $(QUIET_GEN)PATH='$(CROSS_COMPILE)' CFLAGS='$(BASIC_CFLAGS)'
$(PYTHON_WORD) util/setup.py \
          --quiet build_ext; \
        mkdir -p $(OUTPUT)python && \
        cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/


But I realized that our customized env had a naming conflicts with
perf makefile. In our customized top level makefile, we defined
'CROSS_COMPILE' as the location of compiler, which is under a
non-standard path.

If without this fix, when we use the python from a non-standard
location, it will try to find gcc under the directory defined by
$PATH. But we do want to specify the gcc location which matched with
our specified python version.

Here is the original error messages, the gcc matched with python was
not under the directory defined by $PATH,

CFLAGS='-Iutil/include -Iarch/x86/include -DLIBELF_NO_MMAP
-DNO_NEWT_SUPPORT -DNO_LIBPERL -DHAVE_CPLUS_DEMANGLE -DNO_STRLCPY'
'/nfs/tools/usr/bin/python' util/setup.py \
  --quiet build_ext; \
mkdir -p python && \
cp python_ext_build/lib/perf.so python/
unable to execute gcc: Not a directory
error: command 'gcc' failed with exit status 1
cp: cannot stat `python_ext_build/lib/perf.so': No such file or directory
make: *** [python/perf.so] Error 1

> 
> Looking at the references to CROSS_COMPILE in tools/perf/Makefile:
> 
> -----------------------------------
> 
> # Define CROSS_COMPILE as prefix name of compiler if you want
> # cross-builds.
> 
> <SNIP>
> 
> CC = $(CROSS_COMPILE)gcc
> AR = $(CROSS_COMPILE)ar
> 
> -----------------------------------
> 
> Can you provide the make command line you're using that makes it work
> for you with this patch?

I just export CROSS_COMPILE with a directory contained with right gcc
version. Now I realize that this patch is NOT correct, and it just
happened to work.

Thanks for your comments. Sorry again.


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

end of thread, other threads:[~2013-07-22 18:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-22 11:45 [PATCH] Fix build failures of python/perf.so Oliver Yang
2013-07-22 15:02 ` Arnaldo Carvalho de Melo
2013-07-22 18:40   ` Oliver Yang

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.