Opened 7 years ago

Closed 7 years ago

#53929 closed defect (fixed)

qemu @ 2.8.0 +curses: configure fails to find ncurses

Reported by: stevecheckoway (Stephen Checkoway) Owned by: raimue (Rainer Müller)
Priority: Normal Milestone:
Component: ports Version: 2.4.1
Keywords: haspatch Cc:
Port: qemu

Description

Configuring qemu fails with the +curses variant.

Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_emulators_qemu/qemu/work/qemu-2.8.0" && ./configure --prefix=/opt/local --cpu=x86_64 --cc=/usr/bin/clang --objcc=/usr/bin/clang --host-cc=/usr/bin/clang --python=/opt/local/bin/python2.7 --iasl=/usr/bin/false --disable-cocoa --enable-curses --disable-sdl --disable-gtk --disable-opengl --enable-curl --enable-uuid --enable-vhdx --with-system-pixman --disable-attr --disable-vde --disable-brlapi --disable-bluez --disable-cap-ng --disable-spice --disable-libiscsi --disable-rbd --disable-smartcard --enable-libusb --disable-usb-redir --disable-seccomp --disable-glusterfs --disable-rdma --disable-libssh2 --disable-vnc --target-list=,i386-softmmu,x86_64-softmmu
DEBUG: system:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_emulators_qemu/qemu/work/qemu-2.8.0" && ./configure --prefix=/opt/local --cpu=x86_64 --cc=/usr/bin/clang --objcc=/usr/bin/clang --host-cc=/usr/bin/clang --python=/opt/local/bin/python2.7 --iasl=/usr/bin/false --disable-cocoa --enable-curses --disable-sdl --disable-gtk --disable-opengl --enable-curl --enable-uuid --enable-vhdx --with-system-pixman --disable-attr --disable-vde --disable-brlapi --disable-bluez --disable-cap-ng --disable-spice --disable-libiscsi --disable-rbd --disable-smartcard --enable-libusb --disable-usb-redir --disable-seccomp --disable-glusterfs --disable-rdma --disable-libssh2 --disable-vnc --target-list=,i386-softmmu,x86_64-softmmu
./configure: --enable-uuid is obsolete, UUID support is always built
./configure: --enable-vhdx is obsolete, VHDX driver is always built

ERROR: User requested feature curses
       configure was not able to find it.
       Install ncurses devel

Configuring (and building/installing) works correctly without +curses.

The issue is that qemu wants wide character support but curses.h will only enable wide character support in a limited number of cases:

/*
 * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or
 * conflicting) when _XOPEN_SOURCE is 500 or greater.  If NCURSES_WIDECHAR is
 * not already defined, e.g., if the platform relies upon nonstandard feature
 * test macros, define it at this point if the standard feature test macros
 * indicate that it should be defined.
 */
#ifndef NCURSES_WIDECHAR
#if defined(_XOPEN_SOURCE_EXTENDED) || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500))
#define NCURSES_WIDECHAR 1
#else
#define NCURSES_WIDECHAR 0
#endif
#endif /* NCURSES_WIDECHAR */

Of the options, it seems safer to define NCURSES_WIDECHAR=1 by passing --extra-cflags=-DNCURSES_WIDECHAR=1 to configure for the +curses variant.

With the patch applied, the +curses variant builds and runs correctly (as far as I can tell from minimal testing).

Attachments (1)

Portfile.patch (368 bytes) - added by stevecheckoway (Stephen Checkoway) 7 years ago.

Download all attachments as: .zip

Change History (8)

Changed 7 years ago by stevecheckoway (Stephen Checkoway)

Attachment: Portfile.patch added

comment:1 Changed 7 years ago by stevecheckoway (Stephen Checkoway)

My apologies, I forgot to include my MacPorts version in the ticket: 2.4.1

comment:2 Changed 7 years ago by mf2k (Frank Schima)

Cc: raimue removed
Owner: set to raimue
Status: newassigned
Version: 2.4.1

comment:3 Changed 7 years ago by raimue (Rainer Müller)

Thank you for the detailed report. You are right that ncurses usually expects _XOPEN_SOURCE >= 500 for the wide-char support. Your workaround seems like a good interim solution.

A similar issue originating at Gentoo was submitted to QEMU earlier, which was about building with musl-libc:

comment:4 Changed 7 years ago by stevecheckoway (Stephen Checkoway)

Another possible fix that I thought about was changing the ncursesw.pc Cflags. Currently, they are

Cflags:  -D_DARWIN_C_SOURCE -I${includedir}

but it seems like that may have unintended consequences.

comment:5 in reply to:  4 Changed 7 years ago by raimue (Rainer Müller)

I also thought about adding the flag to the pkg-config file. I am not entirely sure whether there might a valid use case to exclude wide-char support with ncursesw, although I cannot think of any right now. I am also a bit surprised no other port ran into this problem yet. For now I will just implement the original workaround suggested.

comment:6 Changed 7 years ago by raimue (Rainer Müller)

In c8c1ae5881a18a49373ad8f1aed9b2b97e288272/macports-ports:

qemu: Fix +curses due to missing wide-char support

ncurses does not declare the wide-char functions unless enabled by
NCURSES_WIDECHAR=1 or _XOPEN_SOURCE>=500.

See: #53929

comment:7 Changed 7 years ago by raimue (Rainer Müller)

Resolution: fixed
Status: assignedclosed

AS discussed upstream, this is the correct solution and it has also been applied upstream.

Note: See TracTickets for help on using tickets.