Build of v2.1.0 fails on armv7l due to undeclared __NR_select

Bug #1363641 reported by Karl-Philipp Richter on 2014-08-31
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Undecided
Unassigned

Bug Description

After `make clean` and `git clean -x -f -d` `git checkout v2.1.0 && configure --prefix=/home/user/prefix-qemu-2.1.0 && make` fails due to missing declarations

    CC qemu-seccomp.o
    qemu-seccomp.c:28:1: error: '__NR_select' undeclared here (not in a function)
    qemu-seccomp.c:36:1: error: '__NR_mmap' undeclared here (not in a function)
    qemu-seccomp.c:57:1: error: '__NR_getrlimit' undeclared here (not in a function)
    qemu-seccomp.c:96:1: error: '__NR_time' undeclared here (not in a function)
      GEN qmp-marshal.c
    qemu-seccomp.c:186:1: error: '__NR_alarm' undeclared here (not in a function)
    make: *** [qemu-seccomp.o] Error 1

Same errors for master 8b3030114a449e66c68450acaac4b66f26d91416. `configure`should not succeed for a failing build if the error occurs due to missing dependencies, if it's a bug it needs to be fixed. `config.log` for v2.1.0 and 8b303011... attached. The content is mostly compiler output which I think is unusual for `config.log`, but see for yourself.

I'm building on a debian 7.6 chroot on Synology DSM 5.0. `uname -a` says `Linux diskstatation 3.2.40 #4493 SMP Thu Aug 21 21:43:02 CST 2014 armv7l GNU/Linux`.

After installing some of the missing dependencies, i.e. `apt-get install liblzo2-dev libbsd-dev syslinux-common libhwloc-dev librdmacm-dev libsnappy-dev libibverbs-dev valgrind linux-headers-3.2.0-4-common` I'm getting

     CC migration-rdma.o
    migration-rdma.c: In function 'ram_chunk_start':
    migration-rdma.c:523:12: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    migration-rdma.c: In function '__qemu_rdma_add_block':
    migration-rdma.c:556:49: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    migration-rdma.c:557:49: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    migration-rdma.c: In function '__qemu_rdma_delete_block':
    migration-rdma.c:664:45: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    migration-rdma.c:699:49: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    migration-rdma.c: In function 'qemu_rdma_search_ram_block':
    migration-rdma.c:1113:49: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    migration-rdma.c: In function 'qemu_rdma_register_and_get_keys':
    migration-rdma.c:1176:50: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
    migration-rdma.c:1177:29: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
    migration-rdma.c:1177:51: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
    migration-rdma.c:1178:29: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
    migration-rdma.c: In function 'qemu_rdma_post_send_control':
    migration-rdma.c:1562:36: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
    migration-rdma.c: In function 'qemu_rdma_post_recv_control':
    migration-rdma.c:1616:37: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
    migration-rdma.c: In function 'qemu_rdma_write_one':
    migration-rdma.c:1864:16: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
    migration-rdma.c:1868:53: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    migration-rdma.c:1922:52: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    migration-rdma.c:1923:50: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    migration-rdma.c:1977:49: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    migration-rdma.c:1998:49: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    migration-rdma.c:2010:58: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    migration-rdma.c: In function 'qemu_rdma_registration_handle':
    migration-rdma.c:3027:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
    migration-rdma.c:3092:41: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
    cc1: all warnings being treated as errors
    make: *** [migration-rdma.o] Error 1

i.e. earlier errors than before.

description: updated
description: updated

On 31 August 2014 13:06, Karl-Philipp Richter <email address hidden> wrote:.
> `configure`should not succeed for a failing build.

Your compile failures are definitely bugs, but it isn't expected that
configure will detect all possible kinds of build failure
in advance.

For what it's worth I always build on ARM as part of my
checks before merging things to master, so this issue isn't
"all armv7l builds are broken" but something more specific
(probably some optional bits of the build which my build
platform doesn't have the dependencies for.)

> qemu-seccomp.c:186:1: error: '__NR_alarm' undeclared here (not in a function)
> make: *** [qemu-seccomp.o] Error 1

Ccing Eduardo for the seccomp compile issues.

> + After installing some of the missing header files (-> configure should
> + fail at the right point with a good error message), i.e. `apt-get
> + install liblzo2-dev libbsd-dev syslinux-common libhwloc-dev librdmacm-
> + dev libsnappy-dev libibverbs-dev valgrind linux-headers-3.2.0-4-common`
> + I'm getting
> +
> + CC migration-rdma.o
> + migration-rdma.c: In function 'ram_chunk_start':
> + migration-rdma.c:523:12: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

This probably hasn't been tested on a 32 bit build system :-(

I suggest you work around these bugs by passing configure
--disable-rdma --disable-seccomp while we fix things...

thanks
-- PMM

description: updated
Download full text (10.3 KiB)

(cc'ing Michael Hines who owns and knows the RDMA code)

* Karl-Philipp Richter (<email address hidden>) wrote:
> ** Description changed:
>
> After `make clean` and `git clean -x -f -d` `git checkout v2.1.0 &&
> configure --prefix=/home/user/prefix-qemu-2.1.0 && make` fails due to
> missing declarations
>
>     CC qemu-seccomp.o
>     qemu-seccomp.c:28:1: error: '__NR_select' undeclared here (not in a function)
>     qemu-seccomp.c:36:1: error: '__NR_mmap' undeclared here (not in a function)
>     qemu-seccomp.c:57:1: error: '__NR_getrlimit' undeclared here (not in a function)
>     qemu-seccomp.c:96:1: error: '__NR_time' undeclared here (not in a function)
>       GEN qmp-marshal.c
>     qemu-seccomp.c:186:1: error: '__NR_alarm' undeclared here (not in a function)
>     make: *** [qemu-seccomp.o] Error 1
>
> Same errors for master 8b3030114a449e66c68450acaac4b66f26d91416.
> `configure`should not succeed for a failing build. `config.log` for
> v2.1.0 and 8b303011... attached. The content is mostly compiler output
> which I think is unusual for `config.log`, but see for yourself.
>
> I'm building on a debian 7.6 chroot on Synology DSM 5.0. `uname -a` says
> `Linux diskstatation 3.2.40 #4493 SMP Thu Aug 21 21:43:02 CST 2014
> armv7l GNU/Linux`.
> +
> + After installing some of the missing header files (-> configure should
> + fail at the right point with a good error message), i.e. `apt-get
> + install liblzo2-dev libbsd-dev syslinux-common libhwloc-dev librdmacm-
> + dev libsnappy-dev libibverbs-dev valgrind linux-headers-3.2.0-4-common`
> + I'm getting
> +
> + CC migration-rdma.o
> + migration-rdma.c: In function 'ram_chunk_start':
> + migration-rdma.c:523:12: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

is that:
    return (uint8_t *) (((uintptr_t) rdma_ram_block->local_host_addr)
                                    + (i << RDMA_REG_CHUNK_SHIFT));

244: uint8_t *local_host_addr; /* local virtual address */

in which case I think the problem is the 'i' which is a uint64_t.

> + migration-rdma.c: In function '__qemu_rdma_add_block':
> + migration-rdma.c:556:49: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> + migration-rdma.c:557:49: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

> + migration-rdma.c: In function '__qemu_rdma_delete_block':
> + migration-rdma.c:664:45: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> + migration-rdma.c:699:49: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> + migration-rdma.c: In function 'qemu_rdma_search_ram_block':
> + migration-rdma.c:1113:49: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> + migration-rdma.c: In function 'qemu_rdma_register_and_get_keys':
> + migration-rdma.c:1176:50: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> + migration-rdma.c:1177:29: error: cast from pointer to integer of different size [-Werror=pointer-to...

Peter Maydell (pmaydell) wrote :

On 23 September 2014 09:25, Michael R. Hines <email address hidden> wrote:

> I could use some advice from the community on this: In particular, I have
> *zero* 32-bit machine to
> fix this on........ now, I could easily create a 32-bit machine, but I
> simply don't have any RDMA hardware
> for which to run the 32-bit virtual machine against.
>
> So, what are my options? Can I just submit a patch that completely disables
> RDMA in 32-bit environments?

That's probably better than failing to compile. You might want to
at least shake out the compile errors so you can figure out if
your protocol itself has word-size issues or if it's just the
implementation that needs fixing.

I assume there's nothing inherent to RDMA that mandates 64 bit...

-- PMM

Eduardo Otubo (otubo) wrote :

The fix for the syscalls problem is already upstream at libseccomp [0] . The maintainer said he has no plans yet to make a new release, though.

[0] -- http://sourceforge.net/p/libseccomp/mailman/libseccomp-discuss/thread/1661272.9kVko5ssCn%40sifl/#msg32956301

Peter Maydell (pmaydell) wrote :

On 22 October 2014 08:31, Eduardo Otubo <email address hidden> wrote:
> The fix for the syscalls problem is already upstream at libseccomp [0] .
> The maintainer said he has no plans yet to make a new release, though.

Then you're going to have to put a fix of some kind locally
into QEMU. I don't want to release 2.2 with basic compile
errors like this on some hosts. If seccomp only supports
specific architectures you should probably enforce this in
configure.

I couldn't identify from your mailing list link what upstream
is proposing to fix this bug either -- could you point me at
the specific changes that they have in mind?

thanks
-- PMM

Eduardo Otubo (otubo) wrote :

This commit temporarily fixes this problem.

http://git.qemu.org/?p=qemu.git;a=commit;h=4cc47f8b3cc4f32586ba2f7fce1dc267da774a69

As soon as libseccomp makes a new release I'll update the dependency and hopefully it will be fixed with proper library support.

Ben Gelb (ben-gelbnet) wrote :

Hi Eduardo - your above commit doesn't update the version in the error message (a few lines below, still says >= 2.1.0).
Sorry if this isn't the right place to comment on your patch, but it would be nice to fix (just spent a while trying to figure out why having 2.1.0 installed wasn't satisfying the configure check).

Also, I think the way the if statement is constructed it will not properly apply the 2.1.1 version check for i386 (only for x86_64).

Eduardo Otubo (otubo) wrote :

Hello Ben, you're completely right on what regards the version on the error message. I'll fix it as soon as possible. Sorry for the trouble on that :( (and sorry for the late reply I was on vacations)

Regarding the if statement, as Peter said here -- http://lists.gnu.org/archive/html/qemu-devel/2014-11/msg00960.html -- shell evaluates the OR before the AND, so that's Ok.

Thanks.

Eduardo Otubo (otubo) wrote :

Hello Ben, I just submitted a pull request to fix the issue you reported:

http://lists.gnu.org/archive/html/qemu-devel/2014-12/msg03134.html

Thanks again.

Eduardo Otubo (otubo) wrote :

Libseccomp 2.2.0 is now released, can you please try the attached patch and check if it works for you? Regards.

Thomas Huth (th-huth) wrote :
Changed in qemu:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers