Home/Support/Support Forum/CGI and AWS together
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

CGI and AWS together

0 votes

I am having difficulty getting CGI and AWS to work together.

Any tips how exactly to do this?

I took an AWS sample project and the tried to copied in the cgi.c file from the CGI sample.

In my root.c project I have the following includes
#include <appservices.h> #include <http_awsapi.h>

When I include the cgi.c to be compiled I get the following errors. Any advice?
./sys/http/cgi.o: In function `RpUserExitInit': cgi.c:(.text+0x0): multiple definition of `RpUserExitInit' ./cgi.o:cgi.c:(.text+0x0): first defined here ./sys/http/cgi.o: In function `RpUserExitDeInit': cgi.c:(.text+0x20): multiple definition of `RpUserExitDeInit' ./cgi.o:cgi.c:(.text+0x20): first defined here ./sys/http/cgi.o: In function `RpExternalCgi': cgi.c:(.text+0x38): multiple definition of `RpExternalCgi' ./cgi.o:cgi.c:(.text+0x138): first defined here /usr/lib/gcc/arm-elf/4.2.0/../../../../arm-elf/bin/ld: Warning: size of symbol `RpExternalCgi' changed from 456 in ./cgi.o to 32 in ./sys/http/cgi.o collect2: ld returned 1 exit status make: *** [image.elf] Error 1 make: Target `all' not remade because of errors.
asked Feb 15, 2012 in NET+OS by gpotter New to the Community (2 points)
recategorized Dec 4, 2013 by tuxembb

Please log in or register to answer this question.

2 Answers

0 votes
Hi, here is my part of my cgi.c
#include "AsExtern.h" #include "RpCgi.h" int RpUserExitInit(void *theTaskDataPtr) { return 0; } int RpUserExitDeInit() { return 0; } void RpExternalCgi(void *theDataPtr, rpCgiPtr theCgiPtr) { char ok = 0; char * ptr; if (theCgiPtr->fHttpRequest == eRpCgiHttpGet || theCgiPtr->fHttpRequest == eRpCgiHttpPost) { theCgiPtr->fResponseBufferPtr = 0; //config/sceneSet.cgi // config/sceneSel.cgi if (strncmp(theCgiPtr->fPathPtr, "/config/sceneSet.cgi", 21) == 0) // { setScene(theCgiPtr->fArgumentBufferPtr); ok = 1; } if (ok) { theCgiPtr->fHttpResponse = eRpCgiHttpOk; theCgiPtr->fResponseState = eRpCgiLastBuffer; if (theCgiPtr->fResponseBufferPtr == 0) { theCgiPtr->fResponseBufferPtr = (char *) CGI_RESPONSE_TEXT; theCgiPtr->fResponseBufferLength = sizeof(CGI_RESPONSE_TEXT); } } else { int len; len = sprintf( txt, "<html><head><title>Page not found</title></head><body>HTTP: 404 Page (%s) not found</body></html>", theCgiPtr->fPathPtr); theCgiPtr->fHttpResponse = eRpCgiHttpOk; theCgiPtr->fResponseState = eRpCgiLastBuffer; theCgiPtr->fResponseBufferPtr = txt; theCgiPtr->fResponseBufferLength = strlen(txt); } }

answered Mar 30, 2012 by kubiajir Community Contributor (61 points)
0 votes
"When I include the cgi.c to be compiled I get the following errors. Any advice? "

Since you have a sys directory I will conclude that you created a NET+OS project as opposed to a NET+OS sample application. Further I will infur that in creating the project, you included HTTP as a service. From what I can see when you do this, the sys directory has a subdirectory called http. This http directory alrady contains a cgi.c file. If you also added a cgi.c file to the top level directory of your project, then you would get linker errors of multiple definitions as you describe in the earlier posting.

So either remove the cgi.c from the sys\http directory or better yet, instead of added cgi.c to your upper level directory, use the cgi.c in sys\http as your cgi.c
answered Aug 15, 2012 by dakotas_dad Veteran of the Digi Community (694 points)