Description
Here is a quick note on a Kudu build failure I saw on an Ubuntu 20 ARM machine recently. The Kudu thirdparty builds fine, but then when we get to building Kudu it fails with this:
21:07:31 [ 7%] Linking CXX executable ../../../bin/protoc-gen-insertions 21:07:31 /home/ubuntu/kudu/thirdparty/src/libunwind-1.5.0/src/dwarf/Gfind_proc_info-lsb.c:140: error: undefined reference to 'uncompress' 21:07:32 collect2: error: ld returned 1 exit status 21:07:32 make[2]: *** [src/kudu/util/CMakeFiles/protoc-gen-insertions.dir/build.make:113: bin/protoc-gen-insertions] Error 1
Here's what is going on:
- libunwind's .debug_frame support is enabled for ARM/aarch64, but it is disabled for other platforms. https://github.com/libunwind/libunwind/blob/master/configure.ac#L262-L276
- The .debug_frame support uses zlib uncompress if zlib is available. https://github.com/libunwind/libunwind/blob/master/src/dwarf/Gfind_proc_info-lsb.c#L139-L168
https://github.com/libunwind/libunwind/blob/master/configure.ac#L322-L337 - If thirdparty is built on an ARM machine that has zlib installed, then CONFIG_DEBUG_FRAME is true and HAVE_ZLIB is true and the uncompress() reference is compiled in.
- The Kudu build doesn't know that libunwind needs zlib, so the list of libraries linked in for protoc-gen-insertions doesn't include zlib.
One potential fix is to add zlib as a dependency for libunwind for ARM/aarch64. It might be worth compiling libunwind after zlib in thirdparty so that it always has the zlib support on ARM.
Reproducing steps on Ubuntu 20 ARM machine:
export DEBIAN_FRONTEND=noninteractive sudo DEBIAN_FRONTEND=noninteractive apt-get install -y autoconf automake curl flex g++ gcc gdb git \ krb5-admin-server krb5-kdc krb5-user libkrb5-dev libsasl2-dev libsasl2-modules \ libsasl2-modules-gssapi-mit libssl-dev libtool lsb-release make ntp \ openjdk-8-jdk openssl patch pkg-config python rsync unzip vim-common libz-devrm -rf kudu mkdir kudu cd kudu git init git fetch "${KUDU_REPO_URL}" git fetch "${KUDU_REPO_URL}" "${KUDU_REPO_BRANCH}" git checkout FETCH_HEAD git rev-parse FETCH_HEADthirdparty/build-if-necessary.sh mkdir -p build/release cd build/release ../../thirdparty/installed/common/bin/cmake -DCMAKE_BUILD_TYPE=release -DNO_TESTS=1 ../.. make -j