Project

General

Profile

Bug #804

build failure in basicio.cpp - headers

Added by Pavel Heimlich over 7 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
build
Target version:
Start date:
22 Jan 2012
Due date:
% Done:

0%

Estimated time:

Description

cd src && /usr/bin/gmake
gmake1: Entering directory `/var/tmp/exiv2/exiv2-0.22/src'
libtool: compile: /opt/test2/SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3/bin/CC -library=stdcxx4 -lCrun -xldscope=hidden -I. "-DEXV_LOCALEDIR=\"/usr/local/share/locale\"" -I../xmpsdk/include -c -DEXV_BUILDING_LIB=1 basicio.cpp -KPIC -DPIC -o .libs/basicio.o
"basicio.cpp", line 105: Error: Type name expected instead of "FILE".
"basicio.cpp", line 197: Error: Formal argument 1 of type _FILE* in call to std::fseek(_FILE*, long, int) is being passed int.
"basicio.cpp", line 202: Error: Formal argument 1 of type _FILE* in call to std::ftell(_FILE*) is being passed int.
"basicio.cpp", line 206: Error: Formal argument 1 of type _FILE* in call to std::fclose(_FILE*) is being passed int.
"basicio.cpp", line 218: Error: Cannot assign _FILE* to int.
"basicio.cpp", line 221: Error: Formal argument 1 of type __FILE* in call to std::fseek(
_FILE*, long, int) is being passed int.
"basicio.cpp", line 333: Error: The function "fileno" must have a prototype.
"basicio.cpp", line 487: Error: Formal argument 4 of type _FILE* in call to std::fwrite(const void*, unsigned, unsigned, __FILE*) is being passed int.
"basicio.cpp", line 502: Error: Formal argument 4 of type __FILE* in call to std::fwrite(const void*, unsigned, unsigned, __FILE*) is being passed int.
"basicio.cpp", line 532: Error: remove is not a member of file level.
"basicio.cpp", line 582: Error: The function "memset" must have a prototype.
"basicio.cpp", line 634: Error: remove is not a member of file level.
"basicio.cpp", line 640: Error: remove is not a member of file level.
"basicio.cpp", line 719: Error: The function "putc" must have a prototype.
"basicio.cpp", line 734: Error: Formal argument 1 of type __FILE* in call to std::fseek(
_FILE*, long, int) is being passed int.
"basicio.cpp", line 740: Error: Formal argument 1 of type _FILE* in call to std::ftell(_FILE*) is being passed int.
"basicio.cpp", line 747: Error: Formal argument 1 of type _FILE* in call to std::fflush(_FILE*) is being passed int.
"basicio.cpp", line 779: Error: fopen is not a member of file level.
"basicio.cpp", line 795: Error: Formal argument 1 of type _FILE* in call to std::fclose(_FILE*) is being passed int.
"basicio.cpp", line 814: Error: Formal argument 4 of type __FILE* in call to std::fread(void*, unsigned, unsigned, __FILE*) is being passed int.
"basicio.cpp", line 821: Error: The function "getc" must have a prototype.
"basicio.cpp", line 826: Error: The function "ferror" must have a prototype.
"basicio.cpp", line 832: Error: The function "feof" must have a prototype.
23 Error(s) detected.
gmake1: * [basicio.o] Error 1
gmake1: Leaving directory `/var/tmp/exiv2/exiv2-0.22/src'
gmake: *
[all] Error 2

I used the below changes to get past this:
--- a/src/basicio.cpp Sun Jan 22 22:33:55 2012 0000
++ b/src/basicio.cpp Sun Jan 22 23:12:05 2012 0000
@ -45,9 +45,9 @
#include <string>
#include <memory>
#include <iostream>
#include <cstring>
#include <string.h>
#include <cassert>
#include <cstdio> // for remove, rename
+#include <stdio.h> // for remove, rename
#include <cstdlib> // for alloc, realloc, free
#include <sys/types.h> // for stat, chmod
#include <sys/stat.h> // for stat, chmod

Solaris 11, Solaris Studio 12.3, x86

History

#1

Updated by Pavel Heimlich over 7 years ago

similarly in
libtool: compile: /opt/test2/SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3/bin/CC -library=stdcxx4 -lCrun -xldscope=hidden -I. "-DEXV_LOCALEDIR=\"/usr/local/share/locale\"" -I../xmpsdk/include -c -DEXV_BUILDING_LIB=1 bmpimage.cpp -KPIC -DPIC -o .libs/bmpimage.o
"bmpimage.cpp", line 158: Error: The function "memcmp" must have a prototype.
1 Error(s) detected.

--- a/src/bmpimage.cpp Sun Jan 22 22:33:55 2012 0000
++ b/src/bmpimage.cpp Sun Jan 22 23:14:53 2012 +0000
@ -45,7 +45,7 @

// + standard includes
#include &lt;string&gt;
-#include &lt;cstring&gt;
+#include &lt;string.h&gt;
#include &lt;iostream&gt;
// *********************************************************************

libtool: compile: /opt/test2/SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3/bin/CC -library=stdcxx4 -lCrun -xldscope=hidden -I. "-DEXV_LOCALEDIR=\"/usr/local/share/locale\"" -I../xmpsdk/include -c -DEXV_BUILDING_LIB=1 canonmn.cpp -KPIC -DPIC -o .libs/canonmn.o
"canonmn.cpp", line 1344: Error: The function "log" must have a prototype.

diff r fb3992b87b7d src/canonmn.cpp
--
a/src/canonmn.cpp Sun Jan 22 22:33:55 2012 0000
++ b/src/canonmn.cpp Sun Jan 22 23:15:53 2012 0000
@ -46,7 +46,7 @
#include <algorithm>
#include <cassert>
#include <cstring>
-#include <cmath>
#include <math.h>

// *********************************************************************
// class member definitions

libtool: compile: /opt/test2/SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3/bin/CC -library=stdcxx4 -lCrun -xldscope=hidden -I. "-DEXV_LOCALEDIR=\"/usr/local/share/locale\"" -I../xmpsdk/include -c -DEXV_BUILDING_LIB=1 convert.cpp -KPIC -DPIC -o .libs/convert.o
"../xmpsdk/include/XMP_Environment.h", line 30: Warning (Anachronism): Attempt to redefine _FILE_OFFSET_BITS without using #undef.
"convert.cpp", line 1334: Error: The function "strcmp" must have a prototype.
"convert.cpp", line 1513: Error: The function "strcmp" must have a prototype.
2 Error(s) and 1 Warning(s) detected.

diff r fb3992b87b7d src/convert.cpp
--
a/src/convert.cpp Sun Jan 22 22:33:55 2012 0000
++ b/src/convert.cpp Sun Jan 22 23:17:31 2012 +0000
@ -50,6 +50,7 @ # define snprintf _snprintf
#endif
#include <cstring>
+#include <strings.h>

#if defined WIN32 && !defined CYGWIN
 # include &lt;windows.h&gt;

/opt/test2/SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3/bin/CC -library=stdcxx4 -lCrun -xldscope=hidden -I. "-DEXV_LOCALEDIR=\"/usr/local/share/locale\"" -I../xmpsdk/include -c -DEXV_BUILDING_LIB=1 cr2image.cpp -KPIC -DPIC -o .libs/cr2image.o
"cr2image.cpp", line 238: Error: The function "memcmp" must have a prototype.

diff r fb3992b87b7d src/cr2image.cpp
--
a/src/cr2image.cpp Sun Jan 22 22:33:55 2012 0000
++ b/src/cr2image.cpp Sun Jan 22 23:18:44 2012 0000
@ -51,6 +51,7 @
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string.h>

// *********************************************************************
// class member definitions
#2

Updated by Pavel Heimlich over 7 years ago

also
libtool: compile: /opt/test2/SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3/bin/CC -library=stdcxx4 -lCrun -xldscope=hidden -I. "-DEXV_LOCALEDIR=\"/usr/local/share/locale\"" -I../xmpsdk/include -c -DEXV_BUILDING_LIB=1 crwimage.cpp -KPIC -DPIC -o .libs/crwimage.o
"crwimage.cpp", line 665: Error: hex is not a member of std.
"crwimage.cpp", line 665: Error: right is not a member of std.
"crwimage.cpp", line 682: Error: hex is not a member of std.
"crwimage.cpp", line 682: Error: right is not a member of std.
"crwimage.cpp", line 684: Error: hex is not a member of std.
"crwimage.cpp", line 684: Error: right is not a member of std.
"crwimage.cpp", line 686: Error: dec is not a member of std.
7 Error(s) detected.
gmake: *** [crwimage.o] Error 1

diff r fb3992b87b7d src/crwimage.cpp
--
a/src/crwimage.cpp Sun Jan 22 22:33:55 2012 0000
++ b/src/crwimage.cpp Sun Jan 22 23:22:59 2012 0000
@ -60,6 +60,7 @
#include <ctime>
#include <cmath>
#include <cassert>
#include <ios> // for std::hex
#ifndef EXV_HAVE_TIMEGM # include "timegm.h"
#endif
@ -1035,7 +1036,8 @
if (ifdId == canonSiId) {
// Exif.Photo.FNumber
float f = fnumber(canonEv(aperture));
- URational ur = floatToRationalCast(f);
+ Rational ur0 = floatToRationalCast(f);
+ URational ur( ur0.first, ur0.second );
URationalValue fn;
fn.value_.push_back(ur);
image.exifData().add(ExifKey("Exif.Photo.FNumber"), &fn);

libtool: compile: /opt/test2/SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3/bin/CC -library=stdcxx4 -lCrun -xldscope=hidden -I. "-DEXV_LOCALEDIR=\"/usr/local/share/locale\"" -I../xmpsdk/include -c -DEXV_BUILDING_LIB=1 datasets.cpp -KPIC -DPIC -o .libs/datasets.o
"datasets.cpp", line 497: Error: right is not a member of std.
"datasets.cpp", line 498: Error: hex is not a member of std.
"datasets.cpp", line 542: Error: hex is not a member of std.
"datasets.cpp", line 554: Error: right is not a member of std.
"datasets.cpp", line 555: Error: hex is not a member of std.
"datasets.cpp", line 576: Error: hex is not a member of std.
"datasets.cpp", line 681: Error: The function "strcmp" must have a prototype.
"datasets.cpp", line 719: Error: dec is not a member of std.
"datasets.cpp", line 721: Error: right is not a member of std.
"datasets.cpp", line 721: Error: hex is not a member of std.
"datasets.cpp", line 723: Error: boolalpha is not a member of std.
"datasets.cpp", line 725: Error: dec is not a member of std.

diff r fb3992b87b7d src/datasets.cpp
--
a/src/datasets.cpp Sun Jan 22 22:33:55 2012 0000
++ b/src/datasets.cpp Sun Jan 22 23:24:23 2012 0000
@ -41,6 +41,8 @
#include <iostream>
#include <iomanip>
#include <sstream>
#include <ios> // for std::hex
+#include <strings.h>

// *********************************************************************
// class member definitions

libtool: compile: /opt/test2/SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3/bin/CC -library=stdcxx4 -lCrun -xldscope=hidden -I. "-DEXV_LOCALEDIR=\"/usr/local/share/locale\"" -I../xmpsdk/include -c -DEXV_BUILDING_LIB=1 easyaccess.cpp -KPIC -DPIC -o .libs/easyaccess.o
"easyaccess.cpp", line 122: Error: The function "strcmp" must have a prototype.

diff r fb3992b87b7d src/easyaccess.cpp
--
a/src/easyaccess.cpp Sun Jan 22 22:33:55 2012 0000
++ b/src/easyaccess.cpp Sun Jan 22 23:25:29 2012 0000
@ -32,6 +32,7 @
// *********************************************************************
// included header files
#include "easyaccess.hpp"
#include <strings.h>

// *********************************************************************
namespace {

libtool: compile: /opt/test2/SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3/bin/CC -library=stdcxx4 -lCrun -xldscope=hidden -I. "-DEXV_LOCALEDIR=\"/usr/local/share/locale\"" -I../xmpsdk/include -c -DEXV_BUILDING_LIB=1 epsimage.cpp -KPIC -DPIC -o .libs/epsimage.o
"epsimage.cpp", line 150: Error: The function "memcmp" must have a prototype.
"epsimage.cpp", line 214: Error: The function "memcmp" must have a prototype.
"epsimage.cpp", line 227: Error: The function "memcmp" must have a prototype.
"epsimage.cpp", line 242: Error: The function "memcmp" must have a prototype.
"epsimage.cpp", line 283: Error: The function "memcmp" must have a prototype.
"epsimage.cpp", line 283: Error: The function "memcmp" must have a prototype.
"epsimage.cpp", line 1121: Error: The function "memcmp" must have a prototype.
"epsimage.cpp", line 1123: Error: The function "memcmp" must have a prototype.
8 Error(s) detected.

--- a/src/epsimage.cpp Sun Jan 22 22:33:55 2012 0000
++ b/src/epsimage.cpp Sun Jan 22 23:26:25 2012 0000
@ -54,6 +54,7 @
#include <iostream>
#include <sstream>
#include <string>
#include <strings.h>

// *********************************************************************
namespace {

libtool: compile: /opt/test2/SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3/bin/CC -library=stdcxx4 -lCrun -xldscope=hidden -I. "-DEXV_LOCALEDIR=\"/usr/local/share/locale\"" -I../xmpsdk/include -c -DEXV_BUILDING_LIB=1 futils.cpp -KPIC -DPIC -o .libs/futils.o
"futils.cpp", line 104: Error: The function "strerror_r" must have a prototype.
1 Error(s) detected.

--- a/src/futils.cpp Sun Jan 22 22:33:55 2012 0000
++ b/src/futils.cpp Sun Jan 22 23:28:01 2012 0000
@ -52,6 +52,7 @
#include <cerrno>
#include <sstream>
#include <cstring>
#include <string.h>

#if defined EXV_HAVE_STRERROR_R && !defined EXV_HAVE_DECL_STRERROR_R
 # ifdef EXV_STRERROR_R_CHAR_P

libtool: compile: /opt/test2/SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3/bin/CC -library=stdcxx4 -lCrun -xldscope=hidden -I. "-DEXV_LOCALEDIR=\"/usr/local/share/locale\"" -I../xmpsdk/include -c -DEXV_BUILDING_LIB=1 gifimage.cpp -KPIC -DPIC -o .libs/gifimage.o
"gifimage.cpp", line 138: Error: The function "memcmp" must have a prototype.
"gifimage.cpp", line 139: Error: The function "memcmp" must have a prototype.
2 Error(s) detected.

--- a/src/gifimage.cpp Sun Jan 22 22:33:55 2012 0000
++ b/src/gifimage.cpp Sun Jan 22 23:29:08 2012 0000
@ -47,6 +47,7 @
#include <string>
#include <cstring>
#include <iostream>
#include <string.h>

// *********************************************************************
// class member definitions

libtool: compile: /opt/test2/SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3/bin/CC -library=stdcxx4 -lCrun -xldscope=hidden -I. "-DEXV_LOCALEDIR=\"/usr/local/share/locale\"" -I../xmpsdk/include -c -DEXV_BUILDING_LIB=1 jp2image.cpp -KPIC -DPIC -o .libs/jp2image.o
"jp2image.cpp", line 242: Error: The function "memcmp" must have a prototype.
"jp2image.cpp", line 263: Error: The function "memcmp" must have a prototype.
"jp2image.cpp", line 294: Error: The function "memcmp" must have a prototype.
"jp2image.cpp", line 313: Error: The function "memcmp" must have a prototype.
"jp2image.cpp", line 445: Error: The function "memcpy" must have a prototype.
"jp2image.cpp", line 487: Error: The function "memcpy" must have a prototype.
"jp2image.cpp", line 488: Error: The function "memcpy" must have a prototype.
"jp2image.cpp", line 493: Error: The function "memcpy" must have a prototype.
"jp2image.cpp", line 494: Error: The function "memcpy" must have a prototype.
"jp2image.cpp", line 495: Error: The function "memcpy" must have a prototype.
"jp2image.cpp", line 496: Error: The function "memcpy" must have a prototype.
"jp2image.cpp", line 516: Error: The function "memcpy" must have a prototype.
"jp2image.cpp", line 517: Error: The function "memcpy" must have a prototype.
"jp2image.cpp", line 518: Error: The function "memcpy" must have a prototype.
"jp2image.cpp", line 519: Error: The function "memcpy" must have a prototype.
"jp2image.cpp", line 546: Error: The function "memcpy" must have a prototype.
"jp2image.cpp", line 547: Error: The function "memcpy" must have a prototype.
"jp2image.cpp", line 548: Error: The function "memcpy" must have a prototype.
"jp2image.cpp", line 549: Error: The function "memcpy" must have a prototype.
"jp2image.cpp", line 563: Error: The function "memcmp" must have a prototype.
"jp2image.cpp", line 569: Error: The function "memcmp" must have a prototype.
"jp2image.cpp", line 575: Error: The function "memcmp" must have a prototype.
"jp2image.cpp", line 630: Error: The function "memcmp" must have a prototype.
23 Error(s) detected.

--- a/src/jp2image.cpp Sun Jan 22 22:33:55 2012 0000
++ b/src/jp2image.cpp Sun Jan 22 23:29:58 2012 0000
@ -52,7 +52,7 @
#include <cstring>
#include <iostream>
#include <cassert>
-
#include <string.h>
// JPEG-2000 box types
const uint32_t kJp2BoxTypeJp2Header = 0x6a703268; // 'jp2h'
const uint32_t kJp2BoxTypeImageHeader = 0x69686472; // 'ihdr'

libtool: compile: /opt/test2/SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3/bin/CC -library=stdcxx4 -lCrun -xldscope=hidden -I. "-DEXV_LOCALEDIR=\"/usr/local/share/locale\"" -I../xmpsdk/include -c -DEXV_BUILDING_LIB=1 jpgimage.cpp -KPIC -DPIC -o .libs/jpgimage.o
"jpgimage.cpp", line 130: Error: The function "memcmp" must have a prototype.
"jpgimage.cpp", line 347: Error: The function "memcmp" must have a prototype.
"jpgimage.cpp", line 369: Error: The function "memcmp" must have a prototype.
"jpgimage.cpp", line 389: Error: The function "memcmp" must have a prototype.
"jpgimage.cpp", line 564: Error: The function "memcmp" must have a prototype.
"jpgimage.cpp", line 575: Error: The function "memcmp" must have a prototype.
"jpgimage.cpp", line 582: Error: The function "memcmp" must have a prototype.
"jpgimage.cpp", line 796: Error: Could not find a match for Exiv2::find<Exiv2::T, Exiv2::K, Exiv2::N>(int*, int*, int) needed in Exiv2::JpegBase::doWriteMetadata(Exiv2::BasicIo&).
"jpgimage.cpp", line 942: Error: The function "memcmp" must have a prototype.
9 Error(s) detected.

#3

Updated by Andreas Huggel about 7 years ago

  • Status changed from New to Feedback

I'd like to understand the root cause of this better. Simply replacing <cstring> with <string.h> might result in errors with other compiler which do not declare std::fseek etc. then. Can the problem be fixed differently?

#4

Updated by Pavel Heimlich about 7 years ago

I'm not sure, I'm not a programmer. Either one could ifdef the includes, but that would be quite ugly, or perhaps use something like autotools to get the correct headers.

#5

Updated by Andreas Huggel about 7 years ago

I feel this is an issue for which there should be a common solution for all compilers. Does it work if you change the headers as suggested and also change std::fseek et al. to ::fseek? That would be more in-line with the C++ standard.

#6

Updated by Robin Mills almost 6 years ago

  • Category set to build
  • Status changed from Feedback to Closed
  • Assignee set to Robin Mills
  • Target version set to 0.24

I am closing this issue as I believe it is resolved in the 0.24 release. If you disagree, please file a new issue on dev.exiv2.org (and if possible, please reference this issue).

Also available in: Atom PDF