From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id gJccJmaoxWKkGwAAbAwnHQ (envelope-from ) for ; Wed, 06 Jul 2022 17:21:10 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 6GvbJWaoxWI/gwAAauVa8A (envelope-from ) for ; Wed, 06 Jul 2022 17:21:10 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4A5ED2AE38 for ; Wed, 6 Jul 2022 17:21:09 +0200 (CEST) Received: from localhost ([::1]:47720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o96pw-0007KL-TB for larch@yhetil.org; Wed, 06 Jul 2022 11:21:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o96pT-0007Ju-Ci for help-guix@gnu.org; Wed, 06 Jul 2022 11:20:39 -0400 Received: from cyberdimension.org ([2001:910:1314:ffff::1]:45374 helo=gnutoo.cyberdimension.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1o96pR-0006lc-7h for help-guix@gnu.org; Wed, 06 Jul 2022 11:20:39 -0400 Received: from gnutoo.cyberdimension.org (localhost [127.0.0.1]) by cyberdimension.org (OpenSMTPD) with ESMTP id 86d980d9; Wed, 6 Jul 2022 15:20:03 +0000 (UTC) Received: from primarylaptop.localdomain (localhost [::1]) by gnutoo.cyberdimension.org (OpenSMTPD) with ESMTP id b90b31f3; Wed, 6 Jul 2022 15:20:03 +0000 (UTC) Date: Wed, 6 Jul 2022 17:20:27 +0200 From: Denis 'GNUtoo' Carikli To: help-guix@gnu.org, Julien Lepiller Subject: Android.mk build system limitations Message-ID: <20220706172027.22fdd325@primarylaptop.localdomain> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; i686-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/pvxNL/3KgmUSEthlP=n1o.v"; protocol="application/pgp-signature"; micalg=pgp-sha256 Received-SPF: pass client-ip=2001:910:1314:ffff::1; envelope-from=GNUtoo@cyberdimension.org; helo=gnutoo.cyberdimension.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1657120870; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=+uzwha5/1Iyr5KQ7fKOzJLX6Unt0KOoV6KkCZcLvsxY=; b=G04rEErysbFqH8WNvouN9d6+3GjNbQ734b+rn92ZereoHIJa8TPI/N0aKZcbQgWjuoGuTv EM/38MFssj9Qx8ARxzPr60CnigBpHr9lT2vLXceN9CzQPU1806EYCQ26KlcYOgQ/aMqoK2 70XXQjPOo46LEsoDPyp33MbQja0B3r0TjuXYZBG+q0wLCanBy1tbU3JcZXX+1qKhp3gzvA 0CNMaWTrVBHdROTkiSPMD260EcYy6JdMtBIvDF8+UyGB/FYHK54zQDUdSEUHo/CHybOV7x rq8ahQzyGACViMItTxiPBU0ZMcezH4rn6L/o3fXpNGLXVgl97E/v/ExUzXaEtA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1657120870; a=rsa-sha256; cv=none; b=I2ILe79VFGilQAckD443240jpX0tMsT1j4zNS9Zn9W16IrPB6iTWtWn/q9sehbPsT4CYTv QEualW0B85pTQ4hVf+0AqB0cZp8T6zBjjPyrVlrIfSGTFgINwTVxTxifNE7dVmJbxhOitQ PFmzXTM4JRx8fXUogzvbO6KQKbxLfCYaMqdDzklJemUMBQ6gJiauNn3EpFH/EIZpqgZrbl 18Dyn9EcV5OODj0HOW3hogCa8slfdnhhs1kT35ZRgIs1rwFFPRwiuicEBD3HiDWYGmkCJ/ NZpiuvpb+xw/Oj3KqvEFP57kA9gF9xMPn47HCIwbLeraQiSBVZlUP1ab2cEzRQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.65 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 4A5ED2AE38 X-Spam-Score: -5.65 X-Migadu-Scanner: scn0.migadu.com X-TUID: aHnCEOUsvtZs --Sig_/pvxNL/3KgmUSEthlP=n1o.v Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi, I'm maintaining a library that can be used in both Android and GNU/Linux. To do quick build tests in various configurations before pushing commits, I use a guix.scm[1] file. With that I'm also testing the build with the Android.mk to find potential issues. There are several limitations with the Android.mk build system in Guix. A well known one is the inability to handle cross compilation, so people using that build system typically work around that with something like that[2]: > (modify-phases %standard-phases > (add-before 'build 'patch-host > (lambda _ > ;; TODO: Cross-compile. > (substitute* "Android.mk" > (("BUILD_STATIC_LIBRARY") "BUILD_HOST_STATIC_LIBRARY")) > #t))) However I found an issue that is more problematic: this build system expects an Android.mk with a single target (which is defined with "LOCAL_MODULE :=3D" in the Android.mk).=20 Until now I didn't implement that in my guix.scm and only built the library and not the associated utilities. But then recently I found that the build broke in Android because I forgot to add some source code files for one of the utilities in the Android.mk file, so I now really want to build the utilities too in that guix.scm with the Android.mk build system. With some help on #guix on liberachat, I managed to run the make multiple times, and to pass it a list of local-modules to build. The new build function looks like that[3]: > (replace 'build > (lambda* > (#:key inputs make-flags native-inputs outputs #:allow-other-keys) > (for-each > (lambda (arg) > (substitute* "Android.mk" > (("BUILD_EXECUTABLE") > "BUILD_HOST_EXECUTABLE")) > ((assoc-ref %standard-phases 'build) > #:make-flags (append make-flags > (list (string-append "LOCAL_MODULE=3D" arg))))) > ,local-modules) > #t)) And the new installation function looks really similar: > (replace 'install > (lambda* > (#:key inputs make-flags native-inputs outputs #:allow-other-keys) > (for-each > (lambda (arg) > ((assoc-ref %standard-phases 'install) > #:inputs inputs > #:outputs outputs > #:make-flags > (append make-flags > (list (string-append "LOCAL_MODULE=3D" arg))))) > ,local-modules) > #t)) But it then ends up building the first local-module in the local-modules list, many times, and install it with different names. After building, we can see that https-send-sms was built correctly: > $ /gnu/store/[...]-libsamsung-ipc-gcc-android-0.0-HEAD.c4d664a/bin/https-= send-sms=20 > Usage: > /gnu/store/[...]-libsamsung-ipc-gcc-android-0.0-HEAD.c4d664a/bin/https-se= nd-sms > free-mobile >=20 > Example: > /gnu/store/[...]-libsamsung-ipc-gcc-android-0.0-HEAD.c4d664a/bin/https-s= end-sms > free-mobile "12345678" "1234abcdEFGH" "hello world!" > $ /gnu/store/[...]-libsamsung-ipc-gcc-android-0.0-HEAD.c4d664a/bin/ipc-te= st But the same source code was also used to build ipc-test > Usage: /gnu/store/[...]-libsamsung-ipc-gcc-android-0.0-HEAD.c4d664a/bin/i= pc-test free-mobile >=20 > Example: > /gnu/store/[...]-libsamsung-ipc-gcc-android-0.0-HEAD.c4d664a/bin/ipc-tes= t free-mobile "12345678" "1234abcdEFGH" "hello world!" And if ipc-test source code was used we would end up with something like that instead: > $ ipc-test > Creating client failed So I'm a bit confused on how to solve this issue. I'm also not sure if it needs to be solved in Guix or in the underlying Makefiles that makes it possible to use Android.mk files under GNU/Linux. I'm writing that mail in the hope that people who knows better the implementation of the Android.mk build system in Guix would have pointers to help me solve that issue. References: ----------- [1]https://git.replicant.us/replicant/hardware_replicant_libsamsung-ipc/pla= in/scripts/guix.scm [2]from android-safe-iop from gnu/packages/android.scm in Guix [3]https://git.replicant.us/contrib/GNUtoo/replicant/hardware_replicant_lib= samsung-ipc/plain/scripts/guix.scm?h=3Dc4d664ae71eb65415d799ada8018cfa49f6f= b7fb Denis. --Sig_/pvxNL/3KgmUSEthlP=n1o.v Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEeC+d2+Nrp/PU3kkGX138wUF34mMFAmLFqDsACgkQX138wUF3 4mO1uQ//S5lLJLWL1LupGhqh4ziIJUibzuy4QOB+Qhs+ug4EjnjB6Z2TU11b4kCM 1q2IgFXVVyD+rgznGe0GsHrYoHV781rNZCA96Nhy7ycGuWNZTXmKIjnsQPetRYPM pNd2WSuVi+FJT9wLXXKhCMCbpEeNTO78e2OjgXu2x9rXdYmPmHn6s2LZ0wiI1n2d XqBCt3yW3YcQT2n+NlULlFQ8ToXrua6P3RoOI/1HUcadXSexIUMjvr6xdXATnlxK /J2H2J9zxgaglFiR0DAmQOYB7OIuZfFpfLiotwc1qBvzVV4I/W88lyoGI1y23RKN 6PDfa6RfS+CCEt+AQQMqyofE4537FF+Yh4ugL8vzJIvCX5n8GYDcWYCS1uqIitWF WxmaYRRbfQ+7Psm8EjzPkgSoFIDcs3Y8ssVPvm/dl6y6+zCq4LEYrloBoxhYggT/ uI+Gu+UggDqnVtsaDqb8U7A2c+RZGhqpVBGlYLgnfUn7pqc8twwejustmWanxo/8 WcMHqIxTMJ0j2BFWHLgtVPNcE296sNTtrbowm4XDoMa3ut2W/ZZ8bZp6p+SMpe+d QnDCGx/FNrO01miYa83XMnDENexGZ5/HpWyef3SbNTUmJZmCKZPd9bknCnCevBvf /gWFTZJeunootlPaF7+Bk28xAta5pyRdh38ZeBdS6TC/t61900w= =a8cz -----END PGP SIGNATURE----- --Sig_/pvxNL/3KgmUSEthlP=n1o.v--