Bug #3181
closedMeson / CMake build issues
Description
Trying out Meson I noticed it does not install the man pages.
Trying out CMake I see there is not an equivalent of the lua_version
option to select a specific release of Lua. As well as the following error..
CMake Error at CMakeLists.txt:26 (add_subdirectory):
The source directory
/home/ports/pobj/lighttpd-1.4.68/lighttpd-1.4.68/doc
does not contain a CMakeLists.txt file.
Updated by gstrauss 24 days ago
- Status changed from New to Patch Pending
Trying out Meson I noticed it does not install the man pages.
This is known. Nobody has added the feature yet.
CMake Error at CMakeLists.txt:26 (add_subdirectory):
/home/ports/pobj/lighttpd-1.4.68/lighttpd-1.4.68/doc does not contain a CMakeLists.txt file.
That was added in
https://git.lighttpd.net/lighttpd/lighttpd1.4/commit/f98cc6743821b8bfa342dabb9a7d5a06ce6b93fe
However, it looks like it might not be part of the tar bar. This should fix that (for the next lighttpd release):
--- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -3,6 +3,7 @@ dist_man8_MANS=lighttpd.8 lighttpd-angel.8 GNUMAKEFLAGS=--no-print-directory -s EXTRA_DIST= \ + CMakeLists.txt \ initscripts.txt \ newstyle.css \ oldstyle.css
Updated by gstrauss 24 days ago
- Status changed from Patch Pending to Fixed
Applied in changeset 909401f4f2dfde61183dfc16991ccdddbdac342f.
Updated by brad@comstyle.com 24 days ago
There was also this part I think you missed..
Trying out CMake I see there is not an equivalent of the lua_version
option to select a specific release of Lua.
Both autoconf and meson have this functionality.
Updated by brad@comstyle.com 24 days ago
Another issue I noticed with CMake.
-- found mysql_config: /usr/local/bin/mysql_config -- Looking for include file mysql.h -- Looking for include file mysql.h - not found
xconfig(mysql_config MYSQL_LDFLAGS MYSQL_CFLAGS) set(CMAKE_REQUIRED_INCLUDES /usr/include/mysql) check_include_files(mysql.h HAVE_MYSQL_H) set(CMAKE_REQUIRED_INCLUDES)
With the hardcoded path. Instead of using the path that I see would be retrieved via mysql_config.
Updated by gstrauss 24 days ago
With the removal years ago of mod_authn_mysql and the requirement to specify --with-mysql
or equivalent to build lighttpd modules which depend on mysql, this patch is probably simpler:
--- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -333,15 +333,8 @@ endif() if(WITH_MYSQL) xconfig(mysql_config MYSQL_LDFLAGS MYSQL_CFLAGS) - - set(CMAKE_REQUIRED_INCLUDES /usr/include/mysql) - check_include_files(mysql.h HAVE_MYSQL_H) - set(CMAKE_REQUIRED_INCLUDES) - if(HAVE_MYSQL_H) - check_library_exists(mysqlclient mysql_real_connect "" HAVE_MYSQL) - endif() + check_library_exists(mysqlclient mysql_real_connect "" HAVE_MYSQL) else() - unset(HAVE_MYSQL_H) unset(HAVE_MYSQL) endif() @@ -1003,7 +996,7 @@ if(WITH_MAXMINDDB) target_link_libraries(mod_maxminddb maxminddb) endif() -if(HAVE_MYSQL_H AND HAVE_MYSQL) +if(HAVE_MYSQL) add_and_install_library(mod_vhostdb_mysql "mod_vhostdb_mysql.c") target_link_libraries(mod_vhostdb_mysql mysqlclient) include_directories(/usr/include/mysql)
Updated by gstrauss 24 days ago
cmake -DWITH_LUA_VERSION=...
--- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -37,6 +37,7 @@ option(WITH_KRB5 "with Kerberos5-support for mod_auth [default: off]") option(WITH_LDAP "with LDAP-support for mod_auth mod_vhostdb_ldap [default: off]") option(WITH_PAM "with PAM-support for mod_auth [default: off]") option(WITH_LUA "with lua for mod_magnet [default: off]") +option(WITH_LUA_VERSION "specify lua version for mod_magnet") # option(WITH_VALGRIND "with internal support for valgrind [default: off]") option(WITH_FAM "fam/gamin for reducing number of stat() calls [default: off]") option(WITH_LIBDEFLATE "with libdeflate-support for mod_deflate [default: off]") @@ -757,7 +758,11 @@ else() endif() if(WITH_LUA) - pkg_search_module(LUA REQUIRED lua5.4 lua-5.4 lua5.3 lua-5.3 lua5.2 lua-5.2 lua5.1 lua-5.1 lua) + if(WITH_LUA_VERSION) + pkg_search_module(LUA REQUIRED ${WITH_LUA_VERSION}) + else() + pkg_search_module(LUA REQUIRED lua5.4 lua-5.4 lua5.3 lua-5.3 lua5.2 lua-5.2 lua5.1 lua-5.1 lua) + endif() message(STATUS "found lua at: INCDIR: ${LUA_INCLUDE_DIRS} LIBDIR: ${LUA_LIBRARY_DIRS} LDFLAGS: ${LUA_LDFLAGS} CFLAGS: ${LUA_CFLAGS}") set(HAVE_LUA_H 1 "Have liblua header") else()
Updated by brad@comstyle.com 24 days ago
That's IMO worse (than fixing the hardcoded path). autoconf will look for libmariadb, then fallback to libmysqlclient and then mysql_config, but the more important part when looking for the libraries is utilizing the pkg-config file. CMake just looks for libmariadb.
Updated by brad@comstyle.com 24 days ago
The Lua diff works and does as expected. Thanks.
Updated by gstrauss 24 days ago
That's IMO worse (than fixing the hardcoded path). autoconf will look for libmariadb, then fallback to libmysqlclient and then mysql_config, but the more important part when looking for the libraries is utilizing the pkg-config file. CMake just looks for libmariadb.
The code in lighttpd src/CMakeLists.txt
uses a custom macro named XCONFIG
defined earlier in src/CMakeLists.txt
.
In the case of mysql, the macro looks for mysql_config
and uses that. mysql_config
is present on my system and configurd to use mariadb.
Maybe the XCONFIG
macro could be extended if not sufficient? (Patches welcome.)
Updated by gstrauss 24 days ago
I think you're referring to the linecheck_library_exists(mysqlclient mysql_real_connect "" HAVE_MYSQL)
which did not change in the path other than leading whitespace indenting, so the limitation has not changed.
My Fedora Linux system provides the following for compatibility
/usr/lib64/libmysqlclient_r.so -> libmariadb.so.3 /usr/lib64/libmysqlclient.so -> libmariadb.so.3
Can CMake use ${MYSQL_LDFLAGS}
returned from mysql_config --libs
when checking for mysql_real_connect
?
Alternatively, is the test largely redundant due to the existence (or not) of mysql_config
?
Updated by gstrauss 24 days ago
Would you prefer this?
--- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -334,7 +334,9 @@ endif() if(WITH_MYSQL) xconfig(mysql_config MYSQL_LDFLAGS MYSQL_CFLAGS) - check_library_exists(mysqlclient mysql_real_connect "" HAVE_MYSQL) + if(MYSQL_LDFLAGS) + set(HAVE_MYSQL TRUE) + endif() else() unset(HAVE_MYSQL) endif()
Updated by brad@comstyle.com 24 days ago
With that it finds mysql_config and then does nothing with MYSQL_CFLAGS / MYSQL_LDFLAGS; the module is enabled but the builds fails.
Oh, also staring at the CMake file I noticed this line..
include_directories(/usr/include/mysql)
Updated by gstrauss 24 days ago
Sigh. More historical hard-coding of mysqlclient
.
--- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1003,8 +1005,8 @@ endif() if(HAVE_MYSQL) add_and_install_library(mod_vhostdb_mysql "mod_vhostdb_mysql.c") - target_link_libraries(mod_vhostdb_mysql mysqlclient) - include_directories(/usr/include/mysql) + add_target_properties(mod_vhostdb_mysql COMPILE_FLAGS ${MYSQL_CFLAGS}) + target_link_libraries(mod_vhostdb_mysql ${MYSQL_LDFLAGS}) endif() if(HAVE_PGSQL)
(Edit: updated patch above to add use of
MYSQL_CFLAGS
)Updated by brad@comstyle.com 23 days ago
Thank you. The updated bit for CFLAGS handling does the trick.
Also available in: Atom