symforce-org / symforce

Fast symbolic computation, code generation, and nonlinear optimization for robotics
https://symforce.org
Apache License 2.0
1.41k stars 145 forks source link

Difficulty building w/ CMake: cloning tl_optional "fatal: reference is not a tree" #322

Open arbor-arthur opened 1 year ago

arbor-arthur commented 1 year ago

Describe the bug Running python3 -m pip install . on a git clone of symforce v0.8.0 gives the error:

      -- tl::optional not found, adding with FetchContent
      [ 11%] Creating directories for 'tl_optional-populate'
      [ 22%] Performing download step (git clone) for 'tl_optional-populate'
      Cloning into 'tl_optional-src'...
      fatal: reference is not a tree: c28fcf74d207fc667c4ed3dbae4c251ea551c8c1
      CMake Error at tl_optional-subbuild/tl_optional-populate-prefix/tmp/tl_optional-populate-gitclone.cmake:49 (message):
        Failed to checkout tag: 'c28fcf74d207fc667c4ed3dbae4c251ea551c8c1'

I got around this bug by removing all references to tl optional from symforce/opt/CMakeLists.txt and installing it separately, which is fine because it is a header-only library. I also had to add include_directories(/usr/local/include) to the top-level CMakeLists.txt. I installed tl-optional with:

git clone https://github.com/TartanLlama/optional.git
cd optional
# for m1/m2 support, modify CMakeLists.txt "https://github.com/catchorg/Catch2/archive/v2.9.2.zip" to be "https://github.com/catchorg/Catch2/archive/v2.13.10.zip"
mkdir build
cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build
cmake --build ./build
sudo cmake --install ./build --prefix /usr/local --config Release

To Reproduce

git clone https://github.com/symforce-org/symforce.git
cd symforce
git checkout v0.8.0
python3 -m pip install .

Expected behavior Should build without errors.

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional context cmake version 3.26.3

chao-qu-skydio commented 1 year ago

Thanks for reporting. I'm able to reproduce the same error you saw. Will look into this

chao-qu-skydio commented 1 year ago

This is fixed on main, we will release v0.9 soon