ERRORE CONVERSIONE DI TIPO DATI

di il
2 risposte

ERRORE CONVERSIONE DI TIPO DATI

Buongiorno ,sto impazzendo da circa una settimana a compilare un codice non proprietario che ho scaricato per fare un porting su IBM POWER8. Il punto focale è risolvere questo errore, per proseguire.
Non capisco nel file Conversion.h cosa vi sia di sbagliato ,
e soprattutto non capisco da questa parte di errore ,quale funzione ed in quale file venga chiamata la memcpy. dal log

Grazie per chi volesse illuminarmi.
Buona serata .

Conversion.h
#ifndef CASA_CONVERSION_H
#define CASA_CONVERSION_H

//# Includes
#include <casa/string.h> // needed for memcpy


namespace casa { //# NAMESPACE CASA - BEGIN

// <summary>
// A class with general conversion definitions
// </summary>

// <use visibility=export>

// <reviewed reviewer="Friso Olnon" date="1996/11/06" tests="tConversion" demos="">
// </reviewed>

// <synopsis>
// This class contains the general definitions for the Conversion classes.
// <ul>
// <li>
// It defines the signature for the functions converting from input
// to output format (e.g. from local to canonical format). There is
// a version where the number of values is given and a version where
// the number of bytes is given. The latter is there to be able to use
// memcpy as a conversion function (which will often be the case).
// Note that the signatures only differ in return value.
// <li>
// It defines functions to convert Bools to bits and vice-versa.
// These are used elsewhere to store Bools as space efficient as possible.
// Note that these functions are machine independent (they work on little
// and big endian machines).
// <li>
// It defines a private version of memcpy for compilers having a
// different signature for memcpy (e.g. ObjectCenter and DEC-Alpha).
// </ul>
// Static functions in the classes
// <linkto class=CanonicalConversion>CanonicalConversion</linkto>,
// <linkto class=VAXConversion>VAXConversion</linkto>, and
// <linkto class=IBMConversion>IBMConversion</linkto> convert data
// from/to canonical, VAX, and IBM/360 format, resp..
// <br>Classes derived from
// <linkto class=DataConversion>DataConversion</linkto>
// provide the same functionality in a polymorphic way.
// </synopsis>

// <motivation>
// This provides a common place for definitions used elsewhere.
// It also provides a uniform interface to memcpy.
// </motivation>

//# <todo asof="$DATE$">
//# </todo>


class Conversion
{
public:
// Define the signature of a function converting <src>nvalues</src>
// values from internal to external format or vice-versa.
// These functions are used in the <linkto class=TypeIO>IO framework
// </linkto>, but are also used in the table system.
// Examples of such conversions are:
// <br>- local <-> canonical (when storing in canonical format)
// <br>- local <-> local (when storing in local format)
// <br>- binary <-> ASCII
// <br>It returns the number of bytes in <em>external</em> format.
// (For example the ToLocal/FromLocal functions in class
// <linkto class=CanonicalConversion>CanonicalConversion</linkto>
// return the number of bytes in canonical format).
typedef unsigned int ValueFunction (void* to, const void* from,
unsigned int nvalues);

// Define the signature of a function converting from one
// format to another providing the number of bytes.
// It returns the <src>to</src> pointer (similar to memcpy).
// (For example the byteTo/FromLocalXXX functions in class
// <linkto class=CanonicalConversion>CanonicalConversion</linkto>.
typedef void* ByteFunction (void* to, const void* from,
unsigned int nbytes);

// Convert a stream of Bools to output format (as bits).
// The variable <src>startBit</src> (0-relative) indicates
// where to start in the <src>to</src> buffer.
// <group>
static unsigned int boolToBit (void* to, const void* from,
unsigned int nvalues);
static void boolToBit (void* to, const void* from,
unsigned int startBit,
unsigned int nvalues);
// </group>

// Convert a stream of Bools to output format (as bits).
// The variable <src>startBit</src> (0-relative) indicates
// where to start in the <src>from</src> buffer.
// <group>
static unsigned int bitToBool (void* to, const void* from,
unsigned int nvalues);
static void bitToBool (void* to, const void* from,
unsigned int startBit,
unsigned int nvalues);
// </group>

// Copy a value using memcpy.
// It differs from memcpy in the return value.
// <note> This version has the <src>ValueFunction</src> signature,
// but it expects as input the number of bytes.
// </note>
static unsigned int valueCopy (void* to, const void* from,
unsigned int nbytes);

// Get a pointer to the memcpy function.
static ByteFunction* getmemcpy();

// A placeholder for the ObjectCenter or DEC-alpha memcpy or 64bit SGI
// Also added this for HPUX11 (2b provided in the makedefs)
// (because they do not use an unsigned int for nbytes).
static void* mymemcpy (void* to, const void* from, unsigned int nbytes);

private:
// Copy bits to Bool in an unoptimized way needed when 'to' is not
// aligned properly.
static unsigned int bitToBool_ (void* to, const void* from,
unsigned int nvalues);
};


inline Conversion::ByteFunction* Conversion::getmemcpy()
{
#if defined(__CLCC__) || defined(AIPS_64B) || defined(HPUX11) || defined(AIPS_DARWIN) || defined(AIPS_CRAY_PGI)
return mymemcpy;
#else

return memcpy;
#endif
}



} //# NAMESPACE CASA - END




LOG ERRORE>>
g++ -O2 -DCASA_USECASAPATH -DCASACORE_NEEDS_RETHROW -DCASACORE_NOEXIT -DHAVE_FFTW3 -DHAVE_FFTW3_THREADS -fPIC -I. -I/usr/include/cfitsio -c casa/Containers/Record2Interface.cc -o casa/Containers/Record2Interface.o
g++ -O2 -DCASA_USECASAPATH -DCASACORE_NEEDS_RETHROW -DCASACORE_NOEXIT -DHAVE_FFTW3 -DHAVE_FFTW3_THREADS -fPIC -I. -I/usr/include/cfitsio -c casa/Containers/ValueHolderRep.cc -o casa/Containers/ValueHolderRep.o
In file included from ./casa/Utilities/ValType.h:38:0,
from ./casa/Utilities/Sort.h:34,
from ./casa/Utilities/GenSort.h:32,
from ./casa/Arrays/ArrayMath.tcc:38,
from ./casa/Arrays/ArrayMath.h:853,
from casa/Containers/Record2Interface.cc:33:
./casa/OS/Conversion.h: In static member function ‘static void* (* casa::Conversion::getmemcpy())(void*, const void*, unsigned int)’:
./casa/OS/Conversion.h:162:12: error: invalid conversion from ‘void* (*)(void*, const void*, size_t) throw () {aka void* (*)(void*, const void*, long unsigned int) throw ()}’ to ‘void* (*)(void*, const void*, unsigned int)’ [-fpermissive]
return memcpy;

2 Risposte

  • Re: ERRORE CONVERSIONE DI TIPO DATI

    Te lo sta dicendo lui:

    in "Conversion.h" riga 162 (

    stai tentando di convertire un puntatore a funzione con signature
    
    void* (*)(void*, const void*, size_t) throw ()
    
    che corrisponde, risolvendo i typedef, a
    
    void* (*)(void*, const void*, [b]long unsigned int[/b]) throw ()
    
    in
    
    void* (*)(void*, const void*, [b]unsigned int[/b])
    
    Evidentemente, la dimensione (quello che ritorna sizeof()) di long unsigned int non e' la stessa di unsigned int per il processore POWER8.

    Devi controllare la definizione di memcopy con la tua definizione di ByteFunction.
  • Re: ERRORE CONVERSIONE DI TIPO DATI

    Grazie Migliorabile!
    ho sistemato il typedef della funzione come mi avevi indicato e tutto ha funzionato.
    Ero arrivato al 60% della compilazione ma mi ha dato questo errore:
    g++: internal compiler error: Killed (program cc1plus)
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
    make: *** [obj/alert.o] Error 4
    Ho letto che trattasi di esaurimento memoria, ho esteso la swap e le cose sono andate.

    Fino al 70% con nuovo errore, e questa la vedo veramente tosta per me,provo a vedere se riesci a darmi n indicazione, se si, te ne sarei grato:
    exception specifier?
    Grazie mille in ogni caso e buona serata.

    ERRORE:
    Building CXX object scimath/CMakeFiles/casa_scimath.dir/Mathematics/VectorKernel.cc.o
    /home/ubuntu/CASA/work2/stable-2013-10/casacore/scimath/Functionals/SerialHelper.cc:69:52: error: declaration of ‘void casa::getArrayVal(V&, int, const casa::Record&, const casa::String&, casa::uInt) [with V = bool; casa::uInt = unsigned int]’ has a different exception specifier
    const String& name, uInt index)WHATEVER_SUN_EXCEPTSPEC(InvalidSerializationError)
    ^
    In file included from /home/ubuntu/CASA/work2/stable-2013-10/casacore/scimath/Functionals/SerialHelper.cc:28:0:
    /home/ubuntu/CASA/work2/stable-2013-10/casacore/scimath/Functionals/SerialHelper.h:39:6: error: from previous declaration ‘void casa::getArrayVal(V&, int, const casa::Record&, const casa::String&, casa::uInt) throw (casa::InvalidSerializationError) [with V = bool; casa::uInt = unsigned int]’
    void getArrayVal(V &val, int type, const Record& gr,
    ^
    /home/ubuntu/CASA/work2/stable-2013-10/casacore/scimath/Functionals/SerialHelper.cc:91:52: error: declaration of ‘void casa::getArrayVal(V&, int, const casa::Record&, const casa::String&, casa::uInt) [with V = short int; casa::uInt = unsigned int]’ has a different exception specifier
    const String& name, uInt index)WHATEVER_SUN_EXCEPTSPEC(InvalidSerializationError)

    1G ^


    SerialHelper.h
    29 #ifndef SCIMATH_SERIALHELPER_H
    30 #define SCIMATH_SERIALHELPER_H
    31
    32 #include <scimath/Functionals/FunctionFactoryErrors.h>
    33 #include <casa/Containers/Record.h>
    34 namespace casa { //# NAMESPACE CASA - BEGIN
    35
    36 template<class T> class Array;
    37
    38 template <class V>
    39 void getArrayVal(V &val, int type, const Record& gr,
    40 const String& name, uInt index=0)
    41 throw (InvalidSerializationError);
    42
    43 template <class V>
    44 void getArray(Array<V> &val, int type, const Record& gr,
    45 const String& name)
    46 throw (InvalidSerializationError);
    47
    48 // <summary>
    49 //
    50 //
    51 //
    52 //
    53 //
    54 // </summary>
    55
    56 // <use visibility=export>
    57
    58 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
    59 // </reviewed>
    60
    61 // <prerequisite>
    62 // <li> FunctionFactory
    63 // </prerequisite>
    64 //
    65 // <etymology>
    66 //
    67 //
    68 // </etymology>
    69 //
    70 // <synopsis>
    71 //
    72 //
    73 //
    74 //
    75 // </synopsis>
    76 //
    77 // <example>
    78 //
    79 //
    80 //
    81 // </example>
    82 //
    83 // <motivation>
    84 //
    85 //
    86 //
    87 // </motivation>
    88 //
    89 // <thrown>
    90 // <li> InvalidSerializationError by getFuncType() if Record
    91 // does not contain a "functype" field containing a string.
    92 // <li> InvalidSerializationError
    93 // </thrown>
    94 //
    95 // <todo asof="yyyy/mm/dd">
    96 // <li>
    97 // <li>
    98 // <li>
    99 // </todo>
    100
    101 class SerialHelper {
    102 public:
    103 static const String FUNCTYPE;
    104 static const String gtype[];
    105 enum shType { shtBOOL=0, shtBYTE, shtSHORT, shtINT, shtFLOAT,
    106 shtDOUBLE, shtCOMPLEX, shtDCOMPLEX, shtSTRING};
    107
    108 SerialHelper(const Record& record) : gr(record) { }
    109 SerialHelper(const SerialHelper& other) { gr = other.gr; }
    110 virtual ~SerialHelper() { }
    111
    112 // load the function type name as given in the record's "functype"
    113 // field into the given String <em>ftype</em>. <em>gr</em> is the
    114 // record to extract from. False is returned if the record
    115 // does not contain this field.
    116 // <thrown>
    117 // <li> InvalidSerializationError if "functype" exists but is
    118 // empty or the incorrect type
    119 // </thrown>
    120 Bool getFuncType(String& ftype) const
    121 throw (InvalidSerializationError);
    122
    123 // ensure that the Function type stored in the given record, <em>gr</em>,
    124 // matches <em>ftype</em>. If it does not, an
    125 // InvalidSerializationError is thrown.
    126 void checkFuncType(const String& ftype) const
    127 throw (InvalidSerializationError);
    128
    129 // return True if a field with the given <em>name</em> exists
    130 Bool exists(const String &name) const { return gr.isDefined(name); }
    131
    132 // Get the <em>index</em>th element of the <em>name</em> field
    133 // This should be
    134 // particularly useful for Array objects with only one element,
    135 // i.e. a <em>scalar</em>.
    136 // Note that unlike the native classes, indexing is zero-relative.
    137 //
    138 // InvalidSerializationError is thrown if:
    139 // <ul>
    140 // <li> if the given record does not contain a field called <em>name</em>
    141 // <li> if the field is not a vector of the correct type.
    142 // <li> if the index is out of range.
    143 // </ul>
    144 // <group>
    145 void get(Bool &val, const String& name, uInt index = 0) const
    146 throw (InvalidSerializationError);
    147 // void get(uChar &val, const String& name, uInt index = 0) const
    148 // throw (InvalidSerializationError);
    149 void get(Short &val, const String& name, uInt index = 0) const
    150 throw (InvalidSerializationError);
    151 void get(Int &val, const String& name, uInt index = 0) const
    152 throw (InvalidSerializationError);
    153 void get(Float &val, const String& name, uInt index = 0) const
    154 throw (InvalidSerializationError);
    155 void get(Double &val, const String& name, uInt index = 0) const
    156 throw (InvalidSerializationError);
    157 void get(Complex &val, const String& name, uInt index = 0) const
    158 throw (InvalidSerializationError);
    159 void get(DComplex &val, const String& name, uInt index = 0) const
    160 throw (InvalidSerializationError);
    161 void get(String &val, const String& name, uInt index = 0) const
    162 throw (InvalidSerializationError);
    163 void get(Record &val, const String& name) const
    164 throw (InvalidSerializationError);
    165 // </group>
    166
    167 // Get the <em>index</em>th element of the <em>name</em> field
    168 // This should be
    169 // particularly useful for Array objects with only one element,
    170 // i.e. a <em>scalar</em>.
    171 // Note that unlike the native classes, indexing is zero-relative.
    172 //
    173 // InvalidSerializationError is thrown if:
    174 // <ul>
    175 // <li> if the given record does not contain a field called <em>name</em>
    176 // <li> if the field is not a vector of the correct type.
    177 // <li> if the index is out of range.
    178 // </ul>
    179 // <group>
    180 void get(Array<Bool> &val, const String& name) const
    181 throw (InvalidSerializationError);
    182 // void get(Array<uChar &val, const String& name) const
    183 // throw (InvalidSerializationError);
    184 void get(Array<Short> &val, const String& name) const
    185 throw (InvalidSerializationError);
    186 void get(Array<Int> &val, const String& name) const
    187 throw (InvalidSerializationError);
    188 void get(Array<Float> &val, const String& name) const
    189 throw (InvalidSerializationError);
    190 void get(Array<Double> &val, const String& name) const
    191 throw (InvalidSerializationError);
    192 void get(Array<Complex> &val, const String& name) const
    193 throw (InvalidSerializationError);
    194 void get(Array<DComplex> &val, const String& name) const
    195 throw (InvalidSerializationError);
    196 void get(Array<String> &val, const String& name) const
    197 throw (InvalidSerializationError);
    198 // </group>
    199
    200 SerialHelper& operator=(const SerialHelper& other) {
    201 gr = other.gr;
    202 return *this;
    203 }
    204
    205 protected:
    206 SerialHelper() { }
    207
    208 private:
    209
    210 Record gr;
    211 };
    212
    213
    214 } //# NAMESPACE CASA - END
    215
    216 #endif
Devi accedere o registrarti per scrivere nel forum
2 risposte