lpereira / lwan

Experimental, scalable, high performance HTTP server
https://lwan.ws
GNU General Public License v2.0
5.92k stars 549 forks source link

Debian stable build fails not finding `lua.h` #347

Open nrnrnr opened 2 years ago

nrnrnr commented 2 years ago

I hope I have followed the build instructions correctly. I cannot get lwan to build; it is looking for a lua.h, but there must be an option -I/usr/include/lua5.1 missing somewhere. Cmake finds that Lua 5.1.3 is installed, but make cannot build.

Running on Debian stable (bullseye).

Attached is the full output from cmake and then make in a pristine build directory.

nr@homedog ~/n/l/build> cmake ..
-- The C compiler identification is GNU 10.2.1
-- 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
-- Running CMake for lwan (Scalable, high performance, experimental web server)
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") 
-- No build type selected, defaulting to Debug
-- 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 - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found Python3: /usr/include/python3.9 (found suitable version "3.9.2", minimum required is "3.9") found components: Development Development.Module Development.Embed 
-- Building with WSGI support using 
-- Checking for modules 'luajit>=2.0;luajit<2.2'
--   No package 'luajit' found
--   No package 'luajit' found
-- Checking for modules 'lua>=5.1.0;lua<=5.1.999'
--   Found lua, version 5.1.3
--   Found lua, version 5.1.3
-- Building with Lua support using lua;m;dl
-- Checking for modules 'libbrotlienc;libbrotlidec;libbrotlicommon'
--   Found libbrotlienc, version 1.0.9
--   Found libbrotlidec, version 1.0.9
--   Found libbrotlicommon, version 1.0.9
-- Checking for module 'libzstd'
--   Found libzstd, version 1.4.8
-- Looking for linux/tls.h
-- Looking for linux/tls.h - found
-- mbedTLS not found: not building with TLS support
-- Looking for linux/capability.h
-- Looking for linux/capability.h - found
-- Looking for sys/auxv.h
-- Looking for sys/auxv.h - found
-- Looking for sys/epoll.h
-- Looking for sys/epoll.h - found
-- Looking for 3 include files sys/time.h, ..., sys/event.h
-- Looking for 3 include files sys/time.h, ..., sys/event.h - not found
-- Looking for alloca.h
-- Looking for alloca.h - found
-- Looking for getauxval
-- Looking for getauxval - found
-- Looking for get_current_dir_name
-- Looking for get_current_dir_name - found
-- Looking for reallocarray
-- Looking for reallocarray - found
-- Looking for mempcpy
-- Looking for mempcpy - found
-- Looking for memrchr
-- Looking for memrchr - found
-- Looking for pipe2
-- Looking for pipe2 - found
-- Looking for accept4
-- Looking for accept4 - found
-- Looking for readahead
-- Looking for readahead - found
-- Looking for mkostemp
-- Looking for mkostemp - found
-- Looking for clock_gettime
-- Looking for clock_gettime - found
-- Looking for pthread_barrier_init
-- Looking for pthread_barrier_init - found
-- Looking for pthread_set_name_np
-- Looking for pthread_set_name_np - not found
-- Looking for posix_fadvise
-- Looking for posix_fadvise - found
-- Looking for getentropy
-- Looking for getentropy - found
-- Looking for fwrite_unlocked
-- Looking for fwrite_unlocked - found
-- Looking for gettid
-- Looking for gettid - found
-- Looking for secure_getenv
-- Looking for secure_getenv - found
-- Looking for statfs
-- Looking for statfs - found
-- Looking for syslog
-- Looking for syslog - found
-- Looking for dladdr
-- Looking for dladdr - not found
-- Performing Test LWAN_HAVE_STD_GNU99
-- Performing Test LWAN_HAVE_STD_GNU99 - Success
-- Performing Test LWAN_HAVE_BUILTIN_CPU_INIT
-- Performing Test LWAN_HAVE_BUILTIN_CPU_INIT - Success
-- Performing Test LWAN_HAVE_BUILTIN_EXPECT_PROBABILITY
-- Performing Test LWAN_HAVE_BUILTIN_EXPECT_PROBABILITY - Success
-- Performing Test LWAN_HAVE_BUILTIN_CLZLL
-- Performing Test LWAN_HAVE_BUILTIN_CLZLL - Success
-- Performing Test LWAN_HAVE_BUILTIN_FPCLASSIFY
-- Performing Test LWAN_HAVE_BUILTIN_FPCLASSIFY - Success
-- Performing Test LWAN_HAVE_BUILTIN_MUL_OVERFLOW
-- Performing Test LWAN_HAVE_BUILTIN_MUL_OVERFLOW - Success
-- Performing Test LWAN_HAVE_BUILTIN_ADD_OVERFLOW
-- Performing Test LWAN_HAVE_BUILTIN_ADD_OVERFLOW - Success
-- Performing Test LWAN_HAVE_STATIC_ASSERT
-- Performing Test LWAN_HAVE_STATIC_ASSERT - Success
-- Performing Test LWAN_HAVE_SO_ATTACH_REUSEPORT_CBPF
-- Performing Test LWAN_HAVE_SO_ATTACH_REUSEPORT_CBPF - Success
-- Performing Test LWAN_HAVE_SO_INCOMING_CPU
-- Performing Test LWAN_HAVE_SO_INCOMING_CPU - Success
-- Building with Valgrind support
-- Performing Test LWAN_HAVE_MTUNE_NATIVE
-- Performing Test LWAN_HAVE_MTUNE_NATIVE - Success
-- Performing Test LWAN_HAVE_MARCH_NATIVE
-- Performing Test LWAN_HAVE_MARCH_NATIVE - Success
-- Performing Test LWAN_HAVE_STACK_PROTECTOR_EXPLICIT
-- Performing Test LWAN_HAVE_STACK_PROTECTOR_EXPLICIT - Success
-- Performing Test LWAN_HAVE_IMMEDIATE_BINDING
-- Performing Test LWAN_HAVE_IMMEDIATE_BINDING - Success
-- Performing Test LWAN_HAVE_READ_ONLY_GOT
-- Performing Test LWAN_HAVE_READ_ONLY_GOT - Success
-- Performing Test LWAN_HAVE_NO_PLT
-- Performing Test LWAN_HAVE_NO_PLT - Success
-- Performing Test LWAN_HAVE_NO_PIE
-- Performing Test LWAN_HAVE_NO_PIE - Success
-- Performing Test LWAN_HAVE_NOEXEC_STACK
-- Performing Test LWAN_HAVE_NOEXEC_STACK - Success
-- Building without a sanitizer
-- Performing Test supports -Wduplicated-cond
-- Performing Test supports -Wduplicated-cond - Success
-- Performing Test supports -Wduplicated-branches
-- Performing Test supports -Wduplicated-branches - Success
-- Performing Test supports -Wlogical-op
-- Performing Test supports -Wlogical-op - Success
-- Performing Test supports -Wrestrict
-- Performing Test supports -Wrestrict - Success
-- Performing Test supports -Wdouble-promotion
-- Performing Test supports -Wdouble-promotion - Success
-- Performing Test supports -Wno-unused-parameter
-- Performing Test supports -Wno-unused-parameter - Success
-- Performing Test supports -Wstringop-truncation
-- Performing Test supports -Wstringop-truncation - Success
-- Performing Test supports -Wvla
-- Performing Test supports -Wvla - Success
-- Performing Test supports -Wunsequenced
-- Performing Test supports -Wunsequenced - Failed
-- Performing Test supports -Wno-free-nonheap-object
-- Performing Test supports -Wno-free-nonheap-object - Success
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.9.2", minimum required is "3") 
-- Using built-in context switching routines for x86_64 processors
-- Using Brotli for mimegen
-- Checking for module 'sqlite3>=3.6.20'
--   Found sqlite3, version 3.34.1
-- Not building benchmark suite: database libraries not found.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nr/net/lwan/build
nr@homedog ~/n/l/build> make
Scanning dependencies of target bin2hex
[  1%] Building C object src/bin/tools/CMakeFiles/bin2hex.dir/bin2hex.c.o
[  2%] Linking C executable bin2hex
[  2%] Built target bin2hex
Scanning dependencies of target generate_auto_index_icons
[  3%] Bundling auto-index icons
[  3%] Built target generate_auto_index_icons
Scanning dependencies of target mimegen
[  4%] Building C object src/bin/tools/CMakeFiles/mimegen.dir/mimegen.c.o
[  5%] Building C object src/bin/tools/CMakeFiles/mimegen.dir/__/__/lib/hash.c.o
In file included from /home/nr/net/lwan/src/lib/hash.c:35:
/home/nr/net/lwan/src/lib/lwan-private.h:182:10: fatal error: lua.h: No such file or directory
  182 | #include <lua.h>
      |          ^~~~~~~
compilation terminated.
make[2]: *** [src/bin/tools/CMakeFiles/mimegen.dir/build.make:95: src/bin/tools/CMakeFiles/mimegen.dir/__/__/lib/hash.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:654: src/bin/tools/CMakeFiles/mimegen.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
lpereira commented 1 year ago

That seems like a bug in the Debian package: just looked here and the .pc file provided by liblua-5.1-0-dev has the following line: includedir=${prefix}/include, where prefix is defined to /usr. This would need to be something along the lines of includedir=${prefix}/include/lua5.1.

Please file a bug in Debian.

nrnrnr commented 1 year ago

I'm not seeing an issue with pkg-config (which I use heavily):

nr@homedog ~/e/r/tfp23> pkg-config --cflags lua5.1
-I/usr/include/lua5.1

I attach one of the .pc files in the package. Please notice that although includedir is indeed set to ${prefix}/include, the CFLAGS are set as follows:

Cflags: -I${includedir}/${lib_name_include}

lua51.pc