Opened 6 years ago

Closed 4 years ago

#939 closed Bug / Defect (fixed)

Compile error: /usr/src/openvpn/src/openvpn/comp-lz4.c:90: undefined reference to `LZ4_compress_default'

Reported by: klara31 Owned by: David Sommerseth
Priority: major Milestone: release 2.4.5
Component: Building / Compiling Version: OpenVPN 2.4.4 (Community Ed)
Severity: Patch Queue: Awaiting testing before ACK Keywords: lz4
Cc: David Sommerseth

Description

When compiling against the latest GIT checkout (422ecdac4a2738cd269361e048468d8b58793c4e), the following error occurs:

...
make[3]: Entering directory '/usr/src/openvpn/src/compat'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/usr/src/openvpn/src/compat'
Making all in openvpn
make[3]: Entering directory '/usr/src/openvpn/src/openvpn'
/bin/bash ../../libtool  --tag=CC   --mode=link /usr/lib/distcc/arm-linux-gnueabihf-gcc      -DPLUGIN_LIBDIR=\"/usr/local/lib/openvpn/plugins\"  -g -O2 -std=c99   -o openvpn argv.o base64.o buffer.o clinat.o comp.o compstub.o comp-lz4.o crypto.o crypto_openssl.o crypto_mbedtls.o dhcp.o error.o event.o fdmisc.o forward.o fragment.o gremlin.o helper.o httpdigest.o lladdr.o init.o interval.o list.o lzo.o manage.o mbuf.o misc.o platform.o console.o console_builtin.o console_systemd.o mroute.o mss.o mstats.o mtcp.o mtu.o mudp.o multi.o ntlm.o occ.o pkcs11.o pkcs11_openssl.o pkcs11_mbedtls.o openvpn.o options.o otime.o packet_id.o perf.o pf.o ping.o plugin.o pool.o proto.o proxy.o ps.o push.o reliable.o route.o schedule.o session_id.o shaper.o sig.o socket.o socks.o ssl.o ssl_openssl.o ssl_mbedtls.o ssl_verify.o ssl_verify_openssl.o ssl_verify_mbedtls.o status.o tls_crypt.o tun.o win32.o cryptoapi.o  ../../src/compat/libcompat.la -lnsl -lresolv -llzo2 -llz4   -lssl -lcrypto   -lsystemd  -ldl  
libtool: link: /usr/lib/distcc/arm-linux-gnueabihf-gcc -DPLUGIN_LIBDIR=\"/usr/local/lib/openvpn/plugins\" -g -O2 -std=c99 -o openvpn argv.o base64.o buffer.o clinat.o comp.o compstub.o comp-lz4.o crypto.o crypto_openssl.o crypto_mbedtls.o dhcp.o error.o event.o fdmisc.o forward.o fragment.o gremlin.o helper.o httpdigest.o lladdr.o init.o interval.o list.o lzo.o manage.o mbuf.o misc.o platform.o console.o console_builtin.o console_systemd.o mroute.o mss.o mstats.o mtcp.o mtu.o mudp.o multi.o ntlm.o occ.o pkcs11.o pkcs11_openssl.o pkcs11_mbedtls.o openvpn.o options.o otime.o packet_id.o perf.o pf.o ping.o plugin.o pool.o proto.o proxy.o ps.o push.o reliable.o route.o schedule.o session_id.o shaper.o sig.o socket.o socks.o ssl.o ssl_openssl.o ssl_mbedtls.o ssl_verify.o ssl_verify_openssl.o ssl_verify_mbedtls.o status.o tls_crypt.o tun.o win32.o cryptoapi.o  ../../src/compat/.libs/libcompat.a -lnsl -lresolv -llzo2 -llz4 -lssl -lcrypto -lsystemd -ldl
comp-lz4.o: In function `do_lz4_compress':
/usr/src/openvpn/src/openvpn/comp-lz4.c:90: undefined reference to `LZ4_compress_default'
collect2: error: ld returned 1 exit status
distcc[31230] ERROR: compile (null) on localhost failed
Makefile:575: recipe for target 'openvpn' failed
make[3]: *** [openvpn] Error 1
make[3]: Leaving directory '/usr/src/openvpn/src/openvpn'
Makefile:418: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/usr/src/openvpn/src'
Makefile:603: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/usr/src/openvpn'
Makefile:490: recipe for target 'all' failed
make: *** [all] Error 2

I do have liblz4-dev installed:

# dpkg -l | grep liblz4
ii  liblz4-1:armhf                   0.0~r122-2                              armhf        Fast LZ compression algorithm library - runtime
ii  liblz4-dev:armhf                 0.0~r122-2                              armhf        Fast LZ compression algorithm library - development files

System (Raspberry Pi) running on Debian Jessie, kernel 4.9.35-v7

Attachments (1)

0001-lz4-Fix-confused-version-check.patch (2.9 KB) - added by David Sommerseth 6 years ago.
[PATCH] lz4: Fix confused version check

Download all attachments as: .zip

Change History (8)

comment:1 Changed 6 years ago by Gert Döring

Someone reported this on the openvpn-devel list already last week (https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15544.html), and it turns out that the root cause was multiple parallel installations of liblz4.so - one old version (1.3.0) that does not have the required function and one new one (1.8.0) that was seen and accepted by configure.

Could you run locate liblz4  on your system whether this is true for you as well?

In any case, the mitigation is to tell configure exactly where the *new* version is to be found, by calling

 ./configure LZ4_CFLAGS=-I/usr/local/include LZ4_LIBS="-L/usr/local/lib -llz4"

(assuming that /usr/local has liblz4 newer than 1.7.0)

comment:2 Changed 6 years ago by Gert Döring

Keywords: liblz4 LZ4_compress_default added
Version: 2.2.2git master branch

comment:3 Changed 6 years ago by Gert Döring

(another approach is to *remove* liblz4-dev, and let configure fall back to the compat/ version we bundle)

comment:4 Changed 6 years ago by Gert Döring

Cc: David Sommerseth added
Owner: set to Gert Döring
Status: newaccepted

We're getting closer to understanding this. Debian 8 (!) is shipping a version of liblz4 that identifies itself as "version 122", which is numerically newer than "1.7.1", but actually is much older - so our test is failing to recognize this.

Patch for configure.ac forthcoming...

comment:5 Changed 6 years ago by Gert Döring

Owner: changed from Gert Döring to David Sommerseth
Status: acceptedassigned

Changed 6 years ago by David Sommerseth

[PATCH] lz4: Fix confused version check

comment:6 Changed 6 years ago by David Sommerseth

Component: Generic / unclassifiedBuilding / Compiling
Keywords: lz4 added; liblz4 LZ4_compress_default removed
Milestone: release 2.4.5
Severity: Not set (if unsure, select this one)Patch Queue: Awaiting testing before ACK
Status: assignedaccepted
Version: git master branch2.4.4

I've added a preliminary patch which is going through some testing now. This should resolve this issue. Once testing have concluded, it will be sent to the openvpn-devel for a formal review and then it will be in the pipe for v2.4.5.

comment:7 Changed 4 years ago by Gert Döring

Resolution: fixed
Status: acceptedclosed

A number of patches have been merged to release/2.4 since then

commit c70a80b1b73d658bfe16225048d95958daf034e7
Author: David Sommerseth <davids@…>
Date: Mon Oct 2 21:07:32 2017 +0200

lz4: Fix broken builds when pkg-config is not present but system library is

commit c8a7cc646571165101a43b02a3f0676661d4d011
Author: David Sommerseth <davids@…>
Date: Mon Oct 2 18:18:12 2017 +0200

lz4: Fix confused version check

so I assume this is fixed for good now, and it was just forgotten to be closed.

Note: See TracTickets for help on using tickets.