kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #12677
Re: strtok_r not detected properly
On 03/12/2014 11:28 AM, David Novak wrote:
> When building Pcbnew, I get an error message indicating that strtok_r is
> being redefined. The offending code is in kicad_string.h.
>
> #ifndef HAVE_STRTOKR
> // common/strtok_r.c optionally:
> extern "C" char* strtok_r( char* str, const char* delim, char** nextp );
> #endif
>
> I tracked HAVE_STRTOKR to an auto detection inside
> PerformFeatureChecks.cmake.
>
> check_symbol_exists( strtok_r "string.h" HAVE_STRTOKR )
>
> Fore some reason, this check is failing even though strtok_r is defined.
> Presumably, the check is looking in the wrong file. I tried adjusting
> this line, but without success.
>
> As a quick fix I added
>
> #define HAVE_STRTOKR
>
> just prior to the check in kicad_string.h.
>
> I'm on Windows using TDM-GCC 4.8.1-3.
>
> What is the correct check_symbol_exists() line to fix this problem?
We concluded there's an edit needed in one of your TDC-GCC compiler headers. It provides
an insufficient strtok_r, one which is not re-entrant, and therefore needs to be commented
out on your compiler header.
I consider it a bug in the compiler header, and it should be removed with a patch and sent
upstream.
strtok_r() must be a re-entrant function, else it is a lie.
Follow ups
References