# gcc/xgcc -v Using built-in specs. COLLECT_GCC=gcc/xgcc Target: i386-pc-solaris2.11 Configured with: ../lto_trunk/configure --prefix=/usr/local/lto --enable-languages=lto,c++ --enable-shared --disable-static --enable-multilib --with-gnu-as --with-as=/usr/local/bin/as --with-gnu-ld --with-ld=/usr/local/bin/ld --with-gmp=/usr/local --with-mpfr=/usr/local --without-ppl Thread model: posix gcc version 4.4.0 20090218 (experimental) [lto revision 144375] (lto merged with rev 144262) The Testsuite gcc.log shows many "getconf: Invalid argument (_NPROCESSORS_ONLN)" errors. Here is one example: PASS: gcc.c-torture/execute/builtins/20010124-1.c execution, -O0 -flto Executing on host: /usr/share/src/lto_build/gcc/xgcc -B/usr/share/src/lto_build/gcc/ /usr/share/src/lto_trunk/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1.c /usr/share/src/lto_trunk/gcc/testsuite/gcc.c-torture/execute/builtins/20010124-1-lib.c /usr/share/src/lto_trunk/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c -w -O0 -fwhopr -lm -o /usr/share/src/lto_build/gcc/testsuite/gcc/20010124-1.x1 (timeout = 300) getconf: Invalid argument (_NPROCESSORS_ONLN) /usr/share/src/lto_build/gcc/ltrans-driver[99]: [: argument expected output is: getconf: Invalid argument (_NPROCESSORS_ONLN) /usr/share/src/lto_build/gcc/ltrans-driver[99]: [: argument expected FAIL: gcc.c-torture/execute/builtins/20010124-1.c compilation, -O0 -fwhopr UNRESOLVED: gcc.c-torture/execute/builtins/20010124-1.c execution, -O0 -fwhopr On Solaris if you execute this, you get this: # /usr/bin/getconf _NPROCESSORS_ONLN getconf: Invalid argument (_NPROCESSORS_ONLN) # /usr/xpg4/bin/getconf _NPROCESSORS_ONLN getconf: Invalid argument (_NPROCESSORS_ONLN) But, if you execute this, you get this: # /bin/ksh93 -c getconf | grep NPROCESSORS_ONLN NPROCESSORS_ONLN=1 # /bin/ksh93 -c "getconf NPROCESSORS_ONLN" 1 The last result is probably what is wanted. Rob
Created attachment 17349 [details] Proposed Patch to fix ltrans-driver on Platform OpenSolaris This patch should fix this Bug (and another, use gawk instead of awk) in the ../lto_trunk/gcc/lto/ltrans-driver file on OpenSolaris 2009.06 . Rob
Created attachment 17353 [details] Proposed Patch to fix ltrans-driver on Platform OpenSolaris Revised Patch.
I don't think ltrans-driver should be a shell script anyways because on windows you will most likely not have /bin/sh installed.
Subject: Re: [lto] - Testsuite gcc.log shows many "getconf: Invalid argument (_NPROCESSORS_ONLN)" On Mon, Feb 23, 2009 at 12:29, pinskia at gcc dot gnu dot org <gcc-bugzilla@gcc.gnu.org> wrote: > > > ------- Comment #3 from pinskia at gcc dot gnu dot org 2009-02-23 17:29 ------- > I don't think ltrans-driver should be a shell script anyways because on windows > you will most likely not have /bin/sh installed. Yes, ltrans-driver is a quick hack. It probably only works reliably on some variants of Linux. It's a small script, so it should be easy to fix. Diego.
On OpenSolaris 2009.06 (snv_106) I get improved results with the Patch. Before my Patch (awful, posted for comparison purposes only): Results for 4.4.0 20090218 (experimental) [lto revision 144375] (lto merged with rev 144262) testsuite on i386-pc-solaris2.11 http://gcc.gnu.org/ml/gcc-testresults/2009-02/msg02284.html === gcc Summary === # of expected passes 59196 # of unexpected failures 3865 # of unexpected successes 4 # of expected failures 186 # of unresolved testcases 2405 # of unsupported tests 564 ----- After my Patch: Results for 4.4.0 20090218 (experimental) [lto revision 144375] (lto merged with rev 144262) testsuite on i386-pc-solaris2.11 (Patched) http://gcc.gnu.org/ml/gcc-testresults/2009-02/msg02375.html === gcc Summary === # of expected passes 64141 # of unexpected failures 1201 # of unexpected successes 4 # of expected failures 186 # of unresolved testcases 115 # of unsupported tests 564 Rob
Confirmed.
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.
For the ease of debugging lto_execute_ltrans should get a mode that just serially executes things without a script. I'm trying to get that running.
Mine.
Subject: Bug 39276 Author: rguenth Date: Tue Sep 22 11:28:14 2009 New Revision: 151973 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151973 Log: 2009-09-22 Richard Guenther <rguenther@suse.de> PR lto/39276 * doc/invoke.texi (-fltrans-driver): Remove. lto/ * lto.c (lto_execute_ltrans): Perform ltrans phase manually. * Make-lang.in: Remove ltrans-driver stuff. * config-lang.in: Likewise. * lang.opt (fltrans-driver): Remove. * lto-lang.c (lto_init_options): Remove code initializing ltrans_driver. * ltrans-driver: Remove. Modified: branches/lto/gcc/ChangeLog.lto branches/lto/gcc/doc/invoke.texi branches/lto/gcc/lto/ChangeLog branches/lto/gcc/lto/Make-lang.in branches/lto/gcc/lto/config-lang.in branches/lto/gcc/lto/lang.opt branches/lto/gcc/lto/lto-lang.c branches/lto/gcc/lto/lto.c
Fixed.
(In reply to comment #11) > Fixed. Thanks, Rob