[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] build system limitations

From: Denis 'GNUtoo' Carikli
Subject: build system limitations
Date: Wed, 6 Jul 2022 17:20:27 +0200


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 to find
potential issues.

There are several limitations with the 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* ""
>              #t)))

However I found an issue that is more problematic: this build system
expects an with a single target (which is defined
with "LOCAL_MODULE :=" in the 

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 file, so I now really want to build the utilities too in
that guix.scm with the 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* ""
>       ((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 files under GNU/Linux.

I'm writing that mail in the hope that people who knows better the
implementation of the build system in Guix would have
pointers to help me solve that issue.

[2]from android-safe-iop from gnu/packages/android.scm in Guix


Attachment: pgpcDvCvTLjJh.pgp
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]