Menu

#9 compile error on Solaris - definition of PS_COMMAND wrong

closed-fixed
None
5
2005-07-12
2005-03-14
Steve Evans
No

I Get a compile error on Solaris because the #define of
PS_COMMAND in config.h is not quoted:

#define PS_COMMAND /bin/ps -eo
pid,ppid,uid,vsz,etime,time,args

This is the compiler output:

if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/opt/kde/include
-I/opt/qt/include
-I/gorbag/exta/cad/externals/SOLARIS/include
-DQT_THREAD_SUPPORT -I/opt/kde/include
-I/gorbag/exta/cad/externals/SOLARIS/include
-I/opt/qt/include -D_REENTRANT
-D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4
-Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W
-Wpointer-arith -Wwrite-strings -DNDEBUG -DNO_DEBUG -O2
-I/opt/kde/include
-I/gorbag/exta/cad/externals/SOLARIS/include
-I/opt/qt/include -O2 -fomit-frame-pointer
-DNeedVarargsPrototypes=1 -DNeedFunctionPrototypes=1
-pipe -fno-exceptions -mcpu=ultrasparc -fno-exceptions
-fno-check-new -fno-common -MT procattach.o -MD -MP
-MF ".deps/procattach.Tpo" -c -o procattach.o
procattach.cpp; \ then mv -f ".deps/procattach.Tpo"
".deps/procattach.Po"; else rm -f
".deps/procattach.Tpo"; exit 1; fi
procattach.cpp: In constructor
`ProcAttachPS::ProcAttachPS(QWidget*)':
procattach.cpp:34: error: expected primary-expression
before '/' token
procattach.cpp:34: error: `ps' undeclared (first use
this function)
procattach.cpp:34: error: (Each undeclared identifier
is reported only once for each function it appears in.)
procattach.cpp:34: error: `eo' undeclared (first use
this function)
procattach.cpp:34: error: expected `}' before "pid"
procattach.cpp:34: error: expected `,' or `;' before "pid"
procattach.cpp:32: warning: unused variable 'psCommand'
procattach.cpp: At global scope:
procattach.cpp:40: error: expected unqualified-id
before "for"
procattach.cpp:40: error: expected `,' or `;' before "for"
procattach.cpp:40: error: `i' was not declared in this
scope
procattach.cpp:40: error: expected constructor,
destructor, or type conversion before '!=' token
procattach.cpp:40: error: expected `,' or `;' before
'!=' token
procattach.cpp:40: error: expected constructor,
destructor, or type conversion before '++' token
procattach.cpp:40: error: expected `,' or `;' before
'++' token
procattach.cpp:44: error: expected constructor,
destructor, or type conversion before ';' token
procattach.cpp:45: error: expected declaration before
'}' token

Discussion

  • Johannes Sixt

    Johannes Sixt - 2005-06-19
    • assigned_to: nobody --> j6t
     
  • Johannes Sixt

    Johannes Sixt - 2005-06-19

    Logged In: YES
    user_id=20017

    This seems to be some bug or inconsistency in the auto* tools.
    Please specify the versions of automake and autoconf you use
    and attach the 'configure' that was created.

    -- Hannes

     
  • Steve Evans

    Steve Evans - 2005-06-20

    Logged In: YES
    user_id=955095

    This is using the configure that comes bundled with version
    1.9.7.

    automake --version
    automake (GNU automake) 1.9.3
    Written by Tom Tromey <tromey@redhat.com>.

    autoconf --version
    autoconf (GNU Autoconf) 2.58
    Written by David J. MacKenzie and Akim Demaille.

     
  • Johannes Sixt

    Johannes Sixt - 2005-06-20

    Logged In: YES
    user_id=20017

    I have access to a Solaris (8) machine, but I cannot
    reproduce the problem. Can you please debug it? Look for
    PS_COMMAND in ./configure and ./config.status and
    reproduce the commands manually. I would like to know
    where the double-quotes get lost.

    -- Hannes

     
  • Steve Evans

    Steve Evans - 2005-06-20

    Logged In: YES
    user_id=955095

    There appears to be a problem with a sed invocation under
    the bourne shell that works fine under bash:

    checking for suitable ps invocation... + PS_COMMAND=/bin/ps
    -eo pid,ppid,uid,vsz,etime,time,args
    + /bin/ps -eo pid,ppid,uid,vsz,etime,time,args
    + 1> /dev/null 2>& 1
    + /bin/ps -eo pid,ppid,uid,vsz,etime,time,args
    + head -1
    + set x PID PPID UID VSZ ELAPSED TIME COMMAND
    + test x PID PPID UID VSZ ELAPSED TIME COMMAND = x PID PPID
    UID VSZ ELAPSED TIME COMMAND
    + :
    + test -n /bin/ps -eo pid,ppid,uid,vsz,etime,time,args
    + echo configure:32641: result: /bin/ps -eo
    pid,ppid,uid,vsz,etime,time,args
    + 1>& 5
    + echo /bin/ps -eo pid,ppid,uid,vsz,etime,time,args
    + 1>& 6
    /bin/ps -eo pid,ppid,uid,vsz,etime,time,args
    +
    ./configure[32643]: : cannot execute
    + /g'
    + + echo /bin/ps -eo pid,ppid,uid,vsz,etime,time,args
    + sed -e s/ /",
    sed: command garbled: s/ /",
    PS_COMMAND="
    ./configure[32643]: /g': not found
    + cat
    + 1>> confdefs.h 0<<
    #define PS_COMMAND /bin/ps -eo pid,ppid,uid,vsz,etime,time,args

    If I run the same command by hand under bash it works:

    PS_COMMAND="\"`echo /bin/ps -eo
    pid,ppid,uid,vsz,etime,time,args | /bin/sed -e 's/ /", "/g'`\""

    but under /bin/sh it doesn't:

    $ PS_COMMAND="\"`echo /bin/ps -eo
    pid,ppid,uid,vsz,etime,time,args | /bin/sed -e 's/ /", "/g'`\""
    : cannot execute
    sed: command garbled: s/ /",
    /g': not found

     
  • Johannes Sixt

    Johannes Sixt - 2005-07-11

    Logged In: YES
    user_id=20017

    The purpose of this command is to replace the blanks between
    the words by ", " (i.e. quote, comma, blank, quote) and add a
    quote at the beginning and the end.
    You would do me a favor if you could derive a command that
    does the same and works under your shell. Maybe it's
    necessary to use set -- $PS_COMMAND and/or process the
    words in a while loop :-(, or maybe there's a simpler trick.

    -- Hannes

     
  • Johannes Sixt

    Johannes Sixt - 2005-07-12
    • status: open --> closed-fixed
     
  • Johannes Sixt

    Johannes Sixt - 2005-07-12

    Logged In: YES
    user_id=20017

    I was now able to reproduce the problem. The fix is to just
    remove the first and last double-quote in the problematic line.

    -- Hannes

     

Log in to post a comment.