解决 undefined reference to `LZ4_compress_default’ 错误

今年110 Debian Jessie 上尝试将 OCSERV 升级为 0.11.10 版本 make 的时候报错如下

……
CCLD ocserv
worker-http.o: In function `lz4_compress':
/root/ocserv-0.11.10/src/worker-http.c:140: undefined reference to `LZ4_compress_default'
collect2: error: ld returned 1 exit status
Makefile:1549: recipe for target 'ocserv' failed
make[3]: *** [ocserv] Error 1
make[3]: Leaving directory '/root/ocserv-0.11.10/src'
Makefile:1232: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/root/ocserv-0.11.10/src'
Makefile:1047: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/ocserv-0.11.10'
Makefile:980: recipe for target 'all' failed
make: *** [all] Error 2

当时做了一些尝试,但是未能解决。

直到昨天,再次尝试安装 0.11.11 版本还是村子同样的问题于是 Google 搜索 “undefined reference to `LZ4_compress_default’”找到了如下两个页面

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

Re: [Openvpn-devel] Unreferenced function in 2.4.4 Linux build

参考之后,发现 Debian 8 上面的 liblz4-dev 1.3.0但是编译上述版本的 OCSERV 需要更高版本的 liblz4-dev可是,通过 apt 是装不了更高版本的 liblz4-dev

于是搜liblz4-dev 1.8.0 Debian 8”,找到了用于 Debian Sid 的最新版本 liblz4-1_1.8.1.2-1_amd64.deb liblz4-dev_1.8.1.2-1_amd64.deb下载并通过 dpkg -i 依次安装上述两个包(注意要先装 liblz4-1)之后,再 make,就不会报错了。

 

欢迎分享或转载,转载请注明出处。

本文固定链接:https://www.oixxu.com/solve-undefined-reference-to-lz4_compress_default-error

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注