Linker error to UnscaledCycleClock on Alpine
benstadin opened this issue · comments
benstadin commented
I'm trying to compile a library on Alpine (musl) which compiles just fine on Ubuntu. I'm getting a linker error as show below, though I cannot relate that to the actual abseil library (I mean any other than libabsl_base.a).
The build fails as follows:
testing check_audience_test...
Error loading shared library libjwt_verify.so: No such file or directory (needed by tests/check_audience_test)
Error relocating tests/check_audience_test: _ZNK6google10jwt_verify13CheckAudience19areAudiencesAllowedERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EE: symbol not found
Error relocating tests/check_audience_test: _ZN6google10jwt_verify13CheckAudienceC1ERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS8_EE: symbol not found
ldd output for my library:
alpine:~/jwt_verify_lib# ldd /usr/local/opt/jwt-verify/lib/libjwt_verify.so
/lib/ld-musl-i386.so.1 (0xb7e75000)
libprotobuf.so.29 => /usr/lib/libprotobuf.so.29 (0xb7a35000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7865000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xb7847000)
libc.musl-x86.so.1 => /lib/ld-musl-i386.so.1 (0xb7e75000)
libz.so.1 => /lib/libz.so.1 (0xb782d000)
Error relocating /usr/local/opt/jwt-verify/lib/libjwt_verify.so: _ZN4absl13base_internal18UnscaledCycleClock3NowEv: symbol not found
Error relocating /usr/local/opt/jwt-verify/lib/libjwt_verify.so: _ZN4absl13base_internal8SpinLock10SlowUnlockEj: symbol not found
Error relocating /usr/local/opt/jwt-verify/lib/libjwt_verify.so: _ZN4absl13base_internal8SpinLock8SlowLockEv: symbol not found
Build command:
declare -a ABSEIL_LIBS=("${TARGET_INSTALL_DIR}/abseil/lib/libabsl_base.a" "${TARGET_INSTALL_DIR}/abseil/lib/libabsl_time.a" "${TARGET_INSTALL_DIR}/abseil/lib/libabsl_time>
g++ "$1" -Wall -pthread -lgtest_main -lgtest -lpthread -D JWT_LIB_BUILD "$BORINGSSL_LIBSSL" "$BORINGSSL_LIBCRYPTO" \
"${ABSEIL_LIBS[@]}" -L "${JWT_VERIFY_LIB_PATH}" -I"$BORINGSSL_INCLUDE" -I include -I . -lprotobuf \
-ljwt_verify "${ABSEIL_LIBS[@]}" -lstdc++ -lm -std=c++14 $FRAMEWORK -o "$2"
Derek Mauro commented
Can you provide a complete reproduction? If I had to guess, check that location of the Abseil libraries is in your runtime linker search path.