lammertb / libhttp

Multi platform HTTP and HTTPS library
MIT License
958 stars 131 forks source link

Example 'hello' not building #79

Closed dancesWithCycles closed 1 year ago

dancesWithCycles commented 1 year ago

Hi folks, Thank you so much for providing this repository. I am wondering why the following instructions do not result in a successful build.

cd libhttp
make
cd ./examples/
cd hello/
make
make -C ../.. clean lib
make[1]: Entering directory '/home/begerad/git/github/libhttp'
/bin/rm -f obj/*.o
/bin/rm -f lib/libhttp.a
/bin/rm -f testmime
make[1]: Nothing to be done for 'lib'.
make[1]: Leaving directory '/home/begerad/git/github/libhttp'
cp ../../libcivetweb.a .
cp: cannot stat '../../libcivetweb.a': No such file or directory
make: *** [Makefile:31: libcivetweb.a] Error 1

Did anything change in the meantime that broke this 'hello' example?

I am appreciating any hint making me able to solve this issue. Cheers!

Robin-Wardle commented 1 year ago

Hi, @dancesWithCycles, I have no affiliation to this library but have been following it recently. I am also not any kind of a web server expert.

The library doesn't look to be actively maintained. The examples are for civetweb which libhttp is forked from. None of them work, and fixing them would require updating the Makefiles to find libhttp.a instead of libcivetweb.a, as well as repairing many other problems. For example, if you've built libhttp.a using the Makefile in the project root, it gets deleted by the hello Makefile. Fixing this properly would require fixing the main project Makefile too - you may notice that make lib, make help etc options don't work.

Additionally the API is changed from civetweb and you would need to update the .c file as well (which still has the #include "civetweb.h" directive). For example, in hello.c the struct httplib_connection type has been renamed to struct lh_con_t. There are more things like this that need updating.

The actual httplib.a library does seem to build correctly, and there may be merit in getting everything working again and subsequently updating the repo as a learning exercise. Alternatively you might look at civetweb or mongoose, but note the licensing restrictions (hence the initial reason for httplib). Good luck!

dancesWithCycles commented 1 year ago

Hi @Robin-Wardle , Thank you so much for the heads-up and clarification. Appreciate! Cheers!