Re: [systemd-devel] Revert "meson: use the host architecture compiler/linker for src/boot/efi" #10217

2018-09-30 Thread Helmut Grohne
Hi,

> This reverts commit df7caca.

If you reverts df7caca, please also revert b710072 as that breaks cross
builds.

> The patch df7caca breaks normal build. Let's revert this, as I do not want to 
> revert this every time when setting up a new build directory to test some 
> branch.

No, it doesn't. It only breaks the normal build if you supply a cc that
consists of multiple words (such as "ccache gcc"). As a workaround, you
can simply prepend /usr/lib/ccache to $PATH on most distributions.

Worse, without df7caca, the build wasn't using the compiler you asked
for. It was using plain "gcc". Reverting just gets you a build failure
in the best case and a miscompilation in the worst. You must also revert
b710072 to get a sane build.

> @helmutg If you can fix the issue soon, then I will close this. But if you 
> have not enough time to fix the issue, then I think it is reasonable to 
> revert the commit.

I filed this build failure almost two months ago, see
https://bugs.debian.org/905381. And the meson maintainer had me wait
since April (close to when the breaking commit was introduced) to add
the relevant tools to the cross file generator (see
https://bugs.debian.org/895636). If a reported build problem with
systemd can remain unfixed for almost half a year, then surely there is
not the slightest need to rush this. Please hold off.

Now getting to the actual failure: efi_cc gets used in two distinct
ways. It gets interpolated into strings that are passed to the shell,
which performs word splitting and that's all fine (e.g. line 60). It is
also used to construct an argument vector for a custom_target command
(https://github.com/systemd/systemd/blob/df7cacae696/src/boot/efi/meson.build#L152)
and run_command
(https://github.com/systemd/systemd/blob/df7cacae696/src/boot/efi/meson.build#L163).

So the proper fix involves changing these two lines to split efi_cc at
spaces before interpolating it into the argument vectors.

That should be doable with efi_cc.split(' ') and array concatentation
seems to be +.

So line 152 should likely become

command : efi_cc.split(' ') + ['-c', '@INPUT@', '-o', '@OUTPUT@']

For line 163, this is not as easy as run_command does not expect an
array. We can use the same workaround as in line 61 though and run it
through a shell.

libgcc_file_name = run_command('sh', '-c' , '@0@ 
-print-libgcc-file-name'.format(efi_cc)).stdout().strip()

Could you check whether that solves your issue?

Helmut
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH v2] meson: use the host architecture compiler/linker for src/boot/efi

2018-09-27 Thread Helmut Grohne
cross building systemd to arm64 presently fails, because the build
system uses plain gcc and plain ld (build architecture compiler and
linker respectively) for building src/boot/efi. These values come from
the efi-cc and efi-ld options respectively. It rather should be using
host tools here.

Fixes: b710072da441 ("add support for building efi modules")
---
 meson_options.txt| 4 ++--
 src/boot/efi/meson.build | 6 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

Changes since v1 at https://github.com/systemd/systemd/pull/10177:
 * Change canary values to empty strings.
 * Simplify code by assigning variables twice.

diff --git a/meson_options.txt b/meson_options.txt
index 7b1f61bf4..92e8fadcc 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -278,9 +278,9 @@ option('dbus', type : 'combo', choices : ['auto', 'true', 
'false'],
 
 option('gnu-efi', type : 'combo', choices : ['auto', 'true', 'false'],
description : 'gnu-efi support for sd-boot')
-option('efi-cc', type : 'string', value : 'gcc',
+option('efi-cc', type : 'string',
description : 'the compiler to use for EFI modules')
-option('efi-ld', type : 'string', value : 'ld',
+option('efi-ld', type : 'string',
description : 'the linker to use for EFI modules')
 option('efi-libdir', type : 'string',
description : 'path to the EFI lib directory')
diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
index c5509e73d..39fbf7ec1 100644
--- a/src/boot/efi/meson.build
+++ b/src/boot/efi/meson.build
@@ -34,7 +34,13 @@ stub_sources = '''
 
 if conf.get('ENABLE_EFI') == 1 and get_option('gnu-efi') != 'false'
 efi_cc = get_option('efi-cc')
+if efi_cc == ''
+efi_cc = ' '.join(cc.cmd_array())
+endif
 efi_ld = get_option('efi-ld')
+if efi_ld == ''
+efi_ld = find_program('ld', required: true)
+endif
 efi_incdir = get_option('efi-includedir')
 
 gnu_efi_path_arch = ''
-- 
2.19.0

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] add LIB_ARCH_TUPLE for tilegx-linux-gnu

2017-02-27 Thread Helmut Grohne
The following changes since commit 3c3fff44b2c46818bc240e3237925ad927b2831e:

  man: fix typo (#5468) (2017-02-27 13:59:11 +0100)

are available in the git repository at:

  git://git.subdivi.de/~helmut/systemd.git tilegx

for you to fetch changes up to c05c6e9cedf20b64b22249f88af514a70b6edd4b:

  add LIB_ARCH_TUPLE for tilegx-linux-gnu (2017-02-27 16:21:06 +0100)

This commit fixes a build failure on the tilegx architecture. A
downstream bug report is located at https://bugs.debian.org/856306.


Helmut Grohne (1):
  add LIB_ARCH_TUPLE for tilegx-linux-gnu

 src/basic/architecture.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/basic/architecture.h b/src/basic/architecture.h
index d6b8603b0..b0a7de5dc 100644
--- a/src/basic/architecture.h
+++ b/src/basic/architecture.h
@@ -187,7 +187,7 @@ int uname_architecture(void);
 #  define LIB_ARCH_TUPLE "m68k-linux-gnu"
 #elif defined(__tilegx__)
 #  define native_architecture() ARCHITECTURE_TILEGX
-#  error "Missing LIB_ARCH_TUPLE for TILEGX"
+#  define LIB_ARCH_TUPLE "tilegx-linux-gnu"
 #elif defined(__cris__)
 #  define native_architecture() ARCHITECTURE_CRIS
 #  error "Missing LIB_ARCH_TUPLE for CRIS"
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] basic: fix build on architectures with small long

2015-11-21 Thread Helmut Grohne
I was asked to use NULL instead of 0 and to send a pull request. So see
my git-pull-request below. Please do Cc me in your replies rather than
relaying them e.g. via IRC.

Helmut

The following changes since commit bb54817f3bbe9043326b72a848384491314d428d:

  Merge pull request #1947 from phomes/sort-includes2 (2015-11-19 23:32:30 
+0100)

are available in the git repository at:

  git://git.subdivi.de/~helmut/systemd.git fix-build-failure

for you to fetch changes up to 16134b6977dc5b63c12eabe665bc5eb66e741265:

  basic: fix build on architectures with small long (2015-11-22 08:22:22 +0100)


Helmut Grohne (1):
  basic: fix build on architectures with small long

 src/basic/stat-util.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h
index 909b220..fb92464 100644
--- a/src/basic/stat-util.h
+++ b/src/basic/stat-util.h
@@ -52,9 +52,8 @@ int path_is_os_tree(const char *path);
 int files_same(const char *filea, const char *fileb);
 
 /* The .f_type field of struct statfs is really weird defined on
- * different archs. Let's use our own type we know is sufficiently
- * larger to store the possible values. */
-typedef long statfs_f_type_t;
+ * different archs. Let's give its type a name. */
+typedef typeof(((struct statfs*)NULL)->f_type) statfs_f_type_t;
 
 bool is_fs_type(const struct statfs *s, statfs_f_type_t magic_value) _pure_;
 int fd_check_fstype(int fd, statfs_f_type_t magic_value);
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] basic: fix build on architectures with small long

2015-11-20 Thread Helmut Grohne
The assertion

assert_cc(sizeof(statfs_f_type_t) >= sizeof(s->f_type));

can trigger on architectures where long is smaller than struct statfs'
f_type member. This includes x32. Thus fix the typedef statfs_f_type_t.
---
 src/basic/stat-util.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Please Cc me in replies.

Helmut

diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h
index 909b220..dad4b74 100644
--- a/src/basic/stat-util.h
+++ b/src/basic/stat-util.h
@@ -52,9 +52,8 @@ int path_is_os_tree(const char *path);
 int files_same(const char *filea, const char *fileb);
 
 /* The .f_type field of struct statfs is really weird defined on
- * different archs. Let's use our own type we know is sufficiently
- * larger to store the possible values. */
-typedef long statfs_f_type_t;
+ * different archs. Let's give its type a name. */
+typedef typeof(((struct statfs*)0)->f_type) statfs_f_type_t;
 
 bool is_fs_type(const struct statfs *s, statfs_f_type_t magic_value) _pure_;
 int fd_check_fstype(int fd, statfs_f_type_t magic_value);
-- 
2.6.2

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel