bugpng++, a C++ wrapper for libpng - Bugs: bug #46312, Compilation fails on MacOS X with...

 
 

bug #46312: Compilation fails on MacOS X with g++ 5.2 (MacPorts)

Submitter:  None
Submitted:  Wed 28 Oct 2015 03:31:34 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  alexshulgin
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 20 Jul 2019 09:48:41 AM UTC, comment #6: 

And now version 0.2.10 is released, which includes this fix.  Thanks everyone!

Alexander Shulgin <alexshulgin>
Group administrator
Sat 20 Jul 2019 05:58:41 AM UTC, comment #5: 
Alexander Shulgin <alexshulgin>
Group administrator
Fri 19 Jul 2019 02:02:46 PM UTC, comment #4: 

I have the same issue on MacOS with png++ 0.2.9. The patch posted by Adam does fix the issue. I'm trying to update the Homebrew formula with this patch, but I would rather have a new release with this fix integrated upstream.

From a quick survey of different implementation of the libC, including Darwin's, BSD's and Android Bionic's, this check should not cause further issues.

Thank you,
Jean-Francois

Jean-Francois Simoneau <jfsimoneau>
Sun 22 Jul 2018 08:43:59 PM UTC, comment #3: 

It is not abandoned, though might look like so. :(
Hosting on Savannah instead of popular choices like github is not accidental.

Now to the actual problem.  It turns out to be surprisingly hard to get error reporting code work on all platforms and what I used to do is to trust people who come with patch that fixes problem for them on their platform and at the same time doesn't break it for me...

Now what is your platform and which version of png++ are you using?

Regards,
--
Alex

Alexander Shulgin <alexshulgin>
Group administrator
Sat 21 Jul 2018 07:31:59 PM UTC, comment #2: 

Thanx Adam! Fix is working like a charm. Can someone migrate this old repo to GitHub? It looks abandoned.

Anonymous
Sun 08 May 2016 07:36:43 AM UTC, comment #1: 

Just encountered this issue as well.  Unfortunately the posted .hpp file introduces a subtle new problem.  Under the default Linux/glibc config, the return value of strerror_r() is required to be used, and this change disregards it, so you'll get invalid data instead of error messages under Linux if you use this proposed fix.

Instead, if you change the conditions so that _GLIBC_ is required before using the GNU version, then it will only use that function when linked with glibc.  When compiling with Clang's libc++, _GLIBC_ won't be defined and you'll get the version with the ignored return value.

I have used Travis CI to test this change with both Clang and GCC under both Linux and OSX, and it compiles successfully.


diff -Nru png++-0.2.9/error.hpp png++-0.2.9-patched/error.hpp
--- png++-0.2.9/error.hpp       2015-10-26 05:42:45.000000000 +1000
+++ png++-0.2.9-patched/error.hpp       2016-05-08 16:56:43.967446201 +1000
@@ -100,7 +100,7 @@
             strerror_s(buf, ERRBUF_SIZE, errnum);
             return std::string(buf);
 #else
-#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE
+#if ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) || (!__GLIBC__)
             strerror_r(errnum, buf, ERRBUF_SIZE);
             return std::string(buf);
 #else


Adam Nielsen <malvineous>
Wed 28 Oct 2015 03:31:34 PM UTC, original submission:  

Reason: strerror_r() is used with a char* return type.

I suggest using the variant that ignores the return value
and a really large buffer size.  The attached code works.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #35325:  error.hpp added by None (3KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jfsimoneau (Posted a comment)
  • -email is unavailable- added by alexshulgin (Posted a comment)
  • -email is unavailable- added by malvineous (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-07-20 alexshulgin StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2019-07-20 alexshulgin StatusNone In Progress
        Assigned toNone alexshulgin
    2015-10-28 None Attached File- Added error.hpp, #35325

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code