Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation issues with goexiv library #9

Open
IGLOU-EU opened this issue Jun 15, 2023 · 4 comments
Open

Compilation issues with goexiv library #9

IGLOU-EU opened this issue Jun 15, 2023 · 4 comments

Comments

@IGLOU-EU
Copy link

Hello,

With exiv2 0.28.0

I encountered an issue while trying to compile the goexiv library. I am receiving numerous errors related to the helper.cpp file. I'm not familiar with C++, but if the error is not too complex and some guidance can be provided, I am willing to attempt a PR to fix the issue. Below are the errors I am encountering:

helper.cpp:22:50: error: expected ‘)’ before ‘image’
   22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
      |                                                  ^~~~~
helper.cpp:10:30: note: in definition of macro ‘DEFINE_STRUCT’
   10 |         _##name(wrapped_type member_name) \
      |                              ^~~~~~~~~~~
helper.cpp:10:16: note: to match this ‘(’
   10 |         _##name(wrapped_type member_name) \
      |                ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
   22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
      | ^~~~~~~~~~~~~
helper.cpp:22:41: error: ‘AutoPtr’ in ‘class Exiv2::Image’ does not name a type
   22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
      |                                         ^~~~~~~
helper.cpp:12:9: note: in definition of macro ‘DEFINE_STRUCT’
   12 |         wrapped_type member_name; \
      |         ^~~~~~~~~~~~
helper.cpp: In constructor ‘_Exiv2Error::_Exiv2Error(const Exiv2::Error&)’:
helper.cpp:60:26: error: cannot convert ‘Exiv2::ErrorCode’ to ‘int’ in initialization
   60 |         : code(error.code())
      |                ~~~~~~~~~~^~
      |                          |
      |                          Exiv2::ErrorCode
helper.cpp: In function ‘Exiv2Image* exiv2_image_factory_open(const char*, Exiv2Error**)’:
helper.cpp:71:67: error: no matching function for call to ‘_Exiv2Image::_Exiv2Image(Exiv2::Image::UniquePtr)’
   71 |                 p = new Exiv2Image(Exiv2::ImageFactory::open(path));
      |                                                                   ^
helper.cpp:9:8: note: candidate: ‘constexpr _Exiv2Image::_Exiv2Image()’
    9 | struct _##name { \
      |        ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
   22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
      | ^~~~~~~~~~~~~
helper.cpp:9:8: note:   candidate expects 0 arguments, 1 provided
    9 | struct _##name { \
      |        ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
   22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
      | ^~~~~~~~~~~~~
helper.cpp:9:8: note: candidate: ‘constexpr _Exiv2Image::_Exiv2Image(const _Exiv2Image&)’
    9 | struct _##name { \
      |        ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
   22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
      | ^~~~~~~~~~~~~
helper.cpp:9:8: note:   no known conversion for argument 1 from ‘Exiv2::Image::UniquePtr’ {aka ‘std::unique_ptr<Exiv2::Image>’} to ‘const _Exiv2Image&’
    9 | struct _##name { \
      |        ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
   22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
      | ^~~~~~~~~~~~~
helper.cpp:9:8: note: candidate: ‘constexpr _Exiv2Image::_Exiv2Image(_Exiv2Image&&)’
    9 | struct _##name { \
      |        ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
   22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
      | ^~~~~~~~~~~~~
helper.cpp:9:8: note:   no known conversion for argument 1 from ‘Exiv2::Image::UniquePtr’ {aka ‘std::unique_ptr<Exiv2::Image>’} to ‘_Exiv2Image&&’
    9 | struct _##name { \
      |        ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
   22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
      | ^~~~~~~~~~~~~
helper.cpp: In function ‘Exiv2Image* exiv2_image_factory_open_bytes(const unsigned char*, long int, Exiv2Error**)’:
helper.cpp:90:74: error: no matching function for call to ‘_Exiv2Image::_Exiv2Image(Exiv2::Image::UniquePtr)’
   90 |                 p = new Exiv2Image(Exiv2::ImageFactory::open(bytes, size));
      |                                                                          ^
helper.cpp:9:8: note: candidate: ‘constexpr _Exiv2Image::_Exiv2Image()’
    9 | struct _##name { \
      |        ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
   22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
      | ^~~~~~~~~~~~~
helper.cpp:9:8: note:   candidate expects 0 arguments, 1 provided
    9 | struct _##name { \
      |        ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
   22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
      | ^~~~~~~~~~~~~
helper.cpp:9:8: note: candidate: ‘constexpr _Exiv2Image::_Exiv2Image(const _Exiv2Image&)’
    9 | struct _##name { \
      |        ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
   22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
      | ^~~~~~~~~~~~~
helper.cpp:9:8: note:   no known conversion for argument 1 from ‘Exiv2::Image::UniquePtr’ {aka ‘std::unique_ptr<Exiv2::Image>’} to ‘const _Exiv2Image&’
    9 | struct _##name { \
      |        ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
   22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
      | ^~~~~~~~~~~~~
helper.cpp:9:8: note: candidate: ‘constexpr _Exiv2Image::_Exiv2Image(_Exiv2Image&&)’
    9 | struct _##name { \
      |        ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
   22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
      | ^~~~~~~~~~~~~
helper.cpp:9:8: note:   no known conversion for argument 1 from ‘Exiv2::Image::UniquePtr’ {aka ‘std::unique_ptr<Exiv2::Image>’} to ‘_Exiv2Image&&’
    9 | struct _##name { \
      |        ^
helper.cpp:22:1: note: in expansion of macro ‘DEFINE_STRUCT’
   22 | DEFINE_STRUCT(Exiv2Image, Exiv2::Image::AutoPtr, image);
      | ^~~~~~~~~~~~~
helper.cpp: In function ‘void exiv2_image_read_metadata(Exiv2Image*, Exiv2Error**)’:
helper.cpp:107:22: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  107 |                 img->image->readMetadata();
      |                      ^~~~~
helper.cpp: In function ‘void exiv2_image_set_exif_string(Exiv2Image*, char*, char*, Exiv2Error**)’:
helper.cpp:118:41: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  118 |         Exiv2::ExifData exifData = img->image->exifData();
      |                                         ^~~~~
helper.cpp:122:31: error: ‘AutoPtr’ is not a member of ‘Exiv2::Value’
  122 |                 Exiv2::Value::AutoPtr valueObject = Exiv2::Value::create(Exiv2::asciiString);
      |                               ^~~~~~~
helper.cpp:123:17: error: ‘valueObject’ was not declared in this scope
  123 |                 valueObject->read(value);
      |                 ^~~~~~~~~~~
helper.cpp:126:22: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  126 |                 img->image->setExifData(exifData);
      |                      ^~~~~
helper.cpp:127:22: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  127 |                 img->image->writeMetadata();
      |                      ^~~~~
helper.cpp: In function ‘void exiv2_image_set_exif_short(Exiv2Image*, char*, char*, Exiv2Error**)’:
helper.cpp:138:41: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  138 |         Exiv2::ExifData exifData = img->image->exifData();
      |                                         ^~~~~
helper.cpp:142:31: error: ‘AutoPtr’ is not a member of ‘Exiv2::Value’
  142 |                 Exiv2::Value::AutoPtr valueObject = Exiv2::Value::create(Exiv2::unsignedShort);
      |                               ^~~~~~~
helper.cpp:143:17: error: ‘valueObject’ was not declared in this scope
  143 |                 valueObject->read(value);
      |                 ^~~~~~~~~~~
helper.cpp:146:22: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  146 |                 img->image->setExifData(exifData);
      |                      ^~~~~
helper.cpp:147:22: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  147 |                 img->image->writeMetadata();
      |                      ^~~~~
helper.cpp: In function ‘void exiv2_image_set_iptc_string(Exiv2Image*, char*, char*, Exiv2Error**)’:
helper.cpp:158:41: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  158 |         Exiv2::IptcData iptcData = img->image->iptcData();
      |                                         ^~~~~
helper.cpp:165:22: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  165 |                 img->image->setIptcData(iptcData);
      |                      ^~~~~
helper.cpp:166:22: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  166 |                 img->image->writeMetadata();
      |                      ^~~~~
helper.cpp: In function ‘void exiv2_image_set_iptc_short(Exiv2Image*, char*, char*, Exiv2Error**)’:
helper.cpp:177:37: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  177 |     Exiv2::IptcData iptcData = img->image->iptcData();
      |                                     ^~~~~
helper.cpp:181:23: error: ‘AutoPtr’ is not a member of ‘Exiv2::Value’
  181 |         Exiv2::Value::AutoPtr valueObject = Exiv2::Value::create(Exiv2::unsignedShort);
      |                       ^~~~~~~
helper.cpp:182:9: error: ‘valueObject’ was not declared in this scope
  182 |         valueObject->read(value);
      |         ^~~~~~~~~~~
helper.cpp:185:14: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  185 |         img->image->setIptcData(iptcData);
      |              ^~~~~
helper.cpp:186:14: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  186 |         img->image->writeMetadata();
      |              ^~~~~
helper.cpp: In function ‘long int exiv_image_get_size(Exiv2Image*)’:
helper.cpp:197:23: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  197 |     return (long)img->image->io().size();
      |                       ^~~~~
helper.cpp: In function ‘unsigned char* exiv_image_get_bytes_ptr(Exiv2Image*)’:
helper.cpp:203:17: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  203 |     return img->image->io().mmap();
      |                 ^~~~~
helper.cpp: In function ‘int exiv2_image_get_pixel_width(Exiv2Image*)’:
helper.cpp:210:21: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  210 |         return img->image->pixelWidth();
      |                     ^~~~~
helper.cpp: In function ‘int exiv2_image_get_pixel_height(Exiv2Image*)’:
helper.cpp:214:21: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  214 |         return img->image->pixelHeight();
      |                     ^~~~~
helper.cpp: In function ‘const unsigned char* exiv2_image_icc_profile(Exiv2Image*)’:
helper.cpp:219:18: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  219 |         if (img->image->iccProfileDefined()) {
      |                  ^~~~~
helper.cpp:220:29: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  220 |                 return img->image->iccProfile()->pData_;
      |                             ^~~~~
helper.cpp: In function ‘long int exiv2_image_icc_profile_size(Exiv2Image*)’:
helper.cpp:227:18: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  227 |         if (img->image->iccProfileDefined()) {
      |                  ^~~~~
helper.cpp:228:29: error: ‘Exiv2Image’ {aka ‘struct _Exiv2Image’} has no member named ‘image’
  228 |                 return img->image->iccProfile()->size_;
      |                             ^~~~~
helper.cpp: In function ‘Exiv2XmpData* exiv2_image_get_xmp_data(const Exiv2Image*)’:
helper.cpp:237:38: error: ‘const Exiv2Image’ {aka ‘const struct _Exiv2Image’} has no member named ‘image’
  237 |         return new Exiv2XmpData(img->image->xmpData());
      |                                      ^~~~~
helper.cpp: In function ‘Exiv2IptcData* exiv2_image_get_iptc_data(const Exiv2Image*)’:
helper.cpp:284:39: error: ‘const Exiv2Image’ {aka ‘const struct _Exiv2Image’} has no member named ‘image’
  284 |         return new Exiv2IptcData(img->image->iptcData());
      |                                       ^~~~~
helper.cpp: In function ‘Exiv2ExifData* exiv2_image_get_exif_data(const Exiv2Image*)’:
helper.cpp:354:39: error: ‘const Exiv2Image’ {aka ‘const struct _Exiv2Image’} has no member named ‘image’
  354 |         return new Exiv2ExifData(img->image->exifData());
      |                                       ^~~~~

Please let me know if you have any suggestions or guidance on how to approach this issue, and if there are any additional details needed.

Thank you!

@dmitridb
Copy link

dmitridb commented Aug 4, 2023

I had to downgrade to libexiv 0.27

@dmitridb
Copy link

dmitridb commented Aug 4, 2023

I think this would be a good place for us to look for starters:

https://github.com/Exiv2/exiv2/blob/v0.28.0/doc/ChangeLog

I'm not a big c++ programmer so I'm just plodding through the stacktrace but it looks like some stuff like some data structures got changed:

helper.cpp:22:41: error: ‘AutoPtr’ in ‘class Exiv2::Image’ does not name a type
helper.cpp:354:39: error: ‘const Exiv2Image’ {aka ‘const struct _Exiv2Image’} has no member named ‘image’

@antonsergeyev
Copy link
Contributor

antonsergeyev commented Aug 6, 2023

Hey, thanks for reporting this.
I expected the C library to break compatibility sooner or later. As of now, I think the rational solution is just to stick with 0.27, unless you really need some newer features.

We don't have the need or resources to update right now. And ultimately I'd rather work with a pure go library instead of integrating with exiv2.
This might be a good place to start: https://github.com/dsoprea/go-exif
There are 2 problems with that library though:

  • last time I checked it only provided methods for reading exif data, not writing
  • it seems to have issues with reading data in exiv2 format, e.g. written by this library

Might be worth trying to open an issue there and see what does the author think.

@dmitridb
Copy link

dmitridb commented Aug 7, 2023

From what I understand the problem space of EXIF data is pretty complex and there's probably a reason that people don't really go and reinvent that wheel. It's a problem of a bunch of manufacturers releasing stuff with differing standards on how they exactly represent that data from what I understand, which is why we don't really have a working native go lib. From what I understand that one you linked has enough crashing issues that it's a problem in production, so that's why we went with this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants