This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug lto/39276] [lto] - Testsuite gcc.log shows many "getconf: Invalid argument (_NPROCESSORS_ONLN)"



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]