Project

General

Profile

Actions

Bug #3203

closed

static build fails due to missing algo_hmac

Added by desmana 11 months ago. Updated 11 months ago.

Status:
Fixed
Priority:
Normal
Category:
build_autotools
Target version:
ASK QUESTIONS IN Forums:
Yes

Description

When building Lighttpd with autotools, LIGHTTPD_STATIC=yes and Lua, algo_hmac.o seems to be missing from the link phase, resulting in an error: undefined reference to `li_hmac_md5'.

To reproduce in Alpine Linux container:

apk add --update --no-cache autoconf automake make libtool gcc musl-dev lua-dev pcre2-dev
wget https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.70.tar.gz
tar -xf lighttpd-1.4.70.tar.gz
cd lighttpd-1.4.70
LIGHTTPD_STATIC=yes ./configure --with-lua
touch src/plugins-static.h # to just continue with the build
make

Relevant output:

libtool: link: gcc -g -O2 -pipe -Wall -W -Wshadow -pedantic -o lighttpd lighttpd-server.o lighttpd-response.o lighttpd-connections.o lighttpd-h1.o lighttpd-h2.o lighttpd-sock_addr_cache.o lighttpd-network.o lighttpd-network_write.o ls-hpack/lighttpd-lshpack.o lighttpd-algo_xxhash.o lighttpd-fdevent_impl.o lighttpd-http_range.o lighttpd-data_config.o lighttpd-configfile.o lighttpd-configparser.o lighttpd-base64.o lighttpd-buffer.o lighttpd-burl.o lighttpd-log.o lighttpd-http_header.o lighttpd-http_kv.o lighttpd-keyvalue.o lighttpd-chunk.o lighttpd-http_chunk.o lighttpd-fdevent.o lighttpd-fdevent_fdnode.o lighttpd-gw_backend.o lighttpd-stat_cache.o lighttpd-http_etag.o lighttpd-array.o lighttpd-algo_md5.o lighttpd-algo_sha1.o lighttpd-algo_splaytree.o lighttpd-configfile-glue.o lighttpd-http-header-glue.o lighttpd-http_cgi.o lighttpd-http_date.o lighttpd-plugin.o lighttpd-reqpool.o lighttpd-request.o lighttpd-sock_addr.o lighttpd-rand.o lighttpd-fdlog_maint.o lighttpd-fdlog.o lighttpd-sys-setjmp.o lighttpd-ck.o lighttpd-fdevent_win32.o lighttpd-fs_win32.o lighttpd-mod_access.o lighttpd-mod_accesslog.o lighttpd-mod_ajp13.o lighttpd-mod_alias.o lighttpd-mod_auth.o lighttpd-mod_auth_api.o lighttpd-mod_authn_file.o lighttpd-mod_cgi.o lighttpd-mod_deflate.o lighttpd-mod_dirlisting.o lighttpd-mod_evhost.o lighttpd-mod_expire.o lighttpd-mod_extforward.o lighttpd-mod_fastcgi.o lighttpd-mod_indexfile.o lighttpd-mod_proxy.o lighttpd-mod_redirect.o lighttpd-mod_rewrite.o lighttpd-mod_rrdtool.o lighttpd-mod_scgi.o lighttpd-mod_setenv.o lighttpd-mod_simple_vhost.o lighttpd-mod_sockproxy.o lighttpd-mod_ssi.o lighttpd-mod_staticfile.o lighttpd-mod_status.o lighttpd-mod_userdir.o lighttpd-mod_vhostdb.o lighttpd-mod_vhostdb_api.o lighttpd-mod_webdav.o lighttpd-mod_magnet.o lighttpd-mod_magnet_cache.o -Wl,--export-dynamic  -lpcre2-8 -lz -llua -lm
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: lighttpd-mod_magnet.o: in function `magnet_hmac_once':
/lighttpd-1.4.70/src/mod_magnet.c:867: undefined reference to `li_hmac_md5'

Possible fix (diff against master):

diff --git a/src/Makefile.am b/src/Makefile.am
index 95d5e076..bbc98ac9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -433,8 +433,7 @@ lighttpd_SOURCES += mod_maxminddb.c
 lighttpd_LDADD += $(MAXMINDDB_LIB)
 endif
 if BUILD_WITH_LUA
-lighttpd_SOURCES += mod_magnet.c mod_magnet_cache.c
-                    #algo_hmac.c
+lighttpd_SOURCES += mod_magnet.c mod_magnet_cache.c algo_hmac.c
 lighttpd_CPPFLAGS += $(LUA_CFLAGS)
 lighttpd_LDADD += $(LUA_LIBS) -lm
 endif

Not sure why it was commented out earlier.

Actions #1

Updated by gstrauss 11 months ago

Thanks for tracking that down.

I think the comment originally had to do with duplicating the object in the static executable, though with the removal of mod_secdownload, I should revisit that.

Are you going to submit a patch to Alpine with that change or should I?

Actions #2

Updated by desmana 11 months ago

Are you going to submit a patch to Alpine with that change or should I?

Not sure what you mean. Alpine Linux official package uses Meson build system and is not affected by this as far as I know.

Actions #3

Updated by gstrauss 11 months ago

Sorry, haven't yet had a chance to look into this closely.

This will be fixed in the next lighttpd release, but the release date is not yet scheduled.

Actions #4

Updated by gstrauss 11 months ago

  • Status changed from New to Patch Pending
  • Target version changed from 1.4.xx to 1.4.71

This issue arose with the removal of mod_secdownload in lighttpd 1.4.68, released 2 Jan 2023.

The timing of this bug report is slightly unfortunate, as lighttpd 1.4.70 was released yesterday.

Thank you for the patch. It will be part of lighttpd 1.4.71 some time later this year, though that release is not yet scheduled.

Actions #5

Updated by gstrauss 11 months ago

  • Status changed from Patch Pending to Fixed
Actions

Also available in: Atom