Skip to contentSkip to conversation

Building in Solaris 11.4

DISCUSSION Michele Denber 3 participants 8 messages Jun 24, 2020 – Jun 30, 2020 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

While trying to run configure in Solaris 11.4, I quickly run into:

root@hemlock:~/qemu-5.0.0# ./configure
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
./configure[62]: local: not found [No such file or directory]
grep: illegal option -- e
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
./configure[62]: local: not found [No such file or directory]

ERROR: "cc" either does not exist or does not work

root@hemlock:~/qemu-5.0.0# gcc --version
gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root@hemlock:~/qemu-5.0.0#

Line 62 is

    local compiler="$1"

I'm not familiar with this construct. What does "local" do? It wasn't in the configure file for QEMU 2.12. (And I already said "cc=gcc")

- Michele

#1 lore raw
Quoted 8 lines · Michele Denber

While trying to run configure in Solaris 11.4, I quickly run into:

root@hemlock:~/qemu-5.0.0# ./configure
./configure[62]: local: not found [No such file or directory]

grep: illegal option -- e
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . . ./configure[62]: local: not found [No such file or directory]

You've uncovered multiple portability issues, where even though configure expects to run with #!/bin/sh, it uses some non-POSIX-isms.

Quoted 6 lines

Line 62 is

    local compiler="$1"

I'm not familiar with this construct.  What does "local" do?  It wasn't in the configure file for QEMU 2.12.  (And I already said "cc=gcc")

local is a bash-ism (ksh has it to) that changes how variables are scoped within shell functions. The options to fix it are to either: avoid local and use global variables everywhere (and worrying about naming collisions when one function calls another), or to tweak configure so that it re-exec's itself under bash if it detects that /bin/sh is not up to our usage expectations. (configure scripts generated by Autoconf do the latter, but qemu doesn't use autoconf).

grep -e is also a non-portable construct; it might be possible to change that line to call egrep instead, or to rewrite the regex to not need extended regex.

As a short-term workaround, you can always do:

/path/to/bash ./configure

to run it under a shell that won't choke on our use of non-posix constructs.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#2 lore raw
Quoted 8 lines · Eric Blake

grep -e is also a non-portable construct; it might be possible to change that line to call egrep instead, or to rewrite the regex to not need extended regex.

As a short-term workaround, you can always do:

/path/to/bash ./configure

to run it under a shell that won't choke on our use of non-posix constructs.

that will avoid the problems with local, but not necessarily the problem with a missing 'grep -e'. A common approach there is to set $GREP up front to something capable, but then you have to scrub for uses of grep in configure to be replaced with $GREP.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#4 lore raw
In reply to a message not in the archive

Subject: Re: Building in Solaris 11.4
Date: Wed, 24 Jun 2020 16:48:51 -0500
From: Eric Blake <[email protected]>
Organization: Red Hat, Inc.
To: Michele Denber <[email protected]>, [email protected]

Quoted 4 lines

As a short-term workaround, you can always do:

/path/to/bash ./configure

Ah yes, thank you. I now recall having that problem building 2.12 in Solaris 10 a few years ago. The default bash in Solaris 11.4 is /usr/bin/bash and that won't work. I used /opt/csw/bin/bash instead and that took care of the "local" problem.

Similarly, the default Solaris grep is missing the -e option so I changed grep to ggrep in configure. POSIX was always problematic in Solaris because, I believe of Sun's efforts to maintain backward compatibility.

So now I've got:

root@hemlock:~/qemu-5.0.0# /opt/csw/bin/bash ./configure --cc=gcc

ERROR: sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T.
You probably need to set PKG_CONFIG_LIBDIR to point to the right pkg-config files for your build target
root@hemlock:~/qemu-5.0.0#

I fixed that by saying

# LD_LIBRARY_PATH =/usr/openwin/lib:opt/csw/lib:/usr/local/lib:/lib:/opt/sfw/lib:/opt/csw/gxx/lib:/usr/X11/lib # PKG_CONFIG_PATH=/opt/csw/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/sfw/lib/pkgconfig:/usr/lib/pkgconfig # PKG_CONFIG_LIBDIR=/opt/csw/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/sfw/lib/pkgconfig:/usr/lib/pkgconfig

# /opt/csw/bin/bash ./configure --cc=gcc  --extra-cflags="-m32"

(Thankfully I still have some notes from building QEMU 2.12.)

That gave me a successful configure ending with:

The QEMU project intends to remove support for this host OS in a future release if nobody volunteers to maintain it and to provide a build host for our continuous integration setup. configure has succeeded and you can continue to build, but if you care about QEMU on this platform you should contact us upstream at [email protected].

So I hereby volunteer. I have an 8 core 64 thread 2.85 GHz. Sun T4-1 with 64 GB and three 900 GB disks and a 500 MB/50 MB fiber Internet connection..

Anyway, that's enough for one day. On to the gmake. I'm sure I'll have more questions soon :-)

- Michele

#5 lore raw
In reply to Michele Denber

Well the make ran for a while and then stopped here:

root@hemlock:~/qemu-5.0.0# gmake -j16
...
  CC      util/bitops.o
util/qemu-openpty.c:56:12: error: static declaration of
\u2018openpty\u2019 follows non-static declaration
 static int openpty(int *amaster, int *aslave, char *name,
            ^~~~~~~
In file included from /usr/include/termios.h:8:0,
                 from util/qemu-openpty.c:48:
/usr/include/sys/termios.h:538:12: note: previous declaration of
\u2018openpty\u2019 was here
 extern int openpty(int *, int *, char *, struct termios *, struct
winsize *);
            ^~~~~~~
gmake: *** [/export/home/denber/qemu-5.0.0/rules.mak:69:
util/qemu-openpty.o] Error 1

Interestingly, I ran across this openpty issue last year while building QEMU 2.12 in Solaris 10, here: https://bugs.launchpad.net/qemu/+bug/1777252

It looks like the change to fix that issue (missing openpty in Solaris) is having some trouble. I'm not a good enough C programmer to figure it out. Remove the openpty declaration from util/openpty.c perhaps?

- Michele

#6 lore raw
Quoted 17 lines · Michele Denber

Well the make ran for a while and then stopped here:

root@hemlock:~/qemu-5.0.0# gmake -j16
...
   CC      util/bitops.o
util/qemu-openpty.c:56:12: error: static declaration of \u2018openpty\u2019 follows non-static declaration
  static int openpty(int *amaster, int *aslave, char *name,
             ^~~~~~~
In file included from /usr/include/termios.h:8:0,
                  from util/qemu-openpty.c:48:
/usr/include/sys/termios.h:538:12: note: previous declaration of \u2018openpty\u2019 was here
  extern int openpty(int *, int *, char *, struct termios *, struct 
winsize *);
             ^~~~~~~
gmake: *** [/export/home/denber/qemu-5.0.0/rules.mak:69: util/qemu-openpty.o] Error 1
Quoted 3 lines

Interestingly, I ran across this openpty issue last year while building QEMU 2.12 in Solaris 10, here: https://bugs.launchpad.net/qemu/+bug/1777252

It looks like the change to fix that issue (missing openpty in Solaris) is having some trouble.  I'm not a good enough C programmer to figure it out.  Remove the openpty declaration from util/openpty.c perhaps?

It's not the same bug as last year, but a new one: Seems like newer versions of Solaris now have this functions in their libraries! So what you want is something like this (completely untested):

configure +8 -1
@@ -5159,10 +5159,14 @@ extern int openpty(int *am, int *as, char *name, void *termp, void *winp);
 int main(void) { return openpty(0, 0, 0, 0, 0); }
 EOF
 
-if ! compile_prog "" "" ; then
+have_openpty="no"
+if compile_prog "" "" ; then
+  have_openpty="yes"
+else
   if compile_prog "" "-lutil" ; then
     libs_softmmu="-lutil $libs_softmmu"
     libs_tools="-lutil $libs_tools"
+    have_openpty="yes"
   fi
 fi
 
@@ -7407,6 +7411,9 @@ fi
 if test "$have_broken_size_max" = "yes" ; then
     echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
 fi
+if test "$have_openpty" = "yes" ; then
+    echo "HAVE_OPENPTY=y" >> $config_host_mak
+fi
 
 # Work around a system header bug with some kernel/XFS header
 # versions where they both try to define 'struct fsxattr':
util/qemu-openpty.c +3 -1
@@ -52,7 +52,8 @@
 #endif
 
 #ifdef __sun__
-/* Once Solaris has openpty(), this is going to be removed. */
+
+#if !defined(HAVE_OPENPTY)
 static int openpty(int *amaster, int *aslave, char *name,
                    struct termios *termp, struct winsize *winp)
 {
@@ -93,6 +94,7 @@ err:
         close(mfd);
         return -1;
 }
+#endif
 
 static void cfmakeraw (struct termios *termios_p)
 {

HTH,
Thomas

#7 lore raw
Quoted 3 lines · Thomas Huth

...
It's not the same bug as last year, but a new one: Seems like newer versions of Solaris now have this functions in their libraries!

Yes - I just checked. Solaris 10 does not have openpty, but Solaris 11.4 indeed does have it

Quoted 1 line

So what you want is something like this (completely untested):

So just to make sure I have this right - I save that code into a patch file and then apply it where? At the qemu-5.0.0 level? Then run configure again?

Right now I'm looking at that "struct dirent" problem in gmake I mentioned a few days ago. I will try the Haiku patch offered by PMM.

- MIchele

#8 lore raw
Quoted 7 lines · Michele Denber
Quoted 2 lines · Thomas Huth

...
It's not the same bug as last year, but a new one: Seems like newer versions of Solaris now have this functions in their libraries!

Yes - I just checked. Solaris 10 does not have openpty, but Solaris 11.4 indeed does have it

Quoted 1 line

So what you want is something like this (completely untested):

So just to make sure I have this right - I save that code into a patch file and then apply it where?  At the qemu-5.0.0 level?

Yes. I used the current git master branch, but I assume that it will also still apply to the 5.0 release.

Quoted 1 line

  Then run configure again?

Yes. Please let me know if it works, then I can try to get the patch submitted.

HTH,
Thomas