Skip to content

[Bug]: Missing reference to `absl::lts_20211102::strings_internal::AppendPieces  #1585

@devisals

Description

@devisals

Describe the issue

I am trying to compile ROS Cartographer, and it requires Lib Absl lts_20211102 specifically (I tried a different version, however that did not work with Cartographer's compilation). Whenever I try to compile it, I get the same issue everytime.

Here is the exact error:

FAILED: cartographer_pbstream
: && /usr/bin/c++ -O3 -DNDEBUG -latomic -rdynamic CMakeFiles/cartographer_pbstream.dir/cartographer/io/pbstream_main.cc.o -o cartographer_pbstream -Wl,-rpath,/usr/local/lib: libcartographer.a /usr/local/lib/libceres.a /usr/local/lib/libglog.so.0.7.0 -lspqr -ltbb -lcholmod -lccolamd -lcamd -lcolamd -lamd -llapack -lblas -lf77blas -latlas -lsuitesparseconfig -lrt -lmetis -lcxsparse -llapack -lblas -lf77blas -latlas -lsuitesparseconfig -lrt -lmetis -lcxsparse -llua5.2 -lm /usr/lib/x86_64-linux-gnu/libboost_iostreams.so.1.71.0 -lglog /usr/local/lib/libgflags_nothreads.a -lcairo /usr/local/lib/libprotobuf.a /usr/local/lib/libabsl_leak_check.a /usr/local/lib/libabsl_cord.a /usr/local/lib/libabsl_cordz_info.a /usr/local/lib/libabsl_cord_internal.a /usr/local/lib/libabsl_cordz_functions.a /usr/local/lib/libabsl_cordz_handle.a /usr/local/lib/libabsl_hash.a /usr/local/lib/libabsl_city.a /usr/local/lib/libabsl_bad_variant_access.a /usr/local/lib/libabsl_low_level_hash.a /usr/local/lib/libabsl_raw_hash_set.a /usr/local/lib/libabsl_bad_optional_access.a /usr/local/lib/libabsl_hashtablez_sampler.a /usr/local/lib/libabsl_exponential_biased.a /usr/local/lib/libabsl_str_format_internal.a /usr/local/lib/libabsl_synchronization.a /usr/local/lib/libabsl_stacktrace.a /usr/local/lib/libabsl_graphcycles_internal.a /usr/local/lib/libabsl_symbolize.a /usr/local/lib/libabsl_malloc_internal.a /usr/local/lib/libabsl_debugging_internal.a /usr/local/lib/libabsl_demangle_internal.a /usr/local/lib/libabsl_time.a /usr/local/lib/libabsl_strings.a /usr/local/lib/libabsl_strings_internal.a /usr/local/lib/libabsl_base.a -lpthread /usr/local/lib/libabsl_spinlock_wait.a -lrt /usr/local/lib/libabsl_throw_delegate.a /usr/local/lib/libabsl_raw_logging_internal.a /usr/local/lib/libabsl_log_severity.a /usr/local/lib/libabsl_int128.a /usr/local/lib/libabsl_civil_time.a /usr/local/lib/libabsl_time_zone.a -lpthread && :
/usr/bin/ld: libcartographer.a(histogram.cc.o): in function cartographer::common::Histogram::ToString[abi:cxx11](int) const': histogram.cc:(.text+0x43f): undefined reference to absl::lts_20211102::strings_internal::CatPiecesabi:cxx11'
/usr/bin/ld: histogram.cc:(.text+0x965): undefined reference to `absl::lts_20211102::strings_internal::AppendPieces(std::__cxx11::basic_string<char, std::char_traits, std::allocator >*, std::initializer_listabsl::lts_20211102::string_view)'
collect2: error: ld returned 1 exit status
[116/281] Building CXX object CMakeFil...th/compute_relations_metrics_main.cc.o

Steps to reproduce the problem

Use the provided SH file to download and install absiel provided in the offical ROS cartographer installation steps: https://google-cartographer-ros.readthedocs.io/en/latest/compilation.html

If that does not work (i.e a newer version of absiel is installed, or the branch is not found), then you can use my custom SH scripts right here:

Firstly, try to install absiel with this script:

#!/bin/bash

set -o errexit
set -o verbose

# Check if the abseil-cpp directory exists
if [ -d "abseil-cpp" ]; then
    echo "abseil-cpp directory exists. Removing it..."
    rm -rf abseil-cpp
fi

# Clone the Abseil repository
# git clone https://github.com/abseil/abseil-cpp.git
# cd abseil-cpp
# git checkout 66a0a46462692378f77518f9db766a218bfac40b # 20211102.0
git clone --no-checkout https://github.com/abseil/abseil-cpp.git
cd abseil-cpp
git fetch --tags
git checkout tags/20211102.0

# Build process
mkdir build
cd build
cmake -G Ninja \
  -DCMAKE_CXX_STANDARD=17 \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
  -DCMAKE_INSTALL_PREFIX=/usr/local/stow/absl \
  ..
ninja
sudo ninja install

# Navigate to the stow directory
cd /usr/local/stow

# Try to stow the absl package and capture any failure output
if ! (sudo stow --delete absl && sudo stow absl) > stow_output.txt 2>&1; then
    echo "Stow command failed. Check stow_output.txt for details."
else
    echo "Stow operation completed successfully."
fi

If there are errors being shown, then navigate to the stow path, and find the file stow_output.txt. In that path, copy this script below and execute it:

#!/bin/bash

# Path to the file containing the stow error messages
ERROR_FILE="stow_output.txt"
TARGET_DIR="/usr/local" # Change this if your target directory is different

set -o errexit
set -o nounset
set -o pipefail

# Function to remove a file if it exists
remove_file() {
    local file_path="$1"
    if [[ -e "$file_path" ]]; then
        echo "Removing $file_path"
        sudo rm -f "$file_path"
    else
        echo "File not found: $file_path"
    fi
}

# Main loop to process each line of the error file
while IFS= read -r line; do
    if [[ $line == *"existing target is neither a link nor a directory:"* ]]; then
        # Extract the file path
        file_path=$(echo "$line" | awk '{print $NF}')
        full_path="$TARGET_DIR/$file_path"
        # Call function to remove the file
        remove_file "$full_path"
    fi
done < "$ERROR_FILE"

echo "Cleanup complete."

Then once all the previous dependenices are removed, Re-run the first script again.

Following that, follow all the steps (except for the install_absiel part) in the ros_cartographer repository.

What version of Abseil are you using?

20211102

What operating system and version are you using?

Ubuntu 20.04

What compiler and version are you using?

G++ 17

What build system are you using?

cmake version 3.28.0

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions