← Back to team overview

kicad-developers team mailing list archive

Re: strtok_r not detected properly

 

Le 12/03/2014 17:28, David Novak a écrit :
> 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?
> 
> Thanks,
> David

TDM-GCC defines strtok_r in pthread.h instead of string.h (which is not
usual)
strtok_r is defined from strtok, which is not reentrant.

Core developers are thinking this is an issue in TDM-GCC, not in Kicad.

The best is to comment the define in pthread.h (this is what I made)

-- 
Jean-Pierre CHARRAS


Follow ups

References