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

Implicit declaration of function ‘o_strnullempty’ #231

Closed 2kPi closed 2 years ago

2kPi commented 2 years ago

Describe the issue Trying to compiling with make into ulfius/example_programs/simple_example folder

To Reproduce make into ulfius/example_programs/simple_example folder

Expected behavior Compiling without error

Screenshots image `

I tried to re install library but without any great result.

Thanks for the help

babelouest commented 2 years ago

o_strnullempty is a function included in orcania, one of Ulfius' dependencies.

I assume that is you have installed ulfius, you also have installed orcania and yder, but your error message suggests orcania isn't installed in /usr/lib or /usr/local/lib. If so, you can use cmake to build example programs instead of Makefile, see https://github.com/babelouest/ulfius/tree/master/example_programs#cmake---multi-architecture

babelouest commented 2 years ago

@2kPi , any update?

le-cardinal commented 1 year ago

got the same issue on ubuntu 22.04: toto@68Q9433:~/examples/ulfius/example_programs/simple_example$ make cd ../../src && make debug CURLFLAG=1 GNUTLSFLAG=1 make[1]: Entering directory '/home/eccf/examples/ulfius/src' gcc -c -pedantic -std=gnu99 -fPIC -Wall -Werror -Wextra -Wconversion -D_REENTRANT -I../include -DDEBUG -g -O0 ulfius.c ulfius.c: In function ‘ulfius_webservice_dispatcher’: ulfius.c:743:30: error: implicit declaration of function ‘o_strnullempty’ [-Werror=implicit-function-declaration] 743 | if (!o_strnullempty(extension)) { | ^~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:197: ulfius.o] Error 1 make[1]: Leaving directory '/home/toto/examples/ulfius/src' make: *** [Makefile:37: ../../src/libulfius.so] Error 2

whereas ulfius and orcania libs are well installed on my ubuntu: toto@68Q9433:~/examples/ulfius/example_programs/simple_example$ ldconfig -p | grep ulfius libulfius.so.2.7 (libc6,x86-64) => /lib/x86_64-linux-gnu/libulfius.so.2.7 libulfius.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libulfius.so toto@68Q9433:~/examples/ulfius/example_programs/simple_example$ ldconfig -p | grep orcania liborcania.so.2.2 (libc6,x86-64) => /lib/x86_64-linux-gnu/liborcania.so.2.2 liborcania.so (libc6,x86-64) => /lib/x86_64-linux-gnu/liborcania.so

got the same as well when trying to build with cmake cmake .. -- The C compiler identification is GNU 11.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Looking for __GNU_LIBRARY__ -- Looking for __GNU_LIBRARY__ - found -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Found Ulfius: /usr/lib/x86_64-linux-gnu/libulfius.so (found version "2.7.7") -- Found Ulfius: /usr/lib/x86_64-linux-gnu/libulfius.so (found suitable version "2.7.7", minimum required is "2.6") -- Found Yder: /usr/lib/x86_64-linux-gnu/libyder.so (found version "2.0.8") -- Websocket support: ON -- Outgoing requests support: ON -- Jansson library support: ON -- Yder library support: -- Configuring done -- Generating done -- Build files have been written to: /home/eccf/examples/ulfius/example_programs/build eccf@68Q9433:~/examples/ulfius/example_programs/build$ make [ 3%] Building C object CMakeFiles/simple_example.dir/simple_example/simple_example.c.o [ 6%] Linking C executable simple_example [ 6%] Built target simple_example [ 9%] Building C object CMakeFiles/multiple_callbacks_example.dir/multiple_callbacks_example/multiple_callbacks_example.c.o [ 12%] Linking C executable multiple_callbacks_example [ 12%] Built target multiple_callbacks_example [ 15%] Building C object CMakeFiles/stream_example.dir/stream_example/stream_example.c.o [ 18%] Linking C executable stream_example [ 18%] Built target stream_example [ 21%] Building C object CMakeFiles/test_u_map.dir/test_u_map/test_u_map.c.o [ 24%] Linking C executable test_u_map [ 24%] Built target test_u_map [ 27%] Building C object CMakeFiles/stream_client.dir/stream_example/stream_client.c.o [ 30%] Linking C executable stream_client [ 30%] Built target stream_client [ 33%] Building C object CMakeFiles/injection_example.dir/injection_example/injection_example.c.o [ 36%] Linking C executable injection_example [ 36%] Built target injection_example [ 39%] Building C object CMakeFiles/sheep_counter.dir/sheep_counter/sheep_counter.c.o [ 42%] Building C object CMakeFiles/sheep_counter.dir/home/eccf/examples/ulfius/example_callbacks/static_compressed_inmemory_website/static_compressed_inmemory_website_callback.c.o /home/eccf/examples/ulfius/example_callbacks/static_compressed_inmemory_website/static_compressed_inmemory_website_callback.c: In function ‘callback_static_file_uncompressed’: /home/eccf/examples/ulfius/example_callbacks/static_compressed_inmemory_website/static_compressed_inmemory_website_callback.c:184:35: error: implicit declaration of function ‘o_strnullempty’ [-Werror=implicit-function-declaration] 184 | if (file_requested == NULL || o_strnullempty(file_requested) || 0 == o_strcmp("/", file_requested)) { | ^~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[2]: *** [CMakeFiles/sheep_counter.dir/build.make:90: CMakeFiles/sheep_counter.dir/home/eccf/examples/ulfius/example_callbacks/static_compressed_inmemory_website/static_compressed_inmemory_website_callback.c.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:267: CMakeFiles/sheep_counter.dir/all] Error 2 make: *** [Makefile:91: all] Error 2

Please re-open the issue

babelouest commented 1 year ago

I answered the question below, did you try to cleanup your old versions of orcania and yder?

pablomtzunc commented 1 year ago

Manual installation fixed: https://github.com/babelouest/ulfius/blob/master/INSTALL.md#manual-install