From patchwork Wed May 14 07:50:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Hsu X-Patchwork-Id: 30149 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3E37120446 for ; Wed, 14 May 2014 07:50:46 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id rd18sf7377487iec.3 for ; Wed, 14 May 2014 00:50:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :from:date:message-id:to:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type; bh=rAu5YEutiAyEskIstLZQlK/OOWEP+Ani2TnOvCgN46k=; b=P+rmZX+gyQXCcB4uKYP/sY16jVsTeu1VSHIheAnuRsPW93+uDcau3Lq16Wq++5eDN5 Mxhbd0rsgxnnRczx1AIHc9XsMrnOdQ7Vq70acnNPcMQeUecA4lQGPlwSy1+KoOwQQRe7 v8hw8gpqVWk/C2ndz1iqmtnLcozNHVXAHZenL0UQPNnPtkzSWBQhtpO8Q8c/pZ9Kyicw nPC5sZNXvZvCrjsKG6rJaSbTIyHNBclqsqZoGwaIC8Ys1yqD+g7F3uNmX9wlY4VnJiKE zvit0l/5XvcjOEPt3QYsNwmDHGamNof9iaGAPKuoTeDQFl/cE3YtnEb7l+iBnfZtTi69 BUqA== X-Gm-Message-State: ALoCoQlzIcPbrLYQOFlULZAsQdLfcHnV1WRYVVm/FpaBoylpMZKVDVZ1LNOUQFE2Gd4tQuQ7FGYU X-Received: by 10.42.209.18 with SMTP id ge18mr876601icb.7.1400053845708; Wed, 14 May 2014 00:50:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.81.115 with SMTP id e106ls2332420qgd.65.gmail; Wed, 14 May 2014 00:50:45 -0700 (PDT) X-Received: by 10.58.195.231 with SMTP id ih7mr1756929vec.32.1400053845587; Wed, 14 May 2014 00:50:45 -0700 (PDT) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id w17si190161vek.139.2014.05.14.00.50.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 May 2014 00:50:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.182 as permitted sender) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id sa20so1950178veb.27 for ; Wed, 14 May 2014 00:50:45 -0700 (PDT) X-Received: by 10.58.116.1 with SMTP id js1mr1740199veb.29.1400053845474; Wed, 14 May 2014 00:50:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp218399vcb; Wed, 14 May 2014 00:50:44 -0700 (PDT) X-Received: by 10.229.171.193 with SMTP id i1mr3513380qcz.15.1400053844170; Wed, 14 May 2014 00:50:44 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id o3si441941qcc.5.2014.05.14.00.50.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 14 May 2014 00:50:44 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1WkTwl-0003f8-6w; Wed, 14 May 2014 07:49:51 +0000 Received: from mail-qg0-f42.google.com ([209.85.192.42]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1WkTwe-0003f3-NK for lng-odp@lists.linaro.org; Wed, 14 May 2014 07:49:44 +0000 Received: by mail-qg0-f42.google.com with SMTP id q107so2243865qgd.1 for ; Wed, 14 May 2014 00:50:30 -0700 (PDT) X-Received: by 10.224.66.193 with SMTP id o1mr940758qai.43.1400053830818; Wed, 14 May 2014 00:50:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.36.41 with HTTP; Wed, 14 May 2014 00:50:10 -0700 (PDT) In-Reply-To: References: <1399996268-13125-1-git-send-email-maxim.uvarov@linaro.org> <53723FD6.10506@linaro.org> <53724455.1050102@linaro.org> From: Vincent Hsu Date: Wed, 14 May 2014 15:50:10 +0800 Message-ID: To: Victor Kamensky X-Topics: patch Cc: lng-odp-forward Subject: Re: [lng-odp] [APPS/PATCH] cross compilation support X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vincent.hsu@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 On Wed, May 14, 2014 at 12:48 AM, Victor Kamensky < victor.kamensky@linaro.org> wrote: > On 13 May 2014 09:12, Maxim Uvarov wrote: > > On 05/13/2014 08:06 PM, Victor Kamensky wrote: > >> > >> Hi Maxim, > >> > >> Why do you need to introduce CROSS_COMPILE? If one need to > >> compile this code in cross compilation mode would not it be > >> sufficient to be able redefine CC, CFLAGS and such externally. > >> > >> Note defining CROSS_COMPILE normally is not sufficient for > >> user-land app build (unlike kernel). One need to have pointer to > >> sysroot that contains all libraries, include files, etc. > >> > >> IMHO Makefile should be cross compilation friendly, with meaning > >> that CC, CFLAGS, and other could be defined externally. Don't we > >> already have OE recipe for ODP, that one does cross compilation > >> for sure? > >> > >> Thanks, > >> Victor > > > > There are number of applications. Each of them uses configure. So that I > > need to provide --host=arm there somehow. > > Just setting CC and CFLAGS does not help. So that was the easiest way to > > call each configure with right options. > > And just setting --host is not enough in general cross compilation > case. Personally unless I see how it could be build under OE, > any other "cross-compilation" support is useless IMHO. > > For this thing to be buildable under OE whole code of odp-apps > should be restructured, separate recipes for openvpn odp enabled, > and libpcap odp enabled should be provided, odp patches integrated > in regular OE in SRC_URI, OE_EXTRA config etc should be > supplied and so on. > > Otherwise, If I want to try to build odp enabled openvpn in cross > compile mode for my Arndale board with OE image running, what do > I do? And how proposed below patch will help me? Note both > openvpn and libpcap can be built under OE without any problem. > > Thanks, > Victor > > > Maxim. > > > >> On 13 May 2014 08:52, Maxim Uvarov wrote: > >>> > >>> Hi VIncent, > >>> > >>> can you test this patch? Looks like you have openssl and all other req > >>> installed in cross env. > >>> > >>> make CROSS_COMPILE=armeb-linux-gnueabihf > >>> > >>> Thanks, > >>> Maxim. > >>> > >>> > >>> On 05/13/2014 07:51 PM, Maxim Uvarov wrote: > >>>> > >>>> Signed-off-by: Maxim Uvarov > >>>> --- > >>>> Makefile | 4 +++- > >>>> libpcap/Makefile | 8 +++++--- > >>>> openvpn/Makefile | 6 +++--- > >>>> 3 files changed, 11 insertions(+), 7 deletions(-) > >>>> > >>>> diff --git a/Makefile b/Makefile > >>>> index cab82f4..78e9320 100644 > >>>> --- a/Makefile > >>>> +++ b/Makefile > >>>> @@ -2,6 +2,8 @@ > >>>> all: openvpn libpcap > >>>> +export $(CROSS_COMPILE) > >>>> + > >>>> libpcap: odp > >>>> make -C libpcap ODP_DIR=$(PWD)/odp.git > >>>> @@ -12,7 +14,7 @@ odp: > >>>> if [ ! -d odp.git ]; \ > >>>> then git clone http://git.linaro.org/git/lng/odp.git > >>>> odp.git; \ > >>>> fi > >>>> - cd odp.git; make libs_install CFLAGS="-fPIC" > >>>> + cd odp.git; make libs_install CFLAGS="-fPIC" > >>>> CC=$(CROSS_COMPILE)-gcc > >>>> distclean: > >>>> rm -rf odp.git > >>>> diff --git a/libpcap/Makefile b/libpcap/Makefile > >>>> index 5e47b4a..a00f5b7 100644 > >>>> --- a/libpcap/Makefile > >>>> +++ b/libpcap/Makefile > >>>> @@ -15,6 +15,8 @@ WIRESHARK_VERSION=wireshark-1.8.9 > >>>> ODP_DIR ?= $(PWD)/../odp.git > >>>> +HOST ?= `$(CROSS_COMPILE)-gcc -dumpmachine` > >>>> + > >>>> .PHONY: all > >>>> all: libpcap tcpdump > >>>> @@ -32,7 +34,7 @@ libpcap: get_libpcap > >>>> cd $(LIBPCAP_DIR) \ > >>>> && git checkout $(LIBPCAP_VERSION) \ > >>>> && git am ../patches/*.patch \ > >>>> - && ./configure --with-odp=$(ODP_DIR) --libdir=/usr/lib > >>>> + && ac_cv_linux_vers=3.2.51 ./configure --with-pcap=linux > >>>> --with-odp=$(ODP_DIR) --libdir=/usr/lib --host=$(HOST) > >>>> $(MAKE) -C $(LIBPCAP_DIR) > >>>> .PHONY: get_libpcap > >>>> @@ -54,7 +56,7 @@ clean_libpcap: > >>>> tcpdump: get_tcpdump libpcap > >>>> cd $(TCPDUMP_DIR) \ > >>>> && git checkout $(TCPDUMP_VERSION) \ > >>>> - && ./configure LIBS="-lrt" > >>>> + && ac_cv_linux_vers=3.2.51 ./configure LIBS="-lrt" > >>>> --host=$(HOST) > >>>> $(MAKE) -C $(TCPDUMP_DIR) > >>>> .PHONY: get_tcpdump > >>>> @@ -76,7 +78,7 @@ clean_tcpdump: > >>>> wireshark: get_wireshark libpcap > >>>> cd $(WIRESHARK_DIR) \ > >>>> && git checkout $(WIRESHARK_VERSION) \ > >>>> - && ./autogen.sh && ./configure > >>>> + && ./autogen.sh && ./configure --host=$(HOST) > >>>> $(MAKE) -C $(WIRESHARK_DIR) > >>>> .PHONY: get_wireshark > >>>> diff --git a/openvpn/Makefile b/openvpn/Makefile > >>>> index 68e4348..5117490 100644 > >>>> --- a/openvpn/Makefile > >>>> +++ b/openvpn/Makefile > >>>> @@ -9,6 +9,8 @@ > OPENVPN_VERSION=cd6555e0159987ef264789f4976053ce2aa5fc20 > >>>> ODP_DIR ?= $(PWD)/../odp.git > >>>> +HOST ?= `$(CROSS_COMPILE)-gcc -dumpmachine` > >>>> + > >>>> .PHONY: all > >>>> all: openvpn odp_ipcd > >>>> @@ -22,14 +24,12 @@ openvpn: > >>>> git clone $(OPENVPN_REPO) $(OPENVPN_DIR);\ > >>>> else\ > >>>> cd $(OPENVPN_DIR);\ > >>>> - git fetch --all;\ > >>>> fi > >>>> - > >>>> cd $(OPENVPN_DIR) \ > >>>> && git checkout $(OPENVPN_VERSION) \ > >>>> && git am ../patches/*.patch \ > >>>> && autoreconf -i -v -f \ > >>>> - && ./configure > >>>> + && ./configure --host=$(HOST) --disable-snappy --disable-lzo > >>>> make -C $(OPENVPN_DIR) > >>>> .PHONY: clean_openvpn > >>> > >>> > >>> > >>> _______________________________________________ > >>> lng-odp mailing list > >>> lng-odp@lists.linaro.org > >>> http://lists.linaro.org/mailman/listinfo/lng-odp > > > > > My environment is not a stand alone cross compilation environment like OE. It needs to set the ssl headers and libs path when configure the openvpn. Besides, openvpn seems only accept "host=arm-linux". I must do following changes, but it's redundant for stand alone build environment. make CC=armeb-linux-gnueabihf-gcc or maybe we can set $CC when export $ARCH and $CORSS_COMPILE. diff --git a/openvpn/Makefile b/openvpn/Makefile index 5117490..4169817 100644 --- a/openvpn/Makefile +++ b/openvpn/Makefile @@ -29,7 +29,7 @@ openvpn: && git checkout $(OPENVPN_VERSION) \ && git am ../patches/*.patch \ && autoreconf -i -v -f \ - && ./configure --host=$(HOST) --disable-snappy --disable-lzo + && OPENSSL_SSL_CFLAGS="-I/home/vincent/openssl-1.0.1g/include" OPENSSL_SSL_LIBS="-L/home/vincent/openssl-1.0.1g -lssl -ldl" ./configure --host=arm-linux --disable-snappy --disable-lzo make -C $(OPENVPN_DIR) If "--host=" has no argument, It will use x86 by default. And autoconf will automatically add gcc to the end of $(host) to be cross-compiler name. If we do following change, we won't force to use gcc. diff --git a/Makefile b/Makefile index 78e9320..1b720a6 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ odp: if [ ! -d odp.git ]; \ then git clone http://git.linaro.org/git/lng/odp.gitodp.git; \ fi - cd odp.git; make libs_install CFLAGS="-fPIC" CC=$(CROSS_COMPILE)-gcc + cd odp.git; make libs_install CFLAGS="-fPIC" distclean: rm -rf odp.git diff --git a/libpcap/Makefile b/libpcap/Makefile index a00f5b7..4781963 100644 --- a/libpcap/Makefile +++ b/libpcap/Makefile @@ -15,7 +15,7 @@ WIRESHARK_VERSION=wireshark-1.8.9 ODP_DIR ?= $(PWD)/../odp.git -HOST ?= `$(CROSS_COMPILE)-gcc -dumpmachine` +HOST ?= `$(CC) -dumpmachine` .PHONY: all all: libpcap tcpdump diff --git a/openvpn/Makefile b/openvpn/Makefile index 5117490..15ac3a1 100644 --- a/openvpn/Makefile +++ b/openvpn/Makefile @@ -9,7 +9,7 @@ OPENVPN_VERSION=cd6555e0159987ef264789f4976053ce2aa5fc20 ODP_DIR ?= $(PWD)/../odp.git -HOST ?= `$(CROSS_COMPILE)-gcc -dumpmachine` +HOST ?= `$(CC) -dumpmachine` .PHONY: all all: openvpn odp_ipcd