[Pacemaker] stdout reserved word

Grüninger, Andreas (LGL Extern) Andreas.Grueninger at lgl.bwl.de
Thu Aug 23 17:05:51 EDT 2012


See at http://grueni.github.com/libqb/.
I described there the complete build of the libqb/corosync/pacemaker build.

Here are snippets of the outputs:

conftest.c: In function 'main':
conftest.c:124:1: error: passing argument 1 of 'printw' discards qualifiers from pointer target type
/usr/include/curses.h:350:12: note: expected 'char *' but argument is of type 'const char *'
configure:16483: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "pacemaker"
| #define PACKAGE_TARNAME "pacemaker"
| #define PACKAGE_VERSION "1.1.7"
| #define PACKAGE_STRING "pacemaker 1.1.7"
| #define PACKAGE_BUGREPORT "pacemaker at oss.clusterlabs.org"
| #define PACKAGE_URL ""
| #define PACKAGE "pacemaker"
| #define VERSION "1.1.7"
| #define PACEMAKER_VERSION "1.1.7"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define HAVE_STRINGIZE 1
| #define SIZEOF_CHAR 1
| #define SIZEOF_SHORT 2
| #define SIZEOF_INT 4
| #define SIZEOF_LONG 4
| #define SIZEOF_LONG_LONG 8
| #define HAVE_DECL_TZNAME 1
| #define HAVE_TZNAME 1
| #define U64T "%llu"
| #define VALGRIND_BIN "/usr/bin/valgrind"
| #define SUPPORT_STONITH_CONFIG 0
| #define HAVE_ALPHASORT 1
| #define HAVE_INET_PTON 1
| #define HAVE_SCANDIR 1
| #define HAVE_SETENV 1
| #define HAVE_STRERROR 1
| #define HAVE_STRCHRNUL 1
| #define HAVE_STRERROR 1
| #define HAVE_STRCHRNUL 1
| #define HAVE_UNSETENV 1
| #define HAVE_STRNLEN 1
| #define HAVE_STRNDUP 1
| #define HAVE_DAEMON 1
| #define HAVE_STRLCPY 1
| #define HAVE_STRLCAT 1
| #define HAVE_LIBSOCKET 1
| #define HAVE_LIBC 1
| #define HAVE_LIBDL 1
| #define HAVE_LIBRT 1
| #define HAVE_LIBPAM 1
| #define HAVE_LIBUUID 1
| #define HAVE_LIBGLIB_2_0 1
| #define USE_GHASH_COMPAT 0
| #define HAVE_LIBC 1
| #define STDC_HEADERS 1
| #define HAVE_ARPA_INET_H 1
| #define HAVE_ASSERT_H 1
| #define HAVE_AUTH_CLIENT_H 1
| #define HAVE_CTYPE_H 1
| #define HAVE_DIRENT_H 1
| #define HAVE_ERRNO_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_GETOPT_H 1
| #define HAVE_GLIB_H 1
| #define HAVE_GRP_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_MALLOC_H 1
| #define HAVE_NETDB_H 1
| #define HAVE_NETINET_IN_H 1
| #define HAVE_PTHREAD_H 1
| #define HAVE_PWD_H 1
| #define HAVE_SECURITY_PAM_APPL_H 1
| #define HAVE_SGTTY_H 1
| #define HAVE_SIGNAL_H 1
| #define HAVE_STDARG_H 1
| #define HAVE_STDDEF_H 1
| #define HAVE_STDIO_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_SYS_IOCTL_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_SYS_POLL_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYS_SELECT_H 1
| #define HAVE_SYS_SOCKET_H 1
| #define HAVE_SYS_SOCKIO_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYS_TIMEB_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_UIO_H 1
| #define HAVE_SYS_UN_H 1
| #define HAVE_SYS_UTSNAME_H 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_TIME_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_TIME_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_LIBXML2 1
| #define HAVE_LIBXSLT 1
| #define HAVE_LIBXML_XPATH_H 1
| #define HAVE_LIBXSLT_XSLT_H 1
| #define HAVE_LRM_OP_T_RSC_DELETED 1
| #define HAVE_G_LOG_SET_DEFAULT_HANDLER 1
| #define HAVE_GETOPT 1
| #define HAVE_DECL_GETOPT 1
| #define HAVE_NANOSLEEP 1
| #define HAVE_DECL_NANOSLEEP 1
| #define HAVE_BZLIB_H 1
| #define HAVE_LIBBZ2 1
| #define HAVE_CURSES_H 1
| #define HAVE_NCURSES_NCURSES_H 1
| #define HAVE_LIBNCURSES 1
| /* end confdefs.h.  */
|
| #if defined(HAVE_CURSES_H)
| #  include <curses.h>
| #elif defined(HAVE_NCURSES_H)
| #  include <ncurses.h>
| #endif
|
| int
| main ()
| {
| printw((const char *)"Test");
|
|   ;
|   return 0;
| }
configure:16495: result: no
configure:16499: WARNING: The printw() function of your ncurses or curses library is old, we will disable usage of the library. If you want to use this library anyway, please update to newer version of the library, ncurses 5.4 or later is recommended. You can get the library from http://www.gnu.org/software/ncurses/.
configure:16501: Disabling curses

The ncurses libraries
root at zd-build-s1:/export/builds/pacemaker-1.1.7# ls -la /usr/gnu/lib/libncurses.so*
lrwxrwxrwx   1 root     root          15 Aug 23 18:38 /usr/gnu/lib/libncurses.so -> libncurses.so.5
lrwxrwxrwx   1 root     root          17 Aug 23 18:38 /usr/gnu/lib/libncurses.so.5 -> libncurses.so.5.7
-rwxr-xr-x   1 root     bin       366460 Aug 23 18:38 /usr/gnu/lib/libncurses.so.5.7

and the flags for compiler and linker
export LDFLAGS='-R/usr/gnu/lib -L/opt/ha/lib -L/usr/gnu/lib -L/lib -L/usr/lib'
export CFLAGS='-D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS -DNAME_MAX=255 -DHOST_NAME_MAX=255 -I/usr/include  -I/usr/include/ncurses -I/opt/ha/include  -lsocket -lnsl'

So I invalidate the the result of this test with
echo '#undef HAVE_INCOMPATIBLE_PRINTW'>>include/config.h

Now I get 
  CC       crm_mon.o
crm_mon.c:203:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ncurses_winch_handler'
crm_mon.c: In function 'mon_winresize':
crm_mon.c:211:13: error: 'ncurses_winch_handler' undeclared (first use in this function)
crm_mon.c:211:13: note: each undeclared identifier is reported only once for each function it appears in
crm_mon.c: In function 'main':
crm_mon.c:556:9: error: 'ncurses_winch_handler' undeclared (first use in this function)
gmake[1]: *** [crm_mon.o] Error 1
gmake[1]: Leaving directory `/export/builds/pacemaker-1.1.7/tools'
gmake: *** [all-recursive] Error 1

There is no glibc in Solaris, sighandler_t is undefined
tools/crm_mon.c
#if CURSES_ENABLED
+ typedef void (*sighandler_t)(int);
static sighandler_t ncurses_winch_handler;

and the it compiles and works e.g. "crm_mon i 1"


#################################################
gmake[2]: Entering directory `/export/builds/pacemaker-1.1.7/lib/fencing'
  CC       st_client.lo
In file included from st_client.c:36:0:
../../include/crm/stonith-ng-internal.h:28:9: error: expected identifier or '(' before '&' token
../../include/crm/stonith-ng-internal.h:29:5: error: expected ';' before 'int'
st_client.c: In function 'run_stonith_agent':
st_client.c:489:20: error: expected identifier before '(' token
st_client.c:490:62: error: 'async_command_t' has no member named 'pt_ops'
st_client.c:491:13: error: 'async_command_t' has no member named 'timeout'
st_client.c:493:22: error: 'async_command_t' has no member named 'timeout'
st_client.c:494:22: error: 'async_command_t' has no member named 'killseq'
st_client.c:494:52: error: 'async_command_t' has no member named 'timeout'
st_client.c:495:22: error: 'async_command_t' has no member named 'killseq'
st_client.c:496:22: error: 'async_command_t' has no member named 'killseq'
st_client.c:497:22: error: 'async_command_t' has no member named 'killseq'
st_client.c:498:22: error: 'async_command_t' has no member named 'killseq'
st_client.c:499:22: error: 'async_command_t' has no member named 'killseq'
st_client.c:501:50: error: 'async_command_t' has no member named 'killseq'
gmake[2]: *** [st_client.lo] Error 1
gmake[2]: Leaving directory `/export/builds/pacemaker-1.1.7/lib/fencing'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/export/builds/pacemaker-1.1.7/lib'
gmake: *** [all-recursive] Error 1

beginning of include/crm/stonith-ng-internal.h
/*
 * Copyright (C) 2011 Andrew Beekhof <andrew at beekhof.net>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
#ifndef STONITH_NG_INTERNAL__H
#  define STONITH_NG_INTERNAL__H

#  include <crm/common/ipc.h>
#  include <crm/common/xml.h>
#  include <clplumbing/proctrack.h>

typedef struct async_command_s {

    int id;
    int stdout;         <=== line 28
    int options;        <=== line 29



st_client.c line 489
            track->stdout = p_read_fd;



fencing/commands.c            
    do {
        char buffer[READ_MAX];

        errno = 0;
        if(cmd->stdout > 0) {
            memset(&buffer, 0, READ_MAX);
            more = read(cmd->stdout, buffer, READ_MAX-1);
            crm_trace("Got %d more bytes: %s", more, buffer);
        }

        if(more > 0) {
            crm_realloc(output, len + more + 1);
            sprintf(output+len, "%s", buffer);
            len += more;
        }

    } while (more == (READ_MAX-1) || (more < 0 && errno == EINTR));

    if(cmd->stdout) {
        close(cmd->stdout);
        cmd->stdout = 0;
    }
            

Changes from stdout => stdoutx and it compiles.
###################################################




-----Ursprüngliche Nachricht-----
Von: Andrew Beekhof [mailto:andrew at beekhof.net] 
Gesendet: Donnerstag, 23. August 2012 02:03
An: The Pacemaker cluster resource manager
Betreff: Re: [Pacemaker] stdout reserved word

Can you show us the gcc command line and the errors that are produced?

On Wed, Aug 22, 2012 at 3:20 AM, Grüninger, Andreas (LGL Extern) <Andreas.Grueninger at lgl.bwl.de> wrote:
> Hello
>
> I compiled Pacemaker 1.1.7 with gcc 4.5 in Solaris 11 and with gcc 4.6 in OpenIndiana 151a6.
> I had to change the following:
> perl -pi -e 's#stdout#stdoutx#'   include/crm/stonith-ng-internal.h
> perl -pi -e 's#>stdout#>stdoutx#' lib/fencing/st_client.c perl -pi -e 
> 's#>stdout#>stdoutx#' fencing/commands.c
>
> Do I miss a compiler flag to accept stdout as a variable name?
>
> In tools/crm_mon.c I added the line with the '+' because sighandler_t is not defined.
> #if CURSES_ENABLED
> + typedef void (*sighandler_t)(int);
> static sighandler_t ncurses_winch_handler;
>
> Also the test for a compatible printw function fails with a error message like "your ncurses is too old, we need 5.4".
> The version of the installed ncurses library is 5.7.
> I added between autogen.sh and gmake this to include/config.h which invalidate the result of the erroneously failing test:
> echo '#undef HAVE_INCOMPATIBLE_PRINTW'>>include/config.h
>
> crm and crm_mon work without any problem.
>
> Should I send patches via the list or report a bug?
>
> Andreas
>
>
> _______________________________________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org 
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>
> Project Home: http://www.clusterlabs.org Getting started: 
> http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://bugs.clusterlabs.org

_______________________________________________
Pacemaker mailing list: Pacemaker at oss.clusterlabs.org http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Project Home: http://www.clusterlabs.org Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org




More information about the Pacemaker mailing list