Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

isnan-problem in x21.cc (5.9.2) on AIX 5.3

DerSchwabe
2009-01-29
2013-03-15
  • DerSchwabe
    DerSchwabe
    2009-01-29

    Hello,
    when compiling plplot version 5.9.2 on AIX 5.3 with BUILD_TEST=ON, compilation stops with:
    "/afs/ipp/home/g/geiger/plplot-5.9.2/examples/c++/x21.cc", line 32.11: 1540-0848 (S) The macro name "isnan" is already defined with a different definition.
    "/usr/include/math.h", line 1066.9: 1540-0425 (I) "isnan" is defined on line 1066 of "/usr/include/math.h".
    Can anyone help or give an advice?
    Best regards,
    Joachim

     
    • Werner Smekal
      Werner Smekal
      2009-01-30

      Hi, you could just remove line 31-33 in x21.cc

      #if !defined(HAVE_ISNAN)
        #define isnan(x) ((x) != (x))
      #endif

      Problem here is, that HAVE_ISNAN is not correctly set in the CMake configuration stage on AIX, since obviously isnan is available. Could you post the output of CMake?

      Thanks,
      Werner

       
    • DerSchwabe
      DerSchwabe
      2009-01-30

      Hi,
      indeed, checking the output says isnan as well as _isnan is not found. I add the first part up to the X11-checking.
      Best regards,
      Joachim

      -- The C compiler identification is VisualAge
      -- The CXX compiler identification is VisualAge
      -- Check for working C compiler: /usr/bin/xlc
      -- Check for working C compiler: /usr/bin/xlc -- works
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working CXX compiler: /usr/bin/xlC
      -- Check for working CXX compiler: /usr/bin/xlC -- works
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Checking whether system has ANSI C header files
      -- Looking for include files StandardHeadersExist
      -- Looking for include files StandardHeadersExist - found
      -- Performing Test memchrExists
      -- Performing Test memchrExists - Success
      -- Performing Test freeExists
      -- Performing Test freeExists - Success
      -- Check for whether ctype.h macros work on characters with the
         high bit set.
      -- High-bit characters - work
      -- ANSI C header files - found
      -- Looking for include files HAVE_UNISTD_H
      -- Looking for include files HAVE_UNISTD_H - found
      -- Looking for include files HAVE_TERMIOS_H
      -- Looking for include files HAVE_TERMIOS_H - found
      -- Looking for include files HAVE_STDINT_H
      -- Looking for include files HAVE_STDINT_H - found
      -- Performing Test HAVE_SYS_WAIT_H
      -- Performing Test HAVE_SYS_WAIT_H - Success
      -- Looking for DIR in sys/types.h;dirent.h
      -- Looking for DIR in sys/types.h;dirent.h - found
      -- Check for signal return type in <signal.h>
      -- Check for signal handler return type type void  - found
      -- Looking for popen
      -- Looking for popen - found
      -- Looking for usleep
      -- Looking for usleep - found
      -- Looking for isinf
      -- Looking for isinf - found
      -- Looking for finite
      -- Looking for finite - found
      -- Looking for isnan
      -- Looking for isnan - not found
      -- Looking for _isnan
      -- Looking for _isnan - not found
      -- Looking for snprintf
      -- Looking for snprintf - found
      -- SWIG was not found. Please specify Swig executable location
      -- Found Perl: /usr/bin/perl
      -- Looking for pkg-config - found
      -- Looking for XOpenDisplay in /lib/libX11.a;/lib/libXext.a
      -- Looking for XOpenDisplay in /lib/libX11.a;/lib/libXext.a - found
      -- Looking for gethostbyname
      -- Looking for gethostbyname - found
      -- Looking for connect
      -- Looking for connect - found
      -- Looking for remove
      -- Looking for remove - found
      -- Looking for shmat
      -- Looking for shmat - found
      -- Looking for IceConnectionNumber in ICE
      -- Looking for IceConnectionNumber in ICE - found
      -- Found X11: /lib/libX11.a
      ...

       
      • Werner Smekal
        Werner Smekal
        2009-01-30

        Hi Joachim,

        could you run this program:

        /* Test for NaN awareness. */
        #include <stdio.h>
        #include "nan.h"

        int
        main()
        {
           double x = NaN;
           /* N.B. CMake run-time tests need return of true (1) or false (0) not
            * the usual status code of 0 for success. */
        #if defined(_MSC_VER) | defined(__BORLANDC__)
           if (isnan(x)) return 1;
        #endif

           if (x != x) return 1;
           else return 0;
        }

        which is in cmake/modules and change it until it works? Basically I think you must change the line

        #if defined(_MSC_VER) | defined(__BORLANDC__)

        to

        #if defined(_MSC_VER) | defined(__BORLANDC__) | defined(_AIX)

        according to http://predef.sourceforge.net/preos.html#sec2 . If this change works, please tell me, then I'll change that.

        Thanks,
        Werner

         
    • DerSchwabe
      DerSchwabe
      2009-01-30

      Hi Werner,
      if I compile TestNaNAware.c in cmake/modules using xlc I get:
      "TestNaNAware.c", line 3.10: 1506-296 (S) #include file "nan.h" not found.
      "TestNaNAware.c", line 9.15: 1506-045 (S) Undeclared identifier NaN.

      With a little help I recognized that the definition for NaN is in math.h, but as NAN. The code now reads as:
      /* Test for NaN awareness. */
      #include <stdio.h>
      #if defined(_AIX)
      #include <math.h>
      #elif
      #include "nan.h"
      #endif

      int
      main()
      {
      #if defined(_AIX)
         double x = NAN;
      #elif
         double x = NaN;
      #endif
         /* N.B. CMake run-time tests need return of true (1) or false (0) not
          * the usual status code of 0 for success. */
      #if defined(_MSC_VER) | defined(__BORLANDC__) | defined(_AIX)
         if (isnan(x)) return 1;
      #endif

         if (x != x) return 1;
         else return 0;
      }

      Now it compiles with xlc, but when loading I get:
      ld: 0711-317 ERROR: Undefined symbol: ._isnan
      ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
      Finally also solved the loader problem by linking with libm.a .
      However, the check for isnan at the beginning is still there, since this is done with the cmake function check_function_exists which is called in plplot.cmake .
      I hope you can come up with a solution using my results.
      Best regards,
      Joachim

       
      • Werner Smekal
        Werner Smekal
        2009-01-30

        Hi Joachim,

        thank you very much. I think you provided enough information to adjust PLplot for AIX (regarding the isnan issue). Since I'm away the next 7 days, I'll forward this message to the developer list and hope that some of the other devs will make the appropriate changes. In addition to testnanaware.c we will also need to adjust some PLplot code, but similar to what you have done.

        Thanks,
        Werner