vgteam / vg

tools for working with genome variation graphs
https://biostars.org/tag/vg/
Other
1.12k stars 194 forks source link

sdsl-lite cmake issue #4389

Closed grenaud closed 1 month ago

grenaud commented 2 months ago

I am trying to build vg v1.59 on Ubuntu 24.04.1 LTS, gcc v13.2.0 and cmake version 3.28.3. However I got:

`CMake Error at test/CMakeLists.txt:47 (STRING): STRING sub-command REGEX, mode REPLACE needs at least 6 arguments total to command.

CMake Error at test/CMakeLists.txt:47 (STRING): STRING sub-command REGEX, mode REPLACE needs at least 6 arguments total to command.

CMake Error at test/CMakeLists.txt:49 (ADD_EXECUTABLE): ADD_EXECUTABLE cannot create target "EXCLUDE_FROM_ALL" because another target with the same name already exists. The existing target is an executable created in source directory "/home/gabriel/vgan_compile/vg-v1.58.0/deps/sdsl-lite/test". See documentation for policy CMP0002 for more details.

CMake Error at test/CMakeLists.txt:54 (ADD_CUSTOM_TARGET): ADD_CUSTOM_TARGET cannot create target "COMMAND" because another target with the same name already exists. The existing target is a custom target created in source directory "/home/gabriel/vgan_compile/vg-v1.58.0/deps/sdsl-lite/test". See documentation for policy CMP0002 for more details. `

jltsiren commented 2 months ago

This has been reported before, but we can't replicate it. Line 47 of deps/sdsl-lite/test/CMakeLists.txt is:

    STRING(REGEX REPLACE "_" "-" test_name_hy ${test_name_we})

You could try replacing it with:

    STRING(REGEX REPLACE "_" "-" test_name_hy "${test_name_we}")

Does this solve the issue?

grenaud commented 1 month ago

now I am getting:

CMake Error at test/CMakeLists.txt:49 (ADD_EXECUTABLE):
  ADD_EXECUTABLE cannot create target "EXCLUDE_FROM_ALL" because another
  target with the same name already exists.  The existing target is an
  executable created in source directory
  "/home/gabriel/vgan_compile/vg-v1.59.0/deps/sdsl-lite/test".  See
  documentation for policy CMP0002 for more details.

CMake Error at test/CMakeLists.txt:54 (ADD_CUSTOM_TARGET):
  ADD_CUSTOM_TARGET cannot create target "COMMAND" because another target
  with the same name already exists.  The existing target is a custom target
  created in source directory
  "/home/gabriel/vgan_compile/vg-v1.59.0/deps/sdsl-lite/test".  See
  documentation for policy CMP0002 for more details.

`

jltsiren commented 1 month ago

Those lines also have an unquoted variable (${variable}). You could try adding quotes there as well.

adamnovak commented 1 month ago

I can reproduce this with the 1.60.0 tarball and an ubuntu:24.04 Docker container.

docker run -ti --rm ubuntu:24.04
export DEBIAN_FRONTEND=noninteractive
apt update && apt install -y sudo git build-essential wget
cd
wget https://github.com/vgteam/vg/releases/download/v1.60.0/vg-v1.60.0.tar.gz
tar -xvf vg-v1.60.0.tar.gz
cd vg-v1.60.0
make get-deps
# Make sure to answer the time zone prompt
make

I get a bunch of CMake errors from sdsl-lite, starting with:

. ./source_me.sh && cd deps/sdsl-lite && BUILD_PORTABLE=1 CXXFLAGS="-fPIC  -std=c++14 -O3 -Werror=return-type -ggdb -g  -fopenmp" ./install.sh /root/vg-v1.60.0
Library will be installed in '/root/vg-v1.60.0'
WARNING: .git/hooks directory does not exists.
         The pre-commit hook is not installed.
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- The CXX compiler identification is GNU 13.2.0
-- The C compiler identification is GNU 13.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Compiler is recent enough to support C++14.
-- Performing Test HAVE_GCC_STD=C__14__WALL__WEXTRA__DNDEBUG
-- Performing Test HAVE_GCC_STD=C__14__WALL__WEXTRA__DNDEBUG - Success
-- Performing Test HAVE_GCC_O3__FFAST_MATH__FUNROLL_LOOPS
-- Performing Test HAVE_GCC_O3__FFAST_MATH__FUNROLL_LOOPS - Success
-- Performing Test HAVE_CXA_DEMANGLE
-- Performing Test HAVE_CXA_DEMANGLE - Success
-- Compiler supports DEMANGLE.
-- Performing Test HAVE_GCC_DHAVE_CXA_DEMANGLE
-- Performing Test HAVE_GCC_DHAVE_CXA_DEMANGLE - Success
-- Found Git: /usr/bin/git (found version "2.43.0")
git found: /usr/bin/git
CMake Deprecation Warning at external/libdivsufsort/CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

CMake Warning (dev) at external/libdivsufsort/CMakeLists.txt:7 (project):
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    PROJECT_VERSION
    PROJECT_VERSION_MAJOR
    PROJECT_VERSION_MINOR
    PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Performing Test HAVE_GCC_WALL
-- Performing Test HAVE_GCC_WALL - Success
-- Performing Test HAVE_GCC_FOMIT_FRAME_POINTER
-- Performing Test HAVE_GCC_FOMIT_FRAME_POINTER - Success
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Performing Test HAVE_INLINE
-- Performing Test HAVE_INLINE - Success
-- Performing Test HAVE___INLINE
-- Performing Test HAVE___INLINE - Success
-- Performing Test HAVE___INLINE__
-- Performing Test HAVE___INLINE__ - Success
-- Performing Test HAVE___DECLSPEC_DLLEXPORT_
-- Performing Test HAVE___DECLSPEC_DLLEXPORT_ - Failed
-- Performing Test HAVE___DECLSPEC_DLLIMPORT_
-- Performing Test HAVE___DECLSPEC_DLLIMPORT_ - Failed
-- Check size of uint8_t
-- Check size of uint8_t - done
-- Check size of int32_t
-- Check size of int32_t - done
-- Looking for PRId32
-- Looking for PRId32 - found
-- Check size of int64_t
-- Check size of int64_t - done
-- Looking for PRId64
-- Looking for PRId64 - found
CMake Deprecation Warning at external/googletest/googletest/CMakeLists.txt:48 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

CMake Warning (dev) at external/googletest/googletest/cmake/internal_utils.cmake:211 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  external/googletest/googletest/CMakeLists.txt:60 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PythonInterp: /usr/bin/python3 (found version "3.12.3")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Looking for C++ include cstdio
-- Looking for C++ include cstdio - found
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
CMake Error at test/CMakeLists.txt:47 (STRING):
  STRING sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.

CMake Error at test/CMakeLists.txt:47 (STRING):
  STRING sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.

CMake Error at test/CMakeLists.txt:49 (ADD_EXECUTABLE):
  ADD_EXECUTABLE cannot create target "EXCLUDE_FROM_ALL" because another
  target with the same name already exists.  The existing target is an
  executable created in source directory
  "/root/vg-v1.60.0/deps/sdsl-lite/test".  See documentation for policy
  CMP0002 for more details.

CMake Error at test/CMakeLists.txt:54 (ADD_CUSTOM_TARGET):
  ADD_CUSTOM_TARGET cannot create target "COMMAND" because another target
  with the same name already exists.  The existing target is a custom target
  created in source directory "/root/vg-v1.60.0/deps/sdsl-lite/test".  See
  documentation for policy CMP0002 for more details.

CMake Error at test/CMakeLists.txt:47 (STRING):
  STRING sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.

CMake Error at test/CMakeLists.txt:49 (ADD_EXECUTABLE):
  ADD_EXECUTABLE cannot create target "EXCLUDE_FROM_ALL" because another
  target with the same name already exists.  The existing target is an
  executable created in source directory
  "/root/vg-v1.60.0/deps/sdsl-lite/test".  See documentation for policy
  CMP0002 for more details.

CMake Error at test/CMakeLists.txt:54 (ADD_CUSTOM_TARGET):
  ADD_CUSTOM_TARGET cannot create target "COMMAND" because another target
  with the same name already exists.  The existing target is a custom target
  created in source directory "/root/vg-v1.60.0/deps/sdsl-lite/test".  See
  documentation for policy CMP0002 for more details.
adamnovak commented 1 month ago

I think the problem is I'm making the vg tarballs on Mac with a plain tar -czf, and so it includes all the Apple resource fork files like test/._bit_vector_test.cpp under the SDSL project root. The SDSL build system tries to use these as source files, and CMake sees an empty file basename, sets a variable to an empty string, and then that breaks the subsequent CMake code that doesn't quote it.

These files definitely aren't cpp files despite the name, so they really shouldn't be in the tarball. But if the build is being done on a Mac on a filesystem that doesn't itself have resource fork support, the system might make these files on the user's side, so we might want to make the SDSL build system ignore them also.

adamnovak commented 1 month ago

OK, I've updated the build checklist to ensure that AppleDouble resource fork files like these do not get included in the tarballs even when they are generated on a Mac, and I've remade (for the second time today) the v1.60.0 release tarball following that process. I tested it and it does now build in an ubuntu:24.04 Docker container (on my ARM machine), using make -j$(nproc) for the last command to speed it up.

@grenaud Please try again with https://github.com/vgteam/vg/releases/download/v1.60.0/vg-v1.60.0.tar.gz and the current vg version.

I'm going to close this issue as fixed; @grenaud if you need a particular old vg version for some reason let me know and I can try and fix the right old tarball as well.

grenaud commented 1 month ago

Sorry for the radio silence, I have a grant due, I will mark your email s unread and try to address this later this month :-) but thank you for looking into this @adamnovak @jltsiren !