You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hello,
I'd like to cross compile this web server for a riscv64 architecture but I have some problems. Current instructions are a bit unclear to me.
HOWEVER you must provide functions to access your sockets. A Posix/Berkeley sockets example is provided (as well as a WinSock example). Therefor you must be able to compile on a Posix system with Berkeley sockets.
what does that mean?
when you say:
So to compile a basic server:
gcc main.c SocketsCon.c FileServer.c WebServer.c -o example.exe
where should I place myself? in src/ there is a main.c but there is not FileServer.c so.. this command will not work. If I move to the hello world example this command is also incorrect. If I use the one on the bat file, I do manage to cross compile it but when I run it I get:
# sh hello_world_server
hello_world_server: line 3: syntax error: unexpected word (expecting ")")
If would be great if you could clarify. Thanks a lot
I have updated the readme to try to make it a bit clearer.
However here is the answers to your questions directly :)
Question 1 HOWEVER you must provide functions to access your sockets. A Posix/Berkeley sockets example is provided (as well as a WinSock example). Therefor you must be able to compile on a Posix system with Berkeley sockets.
what does that mean?
Bitty HTTP is not locked into one socket library, if you have some other kind of sockets library (other than Posix sockets for example) you can connect in to them. I have seen SPI based chips that had very different socket API's. Bitty HTTP was build to support these type of things.
I did provide example use standard Berkeley sockets (and a different one for Windows sockets) in the src/SocketsCon.c file. If you are running on a Linux or other Unix like system you can just use them and not have to worry about the details.
Question 2
when you say:
So to compile a basic server: gcc main.c SocketsCon.c FileServer.c WebServer.c -o example.exe
where should I place myself?
This was a generic example that doesn't work with any of the provided examples. It was assuming that you would copy the needed files to your own directory before compiling.
So if you wanted to use it from the bittyhttp directory you would use:
gcc src/main.c src/SocketsCon.c src/Examples/HelloWorld/FileServer.c src/WebServer.c -o example.exe
This would be for a Linux build.
For windows it would be gcc src\main.c src\SocketsConWin.c src\Examples\HelloWorld\FileServer.c src\WebServer.c -o example.exe -lws2_32
Question 3
# sh hello_world_server
hello_world_server: line 3: syntax error: unexpected word (expecting ")")
Not sure what's going on here. sh is a shell and I'm not sure where hello_world_server came from.
To run the bat / .sh file (for hello world):
Linux:
cd src/Examples/HelloWorld
./build.sh
./HelloWorld.exe
Windows:
cd src/Examples/HelloWorld
build
HelloWorld
The should be all there is to it (assuming that gcc is installed and setup)
Activity
TheBeef commentedon Jan 19, 2024
Hi fabriziotappero,
I have updated the readme to try to make it a bit clearer.
However here is the answers to your questions directly :)
Question 1
HOWEVER you must provide functions to access your sockets. A Posix/Berkeley sockets example is provided (as well as a WinSock example). Therefor you must be able to compile on a Posix system with Berkeley sockets.what does that mean?
Bitty HTTP is not locked into one socket library, if you have some other kind of sockets library (other than Posix sockets for example) you can connect in to them. I have seen SPI based chips that had very different socket API's. Bitty HTTP was build to support these type of things.
I did provide example use standard Berkeley sockets (and a different one for Windows sockets) in the src/SocketsCon.c file. If you are running on a Linux or other Unix like system you can just use them and not have to worry about the details.
Question 2
when you say:
So to compile a basic server: gcc main.c SocketsCon.c FileServer.c WebServer.c -o example.exewhere should I place myself?
This was a generic example that doesn't work with any of the provided examples. It was assuming that you would copy the needed files to your own directory before compiling.
So if you wanted to use it from the bittyhttp directory you would use:
gcc src/main.c src/SocketsCon.c src/Examples/HelloWorld/FileServer.c src/WebServer.c -o example.exeThis would be for a Linux build.
For windows it would be
gcc src\main.c src\SocketsConWin.c src\Examples\HelloWorld\FileServer.c src\WebServer.c -o example.exe -lws2_32Question 3
Not sure what's going on here.
shis a shell and I'm not sure where hello_world_server came from.To run the bat / .sh file (for hello world):
Linux:
Windows:
The should be all there is to it (assuming that gcc is installed and setup)
Hope this helps.
TheBeef commentedon Jan 19, 2024
Oh, you should also check out http://bittyhttp.com/Development.html for more documentation.