Building in Solaris 11.4
Well I removed the "static" from the line
static int openpty(int *amaster, int *aslave, char *name,
struct termios *termp, struct winsize *winp)
in util/qemu-openpty.c. I odn't know if that was the right thing to do but it did allow it to compile. Now I'm stopped here:
...
CC monitor/trace.outil/drm.c: In function 'qemu_drm_rendernode_open':util/drm.c:41:16: error: 'struct dirent' has no member named 'd_type'; did you mean 'd_name'?
if (e->d_type != DT_CHR) {
^~~~~~
d_name
util/drm.c:41:26: error: 'DT_CHR' undeclared (first use in this function); did you mean 'TH_CWR'?
if (e->d_type != DT_CHR) {
^~~~~~
TH_CWRutil/drm.c:41:26: note: each undeclared identifier is reported only once for each function it appears in
gmake: *** [/export/home/denber/qemu-5.0.0/rules.mak:69: util/drm.o] Error 1
This looks like more "not in Solaris" POSIX stuff. See
https://stackoverflow.com/questions/35215109/struct-dirent-does-not-have-de-type-in-header-file
"The only fields in the dirent structure that are mandated by POSIX.1 are: d_name[], of unspecified size, with at most NAME_MAX characters preceding the terminating null byte; and (as an XSI extension) d_ino. /The other fields are unstandardized, and not present on all systems/; see NOTES below for some further details.
then continues
Only the fields d_name and d_ino are specified in POSIX.1-2001. The remaining fields are available on many, but not all systems. Under glibc, programs can check for the availability of the fields not defined in POSIX.1 by testing whether the macros _DIRENT_HAVE_D_NAMLEN, _DIRENT_HAVE_D_RECLEN, _DIRENT_HAVE_D_OFF, or _DIRENT_HAVE_D_TYPE are defined.
*Other than Linux, the d_type field is available mainly only on BSD systems.* This field makes it possible to avoid the expense of calling lstat(2) if further actions depend on the type of the file. If the _BSD_SOURCE feature test macro is defined, then glibc defines the following macro constants for the value returned in d_type:"
But I'm not sure what to make of this.
- Michele
Quoted 7 lines · Michele Denber
Well I removed the "static" from the line
static int openpty(int *amaster, int *aslave, char *name,
struct termios *termp, struct winsize *winp)in
util/qemu-openpty.c. I odn't know if that was the right thing to do but it did allow it to compile.
No, that doesn't sound right. The code in qemu-openpty.c for Solaris assumes that solaris does not provide openpty(), and so it provides its own implementation. This is a very old bit of portability-workaround. It sounds like at least some Solaris versions do provide a system openpty() in termios.h (in libc, or perhaps needing an extra -lsomething?), in which case we want to detect that and use it (not compiling the QEMU code for solaris-without-openpty).
The first thing to do here would be to find out which versions of Solaris provide openpty(), and which header and library need to be used to compile code that uses it. The gnulib docs think it is missing on Solaris 11.3:
do we care about supporting that as a host OS?
https://www.gnu.org/software/gnulib/manual/html_node/openpty.html
Then you'd need to improve configure so that it looked for "does the system provide openpty() via termios.h" and defined CONFIG_OPENPTY_IN_TERMIOS to indicate that; then if that is set we qemu-openpty.c can make solaris use the "system has openpty()" codepath rather than "system doesn't have that". If it turns out that all Solaris versions new enough that we might care about them do have openpty() we could also delete the handling code for systems that don't.
Quoted 10 lines
CC
monitor/trace.outil/drm.c: In function 'qemu_drm_rendernode_open':util/drm.c:41:16: error: 'struct dirent' has no member named 'd_type'; did you mean 'd_name'?if (e->d_type != DT_CHR) { ^~~~~~ d_name util/drm.c:41:26: error: 'DT_CHR' undeclared (first use in this function); did you mean 'TH_CWR'? if (e->d_type != DT_CHR) { ^~~~~~ TH_CWR
Quoted 4 lines
util/drm.c:41:26: note: each undeclared identifier is reported only once for each function it appears in
gmake: *** [/export/home/denber/qemu-5.0.0/rules.mak:69:util/drm.o] Error 1This looks like more "not in Solaris" POSIX stuff.
Ah, the Haiku folks just ran into exactly this issue. Their fix should also be good for Solaris:
https://lists.gnu.org/archive/html/qemu-devel/2020-06/msg08800.html
(This whole file is for using a Linux-specific feature so there's no point even compiling it for other OSes.)
thanks
-- PMM
Quoted 21 lines · Peter Maydell
Quoted 7 lines · Michele Denber
Well I removed the "static" from the line
static int openpty(int *amaster, int *aslave, char *name,
struct termios *termp, struct winsize *winp)in
util/qemu-openpty.c. I odn't know if that was the right thing to dobut it did allow it to compile.
No, that doesn't sound right. The code in
qemu-openpty.cfor Solaris assumes that solaris does not provideopenpty(), and so it provides its own implementation. This is a very old bit of portability-workaround. It sounds like at least some Solaris versions do provide a systemopenpty()intermios.h(in libc, or perhaps needing an extra -lsomething?), in which case we want to detect that and use it (not compiling the QEMU code for solaris-without-openpty).
Quoted 7 lines
The first thing to do here would be to find out which versions of Solaris provide
openpty(), and which header and library need to be used to compile code that uses it. The gnulib docs think it is missing on Solaris 11.3:
do we care about supporting that as a host OS?
https://www.gnu.org/software/gnulib/manual/html_node/openpty.html
I think you need to support older versions that don't ship openpty(), as 11.4 dropped support for a lot of older hardware so people with existing (older but working) hardware won't be able to upgrade to it.
Also, illumos doesn't (yet) have openpty.
Quoted 38 lines
Then you'd need to improve configure so that it looked for "does the system provide
openpty()viatermios.h" and definedCONFIG_OPENPTY_IN_TERMIOSto indicate that; then if that is set weqemu-openpty.ccan make solaris use the "system hasopenpty()" codepath rather than "system doesn't have that". If it turns out that all Solaris versions new enough that we might care about them do haveopenpty()we could also delete the handling code for systems that don't.Quoted 3 lines
CC
monitor/trace.outil/drm.c: In function 'qemu_drm_rendernode_open':util/drm.c:41:16: error: 'struct dirent' has no member named 'd_type';did you mean '
d_name'?Quoted 4 lines
if (e->d_type != DT_CHR) { ^~~~~~ d_name
util/drm.c:41:26: error: 'DT_CHR' undeclared (first use in thisfunction); did you mean '
TH_CWR'?Quoted 4 lines
if (e->d_type != DT_CHR) { ^~~~~~ TH_CWR
util/drm.c:41:26: note: each undeclared identifier is reported only oncefor each function it appears in
Quoted 1 line
gmake: *** [/export/home/denber/qemu-5.0.0/rules.mak:69:
util/drm.o]Error 1
Quoted 2 lines
This looks like more "not in Solaris" POSIX stuff.
Ah, the Haiku folks just ran into exactly this issue. Their fix should also be good for Solaris:
https://lists.gnu.org/archive/html/qemu-devel/2020-06/msg08800.html
(This whole file is for using a Linux-specific feature so there's no point even compiling it for other OSes.)thanks
-- PMM
Signature · 2 lines
-Peter Tribble http://www.petertribble.co.uk/ - http://ptribble.blogspot.com/