public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ro at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/39276] [lto] - Testsuite gcc.log shows many "getconf: Invalid argument (_NPROCESSORS_ONLN)"
Date: Thu, 09 Jul 2009 20:50:00 -0000	[thread overview]
Message-ID: <20090709205028.9285.qmail@sourceware.org> (raw)
In-Reply-To: <bug-39276-13830@http.gcc.gnu.org/bugzilla/>



------- Comment #7 from ro at gcc dot gnu dot org  2009-07-09 20:50 -------
Your patch isn't applicable to anything but Indiana (the distribution called
OpenSolaris):

* Solaris /bin/sh doesn't support $(), one needs to use `` instead (which can
  easily be done).

* Likewise, Solaris /bin/sh doesn't support $[], one needs to use expr here.

The following trivial patch does this, but still needs a general solution for
the
getconf issue:

--- /vol/gcc/src/gcc-lto/gcc/lto/ltrans-driver  Wed Jan 28 18:18:14 2009
+++ gcc/ltrans-driver   Thu Jul  9 22:30:24 2009
@@ -94,10 +94,10 @@
 getconf=/usr/bin/getconf
 par=1
 if [ $verbose -ne 1 -a -x $awk -a -x $uptime -a -x $getconf ] ; then
-  loadavg=$($uptime | $awk '{ l = $(NF - 2); print int (strtonum (l)); }')
-  nprocs=$($getconf _NPROCESSORS_ONLN)
+  loadavg=`$uptime | $awk '{ l = $(NF - 2); print int (strtonum (l)); }'`
+  nprocs=`$getconf _NPROCESSORS_ONLN`
   if [ $loadavg -lt $nprocs ] ; then
-    par=$[($nprocs - $loadavg) * 2]
+    par=expr \( $nprocs - $loadavg \) \* 2
   fi
 fi
 ${MAKE-make} -s -f $makefile -j $par all

JDS (Suns port of GNOME) e.g. has this in its .spec files:

%ifos linux
if [ -x /usr/bin/getconf ]; then
  CPUS=`getconf _NPROCESSORS_ONLN`
fi
%else
  CPUS=`/usr/sbin/psrinfo | grep on-line | wc -l | tr -d ''`
%endif
if test "x$CPUS" = "x" -o $CPUS = 0; then
  CPUS=1
fi

(from
http://markmail.org/message/bbjajsxhpfon2rn2?q=getconf+solaris+_NPROCESSORS_ONLN&page=1&refer=xt45zeazcrhna7hf)

Your ksh93 based solution cannot be used because /bin/ksh93 was only introduced
in some later builds of Solaris Express/OpenSolaris.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39276


  parent reply	other threads:[~2009-07-09 20:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-23 16:13 [Bug c/39276] New: " rob1weld at aol dot com
2009-02-23 16:48 ` [Bug c/39276] " rob1weld at aol dot com
2009-02-23 17:05 ` rob1weld at aol dot com
2009-02-23 17:29 ` [Bug driver/39276] " pinskia at gcc dot gnu dot org
2009-02-23 17:33 ` dnovillo at google dot com
2009-02-24 16:54 ` [Bug c/39276] " rob1weld at aol dot com
2009-07-09  0:11 ` [Bug lto/39276] " bje at gcc dot gnu dot org
2009-07-09 20:50 ` ro at gcc dot gnu dot org [this message]
2009-09-16 13:39 ` rguenth at gcc dot gnu dot org
2009-09-17  9:08 ` rguenth at gcc dot gnu dot org
2009-09-22 11:28 ` rguenth at gcc dot gnu dot org
2009-09-22 11:30 ` rguenth at gcc dot gnu dot org
2009-09-25 23:58 ` rob1weld at aol dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090709205028.9285.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).