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.07k stars 183 forks source link

Unable to disable gnutls during make #199

Closed elockman closed 2 years ago

elockman commented 2 years ago

I am trying to install Ulfius on an embedded system, but had issues with a GnuTLS dependency not being found. As a quick work-around I tried to build without GnuTLS, but had the following error:

../include/ulfius.h:43:12: fatal error: gnutls/gnutls.h: No such file or directory

root@sama5d2-board:/test/ulfius# make GNUTLSFLAG=1
cd ./src && make
make[1]: Entering directory '/test/ulfius/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:29,
                 from ulfius.c:30:
../include/ulfius.h:43:12: fatal error: gnutls/gnutls.h: No such file or directory
   43 |   #include <gnutls/gnutls.h>
      |            ^~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:183: ulfius.o] Error 1
make[1]: Leaving directory '/test/ulfius/src'
make: *** [Makefile:30: all] Error 2
root@sama5d2-board:/test/ulfius#

Looking at the ulfius.h file, the header file is wrapped with U_DISABLE_GNUTLS

#ifndef U_DISABLE_GNUTLS
  #ifndef _GNU_SOURCE
    #define _GNU_SOURCE
  #endif
  #include <gnutls/gnutls.h>
  #include <gnutls/x509.h>
#endif

I am using gcc version 9.3.0 (GCC) on a Microchip sama5d27 development board

Should I be using a different build flag, or is there something else going on?

Thanks, in advance.

elockman commented 2 years ago

This is not a bug. It was resolved by cleaning the project before rebuilding

make clean
make GNUTLSFLAG=1
babelouest commented 2 years ago

eb55873d1b191b4099423a60bd088118

Good call, happy hacking! :)