proxysql compilation fails on Jenkins due to zstd linker error

Description

Jenkin job for ProxySQL is failing as during compilation it is unable to locate libzstd even though it is installed on Jenkins machine used for compilation.

ProxySQL compiles successfully when tried on QA machines. Looks like a Jenkins environment issue. Since we have no access to Jenkins machines, requesting build team to take a look at it.

Below is the compilation error seen:

../deps/curl/curl/lib/.libs/libcurl.a(libcurl_la-content_encoding.o): In function `zstd_close_writer': content_encoding.c:(.text+0x108): undefined reference to `ZSTD_freeDStream' ../deps/curl/curl/lib/.libs/libcurl.a(libcurl_la-content_encoding.o): In function `zstd_unencode_write': content_encoding.c:(.text+0x1b6): undefined reference to `ZSTD_decompressStream' content_encoding.c:(.text+0x1be): undefined reference to `ZSTD_isError' ../deps/curl/curl/lib/.libs/libcurl.a(libcurl_la-content_encoding.o): In function `zstd_init_writer': content_encoding.c:(.text+0x24c): undefined reference to `ZSTD_createDStream' collect2: error: ld returned 1 exit status

To further investigate, created a jenkins fork branch https://github.com/mohitj1988/jenkins-pipelines/tree/zstd_issue to install zstd libraries in the QA build proxysql scripts.

Please find logs after installing zstd libraries

checking zlib.h presence... yes checking for zlib.h... yes configure: found both libz and libz.h header checking for ZSTD_createDStream in -lzstd... yes checking zstd.h usability... -- Looking for fcntl - found -- Looking for memcpy yes checking zstd.h presence... yes checking for zstd.h... yes
configure: Configured to build curl/libcurl: Host setup: x86_64-pc-linux-gnu Install prefix: /usr/local Compiler: gcc CFLAGS: -Werror-implicit-function-declaration -O2 -Wno-system-headers -pthread CPPFLAGS: -isystem /tmp/proxysql/deps/libssl/openssl//include -isystem /tmp/proxysql/deps/libssl/openssl//include/openssl LDFLAGS: -L/tmp/proxysql/deps/libssl/openssl//lib LIBS: -lssl -lcrypto -lzstd -lz curl version: 7.77.0 SSL: enabled (OpenSSL) SSH: no (--with-{libssh,libssh2}) zlib: enabled brotli: no (--with-brotli) zstd: enabled (libzstd) GSS-API: no (--with-gssapi) GSASL: no (libgsasl not found) TLS-SRP: no (--enable-tls-srp) resolver: POSIX threaded IPv6: no (--enable-ipv6) Unix sockets: enabled IDN: no (--with-{libidn2,winidn}) Build libcurl: Shared=no, Static=yes Built-in manual: no (--enable-manual) --libcurl option: enabled (--disable-libcurl-option) Verbose errors: enabled (--disable-verbose) Code coverage: disabled SSPI: no (--enable-sspi) ca cert bundle: /etc/ssl/certs/ca-certificates.crt ca cert path: no ca fallback: no LDAP: no (--enable-ldap / --with-ldap-lib / --with-lber-lib) LDAPS: no (--enable-ldaps) RTSP: no (--enable-rtsp) RTMP: no (--with-librtmp) Metalink: no (--with-libmetalink) PSL: no (--with-libpsl) Alt-svc: enabled (--disable-alt-svc) HSTS: enabled (--disable-hsts) HTTP1: enabled (internal) HTTP2: no (--with-nghttp2, --with-hyper) HTTP3: no (--with-ngtcp2, --with-quiche) ECH: no (--enable-ech) Protocols: FILE HTTP HTTPS MQTT Features: AsynchDNS HSTS Largefile NTLM SSL UnixSockets alt-svc libz zstd

The logs confirm that -lzstd is installed, however, still zstd undefined references error is seen during compilation.

Full logs: https://pxc.cd.percona.com/job/qa-proxysql2-pipeline/625/consoleFull

 

Environment

None

Smart Checklist

Activity

Serhii Stasiuk November 1, 2021 at 2:21 PM

PR was merged to percona/proxysql-packaging v2.1 branch

Serhii Stasiuk November 1, 2021 at 1:10 PM
Edited

Build process was adjusted according our build policy. Please see https://pxc.cd.percona.com/job/qa-proxysql2-pipeline/643/console for build/test run results, https://github.com/percona/proxysql-packaging/pull/45 for PR.

Also, please note that v2 should be used for only v2.0 packaging, for later versions branch v2.1 should be used

Serhii Stasiuk November 1, 2021 at 9:45 AM

We've discussed this issue with packaging team. We are packaging ProxySQL same way as upstream. Upstream builds are not linked with zstd. Also ProxySQL use multiple components from inside its sources tree, not system ones. libcurl is one of these included dependencies. So we should avoid installing zstd during proxysql build

mohit.joshi October 30, 2021 at 4:42 AM

Hi , All builds are failing due to this linking error. So, I think we should create a PR and merge this change. But, I am curious to understand if there are no changes in proxysql source code, why are we seeing this linking error? Has something changed in AWS platform where Jenkins job build and run tests ?

Serhii Stasiuk October 29, 2021 at 1:54 PM

Problem occurred due to absence of -lzstd parameter during linking stage. This can be fixed with https://github.com/AgileStas/proxysql-packaging/commit/9a05cba8bf52058267149f623ff17d286bc9400c (just add `EXTRALINK=-lzstd` to `make -j 4` in line 102 of scripts/build_binary.sh, proxysql-packaging repository).

I'm not sure if zstd is required library for all builds, so no PR for the time.

Done

Details

Assignee

Reporter

Time tracking

1d 5h 15m logged

Components

Priority

Smart Checklist

Created October 29, 2021 at 7:51 AM
Updated March 6, 2024 at 5:31 PM
Resolved November 1, 2021 at 2:21 PM

Flag notifications