Menu

nco-3.9.0 int64_t w. intel compiler on x86_64

Developers
2007-05-30
2013-10-17
  • Mario Emmenlauer

    Hi there,

    I had a problem building nco-3.9.0 on x86_64 with icc 9.1.
    Several cc and cpp-files in src/nco++/ complained that int64_t
    would be undefined:

    ----
    make[6]: Entering directory `/extsrc/nco-3.9.0/src/nco++'
    if icpc -DHAVE_CONFIG_H -I. -I. -I../.. -I./ -I../nco  -I/ext/include   -D_BSD_SOURCE -D_POSIX_SOURCE -no-gcc  -g -O2 -cxxlib-gcc -MT ncap2.o -MD -MP -MF ".deps/ncap2.Tpo" -c -o ncap2.o ncap2.cc; \         then mv -f ".deps/ncap2.Tpo" ".deps/ncap2.Po"; else rm -f ".deps/ncap2.Tpo"; exit 1; fi
    if icpc -DHAVE_CONFIG_H -I. -I. -I../.. -I./ -I../nco  -I/ext/include   -D_BSD_SOURCE -D_POSIX_SOURCE -no-gcc  -g -O2 -cxxlib-gcc -MT ncap2_utl.o -MD -MP -MF ".deps/ncap2_utl.Tpo" -c -o ncap2_utl.o ncap2_utl.cc; \         then mv -f ".deps/ncap2_utl.Tpo" ".deps/ncap2_utl.Po"; else rm -f ".deps/ncap2_utl.Tpo"; exit 1; fi
    /usr/include/c++/4.0.3/bits/postypes.h(72): error: identifier "int64_t" is undefined
        typedef int64_t       streamoff;
    ----

    I got rid of the error by including <stdint.h> in all those cc- and cpp-files.
    It seems like a quirky solution, however it is working for me so I'll attach the
    patch. In case you need more information please let me know.

    diff -ruN nco-3.9.0-org/src/nco++/ncap2.cc nco-3.9.0/src/nco++/ncap2.cc
    --- nco-3.9.0-org/src/nco++/ncap2.cc    2007-05-24 16:50:20.000000000 +0200
    +++ nco-3.9.0/src/nco++/ncap2.cc        2007-05-30 01:46:55.000000000 +0200
    @@ -44,6 +44,7 @@
    #endif /* !HAVE_CONFIG_H */

    /* Standard C headers */
    +#include <stdint.h> /* int64_t */
    #include <assert.h>  /* assert() debugging macro */
    #include <stdio.h> /* stderr, FILE, NULL, etc. */
    #include <stdlib.h> /* atof, atoi, malloc, getopt */
    diff -ruN nco-3.9.0-org/src/nco++/ncap2_utl.cc nco-3.9.0/src/nco++/ncap2_utl.cc
    --- nco-3.9.0-org/src/nco++/ncap2_utl.cc        2007-05-21 05:46:11.000000000 +0200
    +++ nco-3.9.0/src/nco++/ncap2_utl.cc    2007-05-30 01:46:55.000000000 +0200
    @@ -6,6 +6,7 @@
        You may copy, distribute, and/or modify this software under the terms of the GNU General Public License (GPL) Version 2
        See http://www.gnu.org/copyleft/gpl.html for full license text */

    +#include <stdint.h>
    #include <assert.h>
    #include <ctype.h>
    #include <algorithm>
    diff -ruN nco-3.9.0-org/src/nco++/NcapVarVector.cc nco-3.9.0/src/nco++/NcapVarVector.cc
    --- nco-3.9.0-org/src/nco++/NcapVarVector.cc    2007-05-23 18:07:57.000000000 +0200
    +++ nco-3.9.0/src/nco++/NcapVarVector.cc        2007-05-30 01:46:55.000000000 +0200
    @@ -1,3 +1,4 @@
    +#include <stdint.h>
    #include "NcapVarVector.hh"

    NcapVar* NcapVarVector::find(const char*nm){
    diff -ruN nco-3.9.0-org/src/nco++/ncoLexer.cpp nco-3.9.0/src/nco++/ncoLexer.cpp
    --- nco-3.9.0-org/src/nco++/ncoLexer.cpp        2007-05-25 07:44:50.000000000 +0200
    +++ nco-3.9.0/src/nco++/ncoLexer.cpp    2007-05-30 01:46:59.000000000 +0200
    @@ -1,4 +1,5 @@
    /* $ANTLR 2.7.6 (20070220): "ncoGrammer.g" -> "ncoLexer.cpp"$ */
    +#include <stdint.h>
    #include "ncoLexer.hpp"
    #include <antlr/CharBuffer.hpp>
    #include <antlr/TokenStreamException.hpp>
    diff -ruN nco-3.9.0-org/src/nco++/ncoParser.cpp nco-3.9.0/src/nco++/ncoParser.cpp
    --- nco-3.9.0-org/src/nco++/ncoParser.cpp       2007-05-23 22:53:33.000000000 +0200
    +++ nco-3.9.0/src/nco++/ncoParser.cpp   2007-05-30 01:46:59.000000000 +0200
    @@ -1,4 +1,5 @@
    /* $ANTLR 2.7.6 (20070220): "ncoGrammer.g" -> "ncoParser.cpp"$ */
    +#include <stdint.h>
    #include "ncoParser.hpp"
    #include <antlr/NoViableAltException.hpp>
    #include <antlr/SemanticException.hpp>
    diff -ruN nco-3.9.0-org/src/nco++/ncoTree.cpp nco-3.9.0/src/nco++/ncoTree.cpp
    --- nco-3.9.0-org/src/nco++/ncoTree.cpp 2007-05-25 06:35:00.000000000 +0200
    +++ nco-3.9.0/src/nco++/ncoTree.cpp     2007-05-30 01:46:59.000000000 +0200
    @@ -1,4 +1,5 @@
    /* $ANTLR 2.7.6 (20070220): "ncoGrammer.g" -> "ncoTree.cpp"$ */
    +#include <stdint.h>
    #include "ncoTree.hpp"
    #include <antlr/Token.hpp>
    #include <antlr/AST.hpp>

     
    • Charlie Zender

      Charlie Zender - 2007-06-01

      Hi,

      Thanks for the patch. It's necessary on some compilers because 64-bit
      integers are not in the C++ standard.
      I implemented it with some alterations to avoid redundancy.
      It's in CVS and will be in 3.9.1.
      Please test if you get the chance.

      Thanks,
      Charlie

       
    • Charlie Zender

      Charlie Zender - 2007-06-01

      Hi,

      This patch breaks compilation on older versions of AIX xlc
      which lack stdint.h. I'll have to tweak it some more...

      Charlie

       

Log in to post a comment.