From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from knopi.disroot.org (knopi.disroot.org [178.21.23.139]) by sourceware.org (Postfix) with ESMTPS id E4EA2386545E for ; Wed, 26 May 2021 13:11:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E4EA2386545E Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 23F9351524; Wed, 26 May 2021 15:11:56 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3XGwKHJumG7E; Wed, 26 May 2021 15:11:52 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Subject: Re: [PATCH 1/1] support cross compilation From: =?utf-8?q?=C3=89rico_Nogueira?= To: "Petr Ovtchenkov" , Date: Wed, 26 May 2021 10:09:31 -0300 Message-Id: In-Reply-To: <20210526073239.21270-2-ptr@void-ptr.info> X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 May 2021 13:12:01 -0000 Hi! Are you sure this is necessary? In Void Linux, we cross compile elfutils for arm and aarch64 without any issue, and I have built it a few times for powerpc as well. On Wed May 26, 2021 at 4:32 AM -03, Petr Ovtchenkov wrote: > Possible problem with out-of-tree build expected > --- > Makefile.am | 2 +- > configure.ac | 6 ++++++ > lib-host/Makefile.am | 47 ++++++++++++++++++++++++++++++++++++++++++++ > libcpu/Makefile.am | 11 +++++++++++ > 4 files changed, 65 insertions(+), 1 deletion(-) > create mode 100644 lib-host/Makefile.am > > diff --git a/Makefile.am b/Makefile.am > index 9c47afa9..b93839ec 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -26,7 +26,7 @@ AM_MAKEFLAGS =3D --no-print-directory > =20 > pkginclude_HEADERS =3D version.h > =20 > -SUBDIRS =3D config lib libelf libcpu backends libebl libdwelf libdwfl > libdw \ > +SUBDIRS =3D config lib lib-host libelf libcpu backends libebl libdwelf > libdwfl libdw \ > libasm debuginfod src po doc tests > =20 > EXTRA_DIST =3D elfutils.spec GPG-KEY NOTES CONTRIBUTING \ > diff --git a/configure.ac b/configure.ac > index b348a717..432b961a 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -88,6 +88,7 @@ AS_IF([test "$use_locks" =3D yes], > AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.]) > =20 > AC_PROG_CC > +AX_PROG_CC_FOR_BUILD > AC_PROG_RANLIB > AC_PROG_YACC > AM_PROG_LEX > @@ -96,6 +97,8 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) > AC_CHECK_TOOL([READELF], [readelf]) > AC_CHECK_TOOL([NM], [nm]) > =20 > +AM_CONDITIONAL([CROSS], [test "x$cross_compiling" =3D xyes]) > + > # We use -std=3Dgnu99 but have explicit checks for some language > constructs > # and GNU extensions since some compilers claim GNU99 support, but don't > # really support all language extensions. In particular we need > @@ -593,6 +596,9 @@ AC_CONFIG_FILES([doc/Makefile]) > dnl Support library. > AC_CONFIG_FILES([lib/Makefile]) > =20 > +dnl Support library. > +AC_CONFIG_FILES([lib-host/Makefile]) > + > dnl ELF library. > AC_CONFIG_FILES([libelf/Makefile]) > =20 > diff --git a/lib-host/Makefile.am b/lib-host/Makefile.am > new file mode 100644 > index 00000000..9316c8ed > --- /dev/null > +++ b/lib-host/Makefile.am > @@ -0,0 +1,47 @@ > +## Process this file with automake to create Makefile.in > +## > +## Copyright (C) 1996-2011 Red Hat, Inc. > +## This file is part of elfutils. > +## > +## This file is free software; you can redistribute it and/or modify > +## it under the terms of either > +## > +## * the GNU Lesser General Public License as published by the Free > +## Software Foundation; either version 3 of the License, or (at > +## your option) any later version > +## > +## or > +## > +## * the GNU General Public License as published by the Free > +## Software Foundation; either version 2 of the License, or (at > +## your option) any later version > +## > +## or both in parallel, as here. > +## > +## elfutils is distributed in the hope that it will be useful, but > +## WITHOUT ANY WARRANTY; without even the implied warranty of > +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > +## General Public License for more details. > +## > +## You should have received copies of the GNU General Public License > and > +## the GNU Lesser General Public License along with this program. If > +## not, see . > +## > +if CROSS > + > +include $(top_srcdir)/config/eu.am > +AM_CFLAGS +=3D $(fpic_CFLAGS) > +AM_CPPFLAGS +=3D -D_GNU_SOURCE -I$(srcdir)/../lib -I$(srcdir)/../libelf > + > +noinst_LIBRARIES =3D libeu.a > + > +$(libeu_a_OBJECTS): CC=3D${CC_FOR_BUILD} > + > +libeu_a_SOURCES =3D ../lib/xstrdup.c ../lib/xstrndup.c ../lib/xmalloc.c > ../lib/next_prime.c \ > + ../lib/crc32.c ../lib/crc32_file.c \ > + ../lib/color.c ../lib/printversion.c > + > +if !GPROF > +xmalloc_CFLAGS =3D -ffunction-sections > +endif > +endif > diff --git a/libcpu/Makefile.am b/libcpu/Makefile.am > index 43844ecf..5086f8be 100644 > --- a/libcpu/Makefile.am > +++ b/libcpu/Makefile.am > @@ -27,6 +27,13 @@ > ## the GNU Lesser General Public License along with this program. If > ## not, see . > ## > + > +if CROSS > +i386_gendis_LINK =3D ${CC_FOR_BUILD} ${LDFLAGS} -o $@ > + > +$(i386_gendis_OBJECTS): CC=3D${CC_FOR_BUILD} > +endif Isn't this hardcoding an assumption that the build machine is x86? > + > include $(top_srcdir)/config/eu.am > AM_CPPFLAGS +=3D -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ > -I$(srcdir)/../libdw -I$(srcdir)/../libasm > @@ -79,7 +86,11 @@ endif > =20 > i386_lex_no_Werror =3D yes > =20 > +if CROSS > +libeu =3D ../lib-host/libeu.a > +else > libeu =3D ../lib/libeu.a > +endif > =20 > i386_lex_CFLAGS =3D -Wno-unused-label -Wno-unused-function > -Wno-sign-compare \ > -Wno-implicit-fallthrough > -- > 2.29.2.1.g08c1adf7b9