From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755981AbbJ2Jqz (ORCPT ); Thu, 29 Oct 2015 05:46:55 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:34521 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751282AbbJ2Jqy (ORCPT ); Thu, 29 Oct 2015 05:46:54 -0400 Date: Thu, 29 Oct 2015 10:46:49 +0100 From: Ingo Molnar To: Rabin Vincent Cc: Arnaldo Carvalho de Melo , jolsa@kernel.org, namhyung@kernel.org, Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, Rabin Vincent Subject: Re: [PATCHv2 3/3] perf: add helper makefile for cross compiling libs Message-ID: <20151029094649.GA6280@gmail.com> References: <1446104978-26429-1-git-send-email-rabin.vincent@axis.com> <1446104978-26429-3-git-send-email-rabin.vincent@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1446104978-26429-3-git-send-email-rabin.vincent@axis.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Rabin Vincent wrote: > It's easy to cross-compile a minimal perf binary without any external > libraries (other than a C library of course). But many useful features > depend on external libraries, so to get them one needs to either > cross-compile a bunch of libraries manually and send in the correct > paths or integrate the perf build into some external build system. > > In order to make it easier for people to qucikly get up and running with > a fairly full featured cross-compiled mainline perf, provide a helper makefile > which can be used to download and build the required libraries, which can then > be used in a static build of perf. > > For example, assuming an arm-linux-gcc cross-compiler is present in the > PATH, the following is what one seens if one tries to build a static > perf for ARM: > > $ make ARCH=arm CROSS_COMPILE=arm-linux- LDFLAGS="-static" > > Auto-detecting system features: > ... dwarf: [ OFF ] > ... glibc: [ on ] > ... gtk2: [ OFF ] > ... libaudit: [ OFF ] > ... libbfd: [ OFF ] > ... libelf: [ OFF ] > ... libnuma: [ OFF ] > ... numa_num_possible_cpus: [ OFF ] > ... libperl: [ OFF ] > ... libpython: [ OFF ] > ... libslang: [ OFF ] > ... libunwind: [ OFF ] > ... libdw-dwarf-unwind: [ OFF ] > ... zlib: [ OFF ] > ... lzma: [ OFF ] > ... get_cpuid: [ OFF ] > > By using the new Makefile.cross first, we get many important features: > > $ make ARCH=arm CROSS_COMPILE=arm-linux- -f Makefile.cross > $ make ARCH=arm CROSS_COMPILE=arm-linux- LDFLAGS="-static" > > Auto-detecting system features: > ... dwarf: [ on ] > ... glibc: [ on ] > ... gtk2: [ OFF ] > ... libaudit: [ on ] > ... libbfd: [ on ] > ... libelf: [ on ] > ... libnuma: [ OFF ] > ... numa_num_possible_cpus: [ OFF ] > ... libperl: [ OFF ] > ... libpython: [ OFF ] > ... libslang: [ on ] > ... libunwind: [ on ] > ... libdw-dwarf-unwind: [ OFF ] > ... zlib: [ on ] > ... lzma: [ on ] > ... get_cpuid: [ OFF ] That's really nice! Would it be possible to add a gcc and glibc building portion as well? That would make it entirely self-hosting. Something like: make ARCH=arm BOOTSTRAP=1 ... would magically fetch everything needed, and (given enough Internet bandwidth and a fast enough machine) build a whole cross-environment from scratch. Personally I'd even use this to bootstrap kernel cross-builds. It could also be used to cross-build to the host architecture as well: it would make it easier to test perf on the latest GCC and glibc versions. (Which the host distribution does not carry.) Thanks, Ingo