Bug 53265 - systemd-187 fails at multi-arch and cross-compile
Summary: systemd-187 fails at multi-arch and cross-compile
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-08 18:51 UTC by Peter Alfredsen
Modified: 2012-08-09 00:42 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
fix incorrect autotools usage (1.32 KB, patch)
2012-08-08 18:51 UTC, Peter Alfredsen
Details | Splinter Review

Description Peter Alfredsen 2012-08-08 18:51:21 UTC
Created attachment 65308 [details] [review]
fix incorrect autotools usage

The new hackery to extract syscalls from syscall.h just calls plain cpp and doesn't use CFLAGS even though CPP expands to "gcc -E" on all post-2000 linux platforms. This causes multi-arch (CFLAGS=-m32) and cross-compile builds of systemd to fail because the same syscalls aren't available everywhere.

Example with CFLAGS=-m32
[...]
  GEN    src/core/load-fragment-gperf.c
  GEN    src/core/load-fragment-gperf-nulstr.c
  CC     src/udev/libudev_core_la-udev-event.lo
  CC     src/udev/libudev_core_la-udev-watch.lo
  CC     src/udev/libudev_core_la-udev-node.lo
  CC     src/udev/libudev_core_la-udev-rules.lo
In file included from src/core/syscall-list.c:31:0:
src/core/syscall-to-name.h:6:2: error: ‘__NR_connect’ undeclared here (not in a function)
src/core/syscall-to-name.h:6:1: error: array index in initializer not of integer type
src/core/syscall-to-name.h:6:1: error: (near initialization for ‘syscall_names’)
src/core/syscall-to-name.h:21:2: error: ‘__NR_semop’ undeclared here (not in a function)
src/core/syscall-to-name.h:21:1: error: array index in initializer not of integer type
src/core/syscall-to-name.h:21:1: error: (near initialization for ‘syscall_names’)
src/core/syscall-to-name.h:23:2: error: ‘__NR_epoll_ctl_old’ undeclared here (not in a function)
src/core/syscall-to-name.h:23:1: error: array index in initializer not of integer type
src/core/syscall-to-name.h:23:1: error: (near initialization for ‘syscall_names’)
src/core/syscall-to-name.h:25:2: error: ‘__NR_shmat’ undeclared here (not in a function)
src/core/syscall-to-name.h:25:1: error: array index in initializer not of integer type
src/core/syscall-to-name.h:25:1: error: (near initialization for ‘syscall_names’)
src/core/syscall-to-name.h:30:2: error: ‘__NR_shmdt’ undeclared here (not in a function)
src/core/syscall-to-name.h:30:1: error: array index in initializer not of integer type
src/core/syscall-to-name.h:30:1: error: (near initialization for ‘syscall_names’)
src/core/syscall-to-name.h:52:2: error: ‘__NR_semctl’ undeclared here (not in a function)
src/core/syscall-to-name.h:52:1: error: array index in initializer not of integer type
src/core/syscall-to-name.h:52:1: error: (near initialization for ‘syscall_names’)
[...]

The attached patch fixes up all calls to CPP.

It assumes that CPP expands to "gcc -E" or something that accepts CFLAGS as parameters, but that's the case already with DBUS_PREPROCESS. It could be worked around in configure.ac if ever (god forbid) there was a linux system where CPP expands to plain cpp, but that's probably an academic exercise given the target group of systemd.

It looks to me like the problem was introduced because the person who introduced this feature saw that "cpp $BLA $FOO < /dev/null > foo.txt" worked and "$(CPP) $BLA $FOO < /dev/null > foo.txt" didn't. That's because gcc needs a dash before  < /dev/null to accept input on stdin.
Comment 1 Kay Sievers 2012-08-08 19:16:56 UTC
Better always work against the git tree, not the released version; this seems
to be fixed already:

http://cgit.freedesktop.org/systemd/systemd/commit/?id=b5dd874ddad5857a6bb418e6a1cdf318e71ca69c
Comment 2 Peter Alfredsen 2012-08-08 19:20:16 UTC
(In reply to comment #1)
> Better always work against the git tree, not the released version; this seems
> to be fixed already:
> 
> http://cgit.freedesktop.org/systemd/systemd/commit/?id=b5dd874ddad5857a6bb418e6a1cdf318e71ca69c

Aitch!
You still need to add CFLAGS, because CFLAGS changes the defines (WORDSIZE and __I386). CFLAGS=-m32 is not fixed by that patch.
Comment 4 Peter Alfredsen 2012-08-09 00:42:21 UTC
Checks out. Thanks a lot.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.