From: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
To: help-guix@gnu.org, Julien Lepiller <julien@lepiller.eu>
Subject: Android.mk build system limitations
Date: Wed, 6 Jul 2022 17:20:27 +0200 [thread overview]
Message-ID: <20220706172027.22fdd325@primarylaptop.localdomain> (raw)
[-- Attachment #1: Type: text/plain, Size: 4346 bytes --]
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 :=" in the Android.mk).
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=" 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=" 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
> Usage:
> /gnu/store/[...]-libsamsung-ipc-gcc-android-0.0-HEAD.c4d664a/bin/https-send-sms
> free-mobile <username> <token> <message>
>
> Example:
> /gnu/store/[...]-libsamsung-ipc-gcc-android-0.0-HEAD.c4d664a/bin/https-send-sms
> free-mobile "12345678" "1234abcdEFGH" "hello world!"
> $ /gnu/store/[...]-libsamsung-ipc-gcc-android-0.0-HEAD.c4d664a/bin/ipc-test
But the same source code was also used to build ipc-test
> Usage: /gnu/store/[...]-libsamsung-ipc-gcc-android-0.0-HEAD.c4d664a/bin/ipc-test free-mobile <username> <token> <message>
>
> Example:
> /gnu/store/[...]-libsamsung-ipc-gcc-android-0.0-HEAD.c4d664a/bin/ipc-test 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/plain/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_libsamsung-ipc/plain/scripts/guix.scm?h=c4d664ae71eb65415d799ada8018cfa49f6fb7fb
Denis.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next reply other threads:[~2022-07-06 15:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-06 15:20 Denis 'GNUtoo' Carikli [this message]
2022-07-09 12:57 ` Android.mk build system limitations Denis 'GNUtoo' Carikli
2022-07-09 19:17 ` Denis 'GNUtoo' Carikli
2022-07-11 7:22 ` Denis 'GNUtoo' Carikli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220706172027.22fdd325@primarylaptop.localdomain \
--to=gnutoo@cyberdimension.org \
--cc=help-guix@gnu.org \
--cc=julien@lepiller.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
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.