Bug 54851

Summary: Fix for the build using mingw64
Product: poppler Reporter: Alexey Pavlov <alexpux>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: i.nixman
Version: unspecified   
Hardware: All   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch to fix build

Description Alexey Pavlov 2012-09-13 09:40:37 UTC
Created attachment 67086 [details]
Patch to fix build

When build poppler with mingw64 тeed to check whether there is a winpthreads definition because it include strtok_r declaration.
Comment 1 Albert Astals Cid 2012-09-13 16:56:29 UTC
mingw64 defines __MINGW32__ ?
Comment 2 Alexey Pavlov 2012-09-13 17:10:54 UTC
Yes.
Comment 3 niXman 2012-09-14 07:08:04 UTC
> When build poppler with mingw64 тeed to check whether there is a winpthreads
> definition because it include strtok_r declaration.

More information: strtok_r in winpthread is declared as a macro, that is why the error happens. Therefore, it is necessary to check whether the macro __WINPTHREADS_VERSION is declared. If so, it is necessary to undefine the strtok_r macro.

Also, it is possible not to use the declaration/implementation of the strtok_r function provided by poppler, and use the strtok_r macro provided by winpthread. But here I'm not sure how it would be better...

P.S.
This error occurs only when using the MinGW compiled with '--enable-threads=posix', for example, produced as part of MinGW-builds project: https://sourceforge.net/projects/mingwbuilds/
Comment 4 niXman 2012-09-14 14:42:10 UTC
Can someone from the developers answer me, whether this patch will be accepted, and if so, when?
Comment 5 Albert Astals Cid 2012-09-14 15:06:17 UTC
7 hours and you're already complaining? You need to learn a bit of patience if you want to keep contributing to free software projects.

As answer to your question it'd be better if the implementation of strtok_r in mingw was according to standards.

I'll commit Alexey's patch today or tomorrow depending on how life goes, you are free to suggest a bettef implementation in a different bug if you feel like.
Comment 6 Albert Astals Cid 2012-09-15 18:40:47 UTC
Commited

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.