Project

General

Profile

Actions

Bug #3178

closed

scons: build_fullstatic with_lua=1 fails due to redefinition error

Added by geoffm almost 2 years ago. Updated almost 2 years ago.

Status:
Fixed
Priority:
Normal
Category:
mod_magnet
Target version:
ASK QUESTIONS IN Forums:
No

Description

There is a full-static-build error for lighttpd using a Docker Alpine container on Debian 11. The failure is a link error due to redefinition related to algo_hmac.c which can be solved by deleting line 119 of src/SConscript. This line relates to mod_secdownload which appears to be deprecated. The issue is that the algo_hmac.c object is linked for mod_secdownload and for mod_magnet which can cause redefinition errors in static builds.

The sequence:

% sudo docker run -it alpine
# apk update && apk upgrade
# apk add curl scons gcc make perl lua-dev musl-dev openssl-dev \
  bsd-compat-headers zlib-dev pcre2-dev openssl-libs-static \
  zlib-static
# curl -L 'https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.67.tar.gz' -o lighttpd-1.4.67.tar.gz
# tar xvf lighttpd-1.4.67.tar.gz
# cd lighttpd-1.4.67
# scons build_fullstatic=1 \
    build_dynamic=0 \
    with_openssl=1 \
    with_zlib=1 \
    with_pcre2=1 \
    with_lua=1 \
    prefix=/path/to/installdir \
    install

The scons warning:

scons: warning: Two different environments were specified for target algo_hmac.os, but they appear to have the same action: $SHCC -o $TARGET -c $SHCFLAGS $SHCCFLAGS $_CCCOMCOM $SOURCES
File "/lighttpd-1.4.67/src/SConscript", line 315, in <module>

The linker error:

/usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: sconsbuild/build/static-algo_hmac.o: in function `li_hmac_md5':
/lighttpd-1.4.67/src/algo_hmac.c:70: multiple definition of `li_hmac_md5'; sconsbuild/build/static-algo_hmac.o:/lighttpd-1.4.67/src/algo_hmac.c:70: first defined here
/usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: sconsbuild/build/static-algo_hmac.o: in function `li_hmac_sha1':
/lighttpd-1.4.67/src/algo_hmac.c:82: multiple definition of `li_hmac_sha1'; sconsbuild/build/static-algo_hmac.o:/lighttpd-1.4.67/src/algo_hmac.c:82: first defined here
/usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: sconsbuild/build/static-algo_hmac.o: in function `li_hmac_sha256':
/lighttpd-1.4.67/src/algo_hmac.c:158: multiple definition of `li_hmac_sha256'; sconsbuild/build/static-algo_hmac.o:/lighttpd-1.4.67/src/algo_hmac.c:158: first defined here
/usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: sconsbuild/build/static-algo_hmac.o: in function `li_hmac_sha512':
/lighttpd-1.4.67/src/algo_hmac.c:234: multiple definition of `li_hmac_sha512'; sconsbuild/build/static-algo_hmac.o:/lighttpd-1.4.67/src/algo_hmac.c:234: first defined here
collect2: error: ld returned 1 exit status
scons: *** [sconsbuild/fullstatic/build/lighttpd] Error 1

Thanks for all your work.

Actions #1

Updated by gstrauss almost 2 years ago

Thanks for the report.

mod_secdownload is scheduled to be removed in the next lighttpd release, currently estimated early January to match the previous year of deprecation warnings.

Actions #2

Updated by gstrauss almost 2 years ago

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

For a workaround until lighttpd 1.4.68 in Jan, you can use the following patch to remove mod_secdownload, or you can build without lua, or you can keep both and manually remove 'algo_hmac.c' from the mod_secdownload line to avoid the duplication.

--- a/src/SConscript
+++ b/src/SConscript
@@ -116,7 +116,6 @@ modules = {
        'mod_rewrite' : { 'src' : [ 'mod_rewrite.c' ] },
        'mod_rrdtool' : { 'src' : [ 'mod_rrdtool.c' ] },
        'mod_scgi' : { 'src' : [ 'mod_scgi.c' ] },
-       'mod_secdownload' : { 'src' : [ 'mod_secdownload.c', 'algo_hmac.c' ], 'lib' : [ env['LIBCRYPTO'] ] },
        'mod_setenv' : { 'src' : [ 'mod_setenv.c' ] },
        'mod_simple_vhost' : { 'src' : [ 'mod_simple_vhost.c' ] },
        'mod_sockproxy' : { 'src' : [ 'mod_sockproxy.c' ] },

Actions #3

Updated by gstrauss almost 2 years ago

  • Status changed from Patch Pending to Fixed

fixed in commit fcf0dc3e

Actions

Also available in: Atom