Error in building Free RTOS demo project for Xilinx Zynq-7000 (dual core ARM Cortex-A9) SoC Port

varunrajaseka wrote on Thursday, August 22, 2019:

Hello Team,

I tried to build the demo project for Zynq ZC702 board in Xilinx SDK. And I encountered the following error:

./src/lwIP_Demo/lwIP_Apps/apps/httpserver_raw_from_lwIP_download/httpd.c:375:1: error: static declaration of ‘strnstr’ follows non-static declaration

and so the build failed with following error:

src/lwIP_Demo/lwIP_Apps/apps/httpserver_raw_from_lwIP_download/ recipe for target ‘src/lwIP_Demo/lwIP_Apps/apps/httpserver_raw_from_lwIP_download/httpd.o’ failed

I just tried to remove the keyword “static” for strnstr function in httpd.c file and compiled again , it was successful.So I am not sure of what exactly is causing this error. And furthermore I set the macro **mainSELECTED_APPLICATION **to 0, to build Blinky project,so what is the necessity for the build to take IwIP files for compilation(I am not sure of the background details as I am new to FreeRTOS).

Any help to give a better undertanding is welcome!!

Link to other threads dealing with the same error will be helpful!!

Thanks in Advance!!

Varun Rajasekaran

varunrajaseka wrote on Thursday, August 22, 2019:

Hello Team,

when I tried to find the root cause for it,I came across the following.

The function is declared with the following prototype in string.h file in the compiler:
char *strnstr(const char , const char , size_t) _pure;

And string.h has been included in the httpd.c file and has been declared as static as follows:

/ Like strstr but does not need ‘buffer’ to be NULL-terminated /
static char

strnstr(const char
buffer, const char
token, size_t n)

So the error mentioned in the above post occurs everytime the demo project is compiled.

So what exactly should be done to avoid the error?

Is it fine to remove the static keyword and proceed with the compilation?

Or is there any other right justification?

Varun Rajasekaran

rtel wrote on Thursday, August 22, 2019:

I have never seen this issue. Are you building as C++ as I’ve only ever built as C. Don’t see a problem with removing static qualifier other than normally we prefer not to update third party files.

varunrajaseka wrote on Thursday, August 22, 2019:

Hello Richard,

Thanks for your reply!!

I just followed the steps as mentioned in the . So I am really not sure by what you are referring to building as C++. I have not made any changes to the file format too.

Kindly clarify!!

Varun Rajasekaran

heinbali01 wrote on Thursday, August 22, 2019:

Hi Varun, the error message that you encounter comes from third-party sources files, from lwIP.
When I google for “lwIP httpd.c”, I hit upon a source file that makes heavy use of a function or a macro called lwip_strnstr.
Can you “grep” in your source tree for all occasions of “strnstr” or “lwip_strnstr”?
I’m sure that you will find the answer to your question when doing so.

heinbali01 wrote on Thursday, August 22, 2019:

Hm, sorry, I hadn’t read your second message, only the first and the last.
It looks like you have to define either LWIP_HTTPD_STRNSTR_PRIVATE or BSD_VISIBLE, depending on whether the standard strnstr() is available.

But once again, this is not a problem related to AWS/FreeRTOS.