babelouest / ulfius

Web Framework to build REST APIs, Webservices or any HTTP endpoint in C language. Can stream large amount of data, integrate JSON data with Jansson, and create websocket services
https://babelouest.github.io/ulfius
GNU Lesser General Public License v2.1
1.08k stars 182 forks source link

I'm trying to run this source file on Ubuntu18.04, getting an make error( fatal error: gnutls/gnutls.h: No such file or directory #include <gnutls/gnutls.h>) #225

Open shivagittool opened 2 years ago

shivagittool commented 2 years ago

1).I have downloaded this source code and try to build on Ubuntu 18.04, I'm facing an error ( ./include/ulfius.h:43:12: fatal error: gnutls/gnutls.h: No such file or directory #include <gnutls/gnutls.h>) If I try to comment the particular line number and try to make, I'm getting some other header file issue.

2).kindly requesting you to provide us Ubuntu (18.04)installation steps.

3) log

user@BLTSL03275:~/ulfius-master$ make cd ./src && make make[1]: Entering directory '/home/user/ulfius-master/src' Config file ../include/ulfius-cfg.h generated JANSSON SUPPORT ENABLED CURL SUPPORT ENABLED GNUTLS SUPPORT ENABLED WEBSOCKET SUPPORT DISABLED YDER SUPPORT ENABLED FREERTOS SUPPORT DISABLED LWIP SUPPORT DISABLED gcc -c -pedantic -std=gnu99 -fPIC -Wall -Werror -Wextra -D_REENTRANT -I../include -O3 ulfius.c In file included from ../include/u_private.h:46:0, from ulfius.c:25: ../include/ulfius.h:43:12: fatal error: gnutls/gnutls.h: No such file or directory

include <gnutls/gnutls.h>

        ^~~~~~~~~~~~~~~~~

compilation terminated. Makefile:183: recipe for target 'ulfius.o' failed make[1]: [ulfius.o] Error 1 make[1]: Leaving directory '/home/user/ulfius-master/src' Makefile:30: recipe for target 'all' failed make: [all] Error 2

babelouest commented 2 years ago

Hello @shivagittool ,

It seems that you don't have GnuTLS installed, in your Ubuntu 18.04, you can run this command:

$ sudo apt install libgnutls28-dev

Alternatively, as mentionned in the Install documentation, you can disable GnuTLS if you don't need https or websocket support.

$ make GNUTLSFLAG=1
shivagittool commented 2 years ago

Thank you for your support @babelouest Still I'm facing same make issue.

1) sudo apt install libgnutls28-dev It is already installed.

user@BLTSL03275:~/ulfius-master$ sudo apt install libgnutls28-dev [sudo] password for user: Reading package lists... Done Building dependency tree
Reading state information... Done libgnutls28-dev is already the newest version (3.5.18-1ubuntu1.5). The following package was automatically installed and is no longer required: golang-1.13-src Use 'sudo apt autoremove' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 185 not upgraded.

2) make GNUTLSFLAG=1

user@BLTSL03275:~/ulfius-master$ make GNUTLSFLAG=1 cd ./src && make make[1]: Entering directory '/home/user/ulfius-master/src' gcc -c -pedantic -std=gnu99 -fPIC -Wall -Werror -Wextra -D_REENTRANT -I../include -O3 ulfius.c In file included from ../include/u_private.h:46:0, from ulfius.c:25: ../include/ulfius.h:48:10: fatal error: jansson.h: No such file or directory

include

      ^~~~~~~~~~~

compilation terminated. Makefile:183: recipe for target 'ulfius.o' failed make[1]: [ulfius.o] Error 1 make[1]: Leaving directory '/home/user/ulfius-master/src' Makefile:30: recipe for target 'all' failed make: [all] Error 2

shivagittool commented 2 years ago

user@BLTSL03275:~/ulfius-master$ make cd ./src && make make[1]: Entering directory '/home/user/ulfius-master/src' gcc -c -pedantic -std=gnu99 -fPIC -Wall -Werror -Wextra -D_REENTRANT -I../include -O3 ulfius.c In file included from ../include/u_private.h:46:0, from ulfius.c:25: ../include/ulfius.h:48:10: fatal error: jansson.h: No such file or directory

include

      ^~~~~~~~~~~

compilation terminated. Makefile:183: recipe for target 'ulfius.o' failed make[1]: [ulfius.o] Error 1 make[1]: Leaving directory '/home/user/ulfius-master/src' Makefile:30: recipe for target 'all' failed make: [all] Error 2

shivagittool commented 2 years ago

After installing all the dependencies test.c is running. 1) I'm trying to get the data using URL http://localhost:8080/helloworld and http://192.168.141.43/helloworld I'm able to receive the data.

2) I have tried to get the data from other network, I can't able to get the data.

3) how could I create URL to access data from different network

babelouest commented 2 years ago

As mentioned in the documentation, if you don't use a parameter struct sockaddr_in * bind_address in the ulfius_init_instance, your ulfius instance should listen to all adresses.

So if you can't access your ulfius instance from a different network, the problem shouldn't come from your program, but from elsewhere.

shivagittool commented 2 years ago

Thank you for your support @babelouest, I need to run this REST APP on Centos 7, I tried to install the dependencies on Centos 7, facing many more issues. plz share me if you have those installation steps for Centos 7.