Bug #1150

Unable to build for Mac OSX 10.6

Added by Max Pozdeev almost 6 years ago. Updated almost 6 years ago.

Target version:
Start date:
09 Jan 2016
Due date:
% Done:


Estimated time:
2.00 h


I can not build the library from latest revision for the Mac OSX 10.6.
I'm using a Mac with OSX 10.10 64bit, so I put the line "-stdlib=libstdc++ -mmacosx-version-min=10.6" into CPPFLAGS, LDFLAGS, etc.
The error:

actions.cpp:1973:26: error: no viable conversion from 'const std::string' (aka 'const basic_string<char>')
      to 'const char *'
/Applications/ note: 
      passing argument to parameter '__s' here
      open(const char* __s, ios_base::openmode __mode);

Related issues

Related to Exiv2 - Feature #1149: Support for metadata in FLIR One thermal images (jpeg)New09 Jan 2016


Associated revisions

Revision 4177 (diff)
Added by Robin Mills almost 6 years ago

#1150. Fixed build breaker on elderly Macs (10.6 and earlier).



Updated by Robin Mills almost 6 years ago

  • Category set to build
  • Status changed from New to Assigned
  • Assignee set to Robin Mills
  • Target version set to 0.26
  • % Done changed from 0 to 50
  • Estimated time set to 2.00 h

Max. Thanks for letting me know about this. I was very surprised by this because I obtained that code from a very credible source:

The quick fix is to change: (target,std::ios::out);
to: (target.c_str(),std::ios::out);
However, I'm uneasy about that. c_str() is a legacy thing and should be avoided. I'll have a proper look at this on Sunday.


Updated by Robin Mills almost 6 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 50 to 100

Fix submitted: r4177

Good News, this code was broken on the buildsever. I submitted the code and went to the movies. It had only been on the trunk for an hour when you raised this matter. So, I would have discovered this when I got home from the movies!

I've replaced the filebuf code in src/actions.cpp:

std::filebuf fb; (target.c_str(),std::ios::out);
std::ostream os(&fb);
std::ofstream os;;
Which is shorter and more obvious. I need the c_str() on Tiger and Cygwin. It may be possible to detect the version of STL and only include the c_str() when essential, however I'll investigate that possibility if a bug is reported which implicates this code. For the moment it builds and passes the test suite on our supported platforms.


Updated by Max Pozdeev almost 6 years ago

Thank you, it works.


Updated by Robin Mills almost 6 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF