[x265] Build failure on MinGW GCC 4.7.1 x64, revision 288a83d

Nikos Barkas nikbar2004 at yahoo.com
Tue Mar 4 00:21:15 CET 2014


It is actually even simpler than that. Only the macro needs to be defined, string_s.h is automatically included after that. So it can be:

#ifdef __MINGW32__
#define MINGW_HAS_SECURE_API 1
#endif

The only catch seems to be that these three lines must be at the start of the file, before other includes.

Best regards
Nikos



On Monday, March 3, 2014 11:15 PM, Nikos Barkas <nikbar2004 at yahoo.com> wrote:
 
The strtok_s function is the secure api variant of strtok. For MinGW-w64, which is what I am using - on Windows 7, not Linux - using secure api functions requires some work done in advance. The following needs to be inserted at the beginning of param.cpp:

#ifdef __MINGW32__
#define MINGW_HAS_SECURE_API1
#include <sec_api/string_s.h>
#endif

The macro MINGW_HAS_SECURE_API must be defined and string_s.h must be specifically included. With the above, x265 can be compiled successfully.

Best regards
Nikos



On Monday, March 3, 2014 8:13 PM, Steve Borho <steve at borho.org> wrote:
 
On Mon, Mar 3, 2014 at 1:29 AM, Nikos Barkas <nikbar2004 at yahoo.com> wrote:

> Building tip revision 288a83d fails with this message on MinGW x64:
>
> c:/x265/source/common/param.cpp: In function 'int x265::parseCpuName(const
> char*, bool&)':
> c:/DriveD/x265Project/x265/source/common/param.cpp:738:59: error: 'strtok_s'
> was not declared in this scope
> make[2]: *** [common/CMakeFiles/common.dir/param.cpp.obj] Error 1
> make[1]: *** [common/CMakeFiles/common.dir/all] Error 2
> make: *** [all] Error 2

Odd.  My MinGW wouldn't build with strtok_r, it needed the Windows strtok_s.

Hmm, so I either need to detect this function at configure time, or
just implement it internally.

Perhaps this one: http://stackoverflow.com/questions/12975022/strtok-r-for-mingw

Just curious, but is your MinGW hosted on Linux? I'm curious why yours
does not see strtok_s.

-- 
Steve Borho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20140303/060f6a19/attachment.html>


More information about the x265-devel mailing list