Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Notify Developers with Error Message for Missing Submodules in CMakeLists.txt #1708

Open
otegami opened this issue Feb 26, 2024 · 5 comments
Labels

Comments

@otegami
Copy link
Contributor

otegami commented Feb 26, 2024

What is your problem?

Suggestions

Let's add an error message in our CMakeLists.txt file to notify developers about missing submodules during the build process.

  • Because developers find it difficult to identify the reason for the error below because of missing submodules.

Background

Some developers have used git clone instead of git clone --recursive when cloning the repository, leading to missing submodules.

Actual

-- Configuring done
CMake Error at vendor/onigmo/CMakeLists.txt:133 (add_library):
  Cannot find source file:

    /home/otegami/dev/groonga/vendor/onigmo-source/regint.h

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
  .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc


CMake Error at vendor/onigmo/CMakeLists.txt:133 (add_library):
  No SOURCES given to target: onigmo


CMake Generate step failed.  Build files cannot be regenerated correctly.
cmake -S ./groonga -B ./groonga.build --preset=debug-default   3.56s user 1.37s system 85% cpu 5.753 total

Expected (It's just my idea)

CMake Error: Please clone missing submodules.
- git submodule update --init --recursive

How to reproduce it

% git clone git@github.com:groonga/groonga.git
% cmake -S ./groonga -B ./groonga.build --preset=debug-default -DCMAKE_INSTALL_PREFIX="/tmp/local"
...
-- Configuring done
CMake Error at vendor/onigmo/CMakeLists.txt:133 (add_library):
  Cannot find source file:

    /home/otegami/dev/groonga/vendor/onigmo-source/regint.h

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
  .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc


CMake Error at vendor/onigmo/CMakeLists.txt:133 (add_library):
  No SOURCES given to target: onigmo


CMake Generate step failed.  Build files cannot be regenerated correctly.
cmake -S ./groonga -B ./groonga.build --preset=debug-default   3.56s user 1.37s system 85% cpu 5.753 total
Detailed error Log
-[490]% cmake -S ./groonga -B ./groonga.build --preset=debug-default -DCMAKE_INSTALL_PREFIX="/tmp/local"
Preset CMake variables:

  CMAKE_BUILD_TYPE="Debug"
  CMAKE_EXPORT_COMPILE_COMMANDS="ON"

-- CMake: 3.22.1
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- Use ccache for compiling C: /bin/ccache
-- Use ccache for compiling C++: /bin/ccache
-- Found PkgConfig: /bin/pkg-config (found version "0.29.2") 
-- Performing Test GRN_HAVE_AVX_FLAG
-- Performing Test GRN_HAVE_AVX_FLAG - Success
-- Performing Test GRN_HAVE_AVX2_FLAG
-- Performing Test GRN_HAVE_AVX2_FLAG - Success
-- Performing Test GRN_HAVE_AVX512CD_FLAG
-- Performing Test GRN_HAVE_AVX512CD_FLAG - Success
-- Performing Test GRN_HAVE_AVX512DQ_FLAG
-- Performing Test GRN_HAVE_AVX512DQ_FLAG - Success
-- Performing Test GRN_HAVE_AVX512F_FLAG
-- Performing Test GRN_HAVE_AVX512F_FLAG - Success
-- Performing Test GRN_HAVE_AVX512FP16_FLAG
-- Performing Test GRN_HAVE_AVX512FP16_FLAG - Failed
-- Performing Test GRN_HAVE_AVX512VNNI_FLAG
-- Performing Test GRN_HAVE_AVX512VNNI_FLAG - Success
-- Performing Test GRN_HAVE_AVX512VPOPCNTDQ_FLAG
-- Performing Test GRN_HAVE_AVX512VPOPCNTDQ_FLAG - Success
-- AVX flags: -mavx
-- AVX2 flags: -mavx2
-- Performing Test CFLAG_WALL
-- Performing Test CFLAG_WALL - Success
-- Performing Test CXXFLAG_WALL
-- Performing Test CXXFLAG_WALL - Success
-- Performing Test CFLAG_WNO_UNUSED_BUT_SET_VARIABLE
-- Performing Test CFLAG_WNO_UNUSED_BUT_SET_VARIABLE - Success
-- Performing Test CXXFLAG_WNO_UNUSED_BUT_SET_VARIABLE
-- Performing Test CXXFLAG_WNO_UNUSED_BUT_SET_VARIABLE - Success
-- Performing Test CFLAG_WNO_UNUSED_PARAMETER
-- Performing Test CFLAG_WNO_UNUSED_PARAMETER - Success
-- Performing Test CXXFLAG_WNO_UNUSED_PARAMETER
-- Performing Test CXXFLAG_WNO_UNUSED_PARAMETER - Success
-- Performing Test CFLAG_WNO_POINTER_SIGN
-- Performing Test CFLAG_WNO_POINTER_SIGN - Success
-- Performing Test CFLAG_WFLOAT_EQUAL
-- Performing Test CFLAG_WFLOAT_EQUAL - Success
-- Performing Test CXXFLAG_WFLOAT_EQUAL
-- Performing Test CXXFLAG_WFLOAT_EQUAL - Success
-- Performing Test CFLAG_WFORMAT
-- Performing Test CFLAG_WFORMAT - Success
-- Performing Test CXXFLAG_WFORMAT
-- Performing Test CXXFLAG_WFORMAT - Success
-- Performing Test CFLAG_WNO_FORMAT_TRUNCATION
-- Performing Test CFLAG_WNO_FORMAT_TRUNCATION - Success
-- Performing Test CXXFLAG_WNO_FORMAT_TRUNCATION
-- Performing Test CXXFLAG_WNO_FORMAT_TRUNCATION - Success
-- Performing Test CFLAG_WSTRICT_ALIASING_2
-- Performing Test CFLAG_WSTRICT_ALIASING_2 - Success
-- Performing Test CXXFLAG_WSTRICT_ALIASING_2
-- Performing Test CXXFLAG_WSTRICT_ALIASING_2 - Success
-- Performing Test CFLAG_FNO_STRICT_ALIASING
-- Performing Test CFLAG_FNO_STRICT_ALIASING - Success
-- Performing Test CXXFLAG_FNO_STRICT_ALIASING
-- Performing Test CXXFLAG_FNO_STRICT_ALIASING - Success
-- Performing Test CFLAG_WNO_DISABLED_OPTIMIZATION
-- Performing Test CFLAG_WNO_DISABLED_OPTIMIZATION - Success
-- Performing Test CXXFLAG_WNO_DISABLED_OPTIMIZATION
-- Performing Test CXXFLAG_WNO_DISABLED_OPTIMIZATION - Success
-- Performing Test CFLAG_WPOINTER_ARITH
-- Performing Test CFLAG_WPOINTER_ARITH - Success
-- Performing Test CXXFLAG_WPOINTER_ARITH
-- Performing Test CXXFLAG_WPOINTER_ARITH - Success
-- Performing Test CFLAG_WBAD_FUNCTION_CAST
-- Performing Test CFLAG_WBAD_FUNCTION_CAST - Success
-- Performing Test CFLAG_WWRITE_STRINGS
-- Performing Test CFLAG_WWRITE_STRINGS - Success
-- Performing Test CXXFLAG_WWRITE_STRINGS
-- Performing Test CXXFLAG_WWRITE_STRINGS - Success
-- Performing Test CFLAG_WSIGN_COMPARE
-- Performing Test CFLAG_WSIGN_COMPARE - Success
-- Performing Test CXXFLAG_WSIGN_COMPARE
-- Performing Test CXXFLAG_WSIGN_COMPARE - Success
-- Performing Test CFLAG_WMISSING_FIELD_INITIALIZERS
-- Performing Test CFLAG_WMISSING_FIELD_INITIALIZERS - Success
-- Performing Test CXXFLAG_WMISSING_FIELD_INITIALIZERS
-- Performing Test CXXFLAG_WMISSING_FIELD_INITIALIZERS - Success
-- Performing Test CFLAG_WNO_DECLARATION_AFTER_STATEMENT
-- Performing Test CFLAG_WNO_DECLARATION_AFTER_STATEMENT - Success
-- Performing Test CXXFLAG_FEXCEPTIONS
-- Performing Test CXXFLAG_FEXCEPTIONS - Success
-- Performing Test CXXFLAG_FIMPLICIT_TEMPLATES
-- Performing Test CXXFLAG_FIMPLICIT_TEMPLATES - Success
-- Performing Test CFLAG_WNO_IMPLICIT_FALLTHROUGH
-- Performing Test CFLAG_WNO_IMPLICIT_FALLTHROUGH - Success
-- Performing Test CXXFLAG_WNO_IMPLICIT_FALLTHROUGH
-- Performing Test CXXFLAG_WNO_IMPLICIT_FALLTHROUGH - Success
-- Performing Test GRN_HAVE_BFLOAT16
-- Performing Test GRN_HAVE_BFLOAT16 - Failed
-- Looking for dirent.h
-- Looking for dirent.h - found
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for errno.h
-- Looking for errno.h - found
-- Looking for execinfo.h
-- Looking for execinfo.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for netdb.h
-- Looking for netdb.h - found
-- Looking for signal.h
-- Looking for signal.h - found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for sys/param.h
-- Looking for sys/param.h - found
-- Looking for sys/resource.h
-- Looking for sys/resource.h - found
-- Looking for sys/socket.h
-- Looking for sys/socket.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for sys/wait.h
-- Looking for sys/wait.h - found
-- Looking for time.h
-- Looking for time.h - found
-- Looking for ucontext.h
-- Looking for ucontext.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for _gmtime64_s
-- Looking for _gmtime64_s - not found
-- Looking for _localtime64_s
-- Looking for _localtime64_s - not found
-- Looking for _strtoui64
-- Looking for _strtoui64 - not found
-- Looking for fdatasync
-- Looking for fdatasync - found
-- Looking for fsync
-- Looking for fsync - found
-- Looking for futimens
-- Looking for futimens - found
-- Looking for futimes
-- Looking for futimes - found
-- Looking for getrusage
-- Looking for getrusage - found
-- Looking for gmtime_r
-- Looking for gmtime_r - found
-- Looking for localtime_r
-- Looking for localtime_r - found
-- Looking for mkstemp
-- Looking for mkstemp - found
-- Looking for strcasecmp
-- Looking for strcasecmp - found
-- Looking for strncasecmp
-- Looking for strncasecmp - found
-- Looking for strtoull
-- Looking for strtoull - found
-- Looking for fpclassify
-- Looking for fpclassify - found
-- Looking for fpclassify in m
-- Looking for fpclassify in m - not found
-- Looking for backtrace in execinfo
-- Looking for backtrace in execinfo - not found
-- Looking for backtrace
-- Looking for backtrace - found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Performing Test HAVE_STRUCT_TM_TM_GMTOFF
-- Performing Test HAVE_STRUCT_TM_TM_GMTOFF - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Looking for sys/epoll.h
-- Looking for sys/epoll.h - found
-- Looking for epoll_create
-- Looking for epoll_create - found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
CMake Warning at cmake/FindGroongazstd.cmake:29 (find_package):
  By not providing "Findzstd.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "zstd", but
  CMake did not find one.

  Could not find a package configuration file provided by "zstd" with any of
  the following names:

    zstdConfig.cmake
    zstd-config.cmake

  Add the installation prefix of "zstd" to CMAKE_PREFIX_PATH or set
  "zstd_DIR" to a directory containing one of the above files.  If "zstd"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:596 (find_package)


-- Checking for module 'libzstd'
--   Found libzstd, version 1.4.8
-- Found Groongazstd: TRUE  
-- Zstandard: system
-- RapidJSON found. Headers: /usr/include
-- Found GroongaRapidJSON: TRUE  
-- RapidJSON: system
-- MeCab: /usr/lib/x86_64-linux-gnu/libmecab.so
-- Checking for module 'kytea'
--   No package 'kytea' found
-- Found Groongalibstemmer: /usr  
-- Checking for module 'libzmq'
--   No package 'libzmq' found
-- Checking for module 'libevent'
--   No package 'libevent' found
CMake Warning at cmake/FindGroongamsgpackc.cmake:29 (find_package):
  By not providing "Findmsgpackc.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "msgpackc",
  but CMake did not find one.

  Could not find a package configuration file provided by "msgpackc" with any
  of the following names:

    msgpackcConfig.cmake
    msgpackc-config.cmake

  Add the installation prefix of "msgpackc" to CMAKE_PREFIX_PATH or set
  "msgpackc_DIR" to a directory containing one of the above files.  If
  "msgpackc" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:895 (find_package)


-- Found Groongamsgpackc: TRUE  
CMake Warning at cmake/FindGroongaxxHash.cmake:29 (find_package):
  By not providing "FindxxHash.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "xxHash", but
  CMake did not find one.

  Could not find a package configuration file provided by "xxHash" (requested
  version 0.8.0) with any of the following names:

    xxHashConfig.cmake
    xxhash-config.cmake

  Add the installation prefix of "xxHash" to CMAKE_PREFIX_PATH or set
  "xxHash_DIR" to a directory containing one of the above files.  If "xxHash"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:940 (find_package)


-- Checking for module 'libxxhash>=0.8.0'
--   Found libxxhash, version 0.8.1
-- Found GroongaxxHash: TRUE (Required is at least version "0.8.0") 
CMake Warning at cmake/FindGroongalz4.cmake:29 (find_package):
  By not providing "Findlz4.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "lz4", but
  CMake did not find one.

  Could not find a package configuration file provided by "lz4" with any of
  the following names:

    lz4Config.cmake
    lz4-config.cmake

  Add the installation prefix of "lz4" to CMAKE_PREFIX_PATH or set "lz4_DIR"
  to a directory containing one of the above files.  If "lz4" provides a
  separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:991 (find_package)


-- Checking for module 'liblz4'
--   Found liblz4, version 1.9.3
-- Found Groongalz4: TRUE  
CMake Warning at CMakeLists.txt:1210 (find_package):
  By not providing "Findxsimd.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "xsimd", but
  CMake did not find one.

  Could not find a package configuration file provided by "xsimd" with any of
  the following names:

    xsimdConfig.cmake
    xsimd-config.cmake

  Add the installation prefix of "xsimd" to CMAKE_PREFIX_PATH or set
  "xsimd_DIR" to a directory containing one of the above files.  If "xsimd"
  provides a separate development package or SDK, be sure it has been
  installed.


-- xsimd v12.1.1
CMake Warning (dev) at /home/otegami/dev/groonga.build/_deps/xsimd-src/CMakeLists.txt:92 (OPTION):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'BUILD_TESTS'.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /home/otegami/dev/groonga.build/_deps/xsimd-src/CMakeLists.txt:113 (OPTION):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'BUILD_EXAMPLES'.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- xsimd: bundled
-- Looking for sys/sysmacros.h
-- Looking for sys/sysmacros.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of short
-- Check size of short - done
-- Check size of int
-- Check size of int - done
-- Check size of long
-- Check size of long - done
-- Check size of void*
-- Check size of void* - done
-- Check size of long long
-- Check size of long long - done
-- Performing Test CFLAG_WNO_MISSING_FIELD_INITIALIZERS
-- Performing Test CFLAG_WNO_MISSING_FIELD_INITIALIZERS - Success
-- Configuring done
CMake Error at vendor/onigmo/CMakeLists.txt:133 (add_library):
  Cannot find source file:

    /home/otegami/dev/groonga/vendor/onigmo-source/regint.h

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
  .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc


CMake Error at vendor/onigmo/CMakeLists.txt:133 (add_library):
  No SOURCES given to target: onigmo


CMake Generate step failed.  Build files cannot be regenerated correctly.
cmake -S ./groonga -B ./groonga.build --preset=debug-default   3.56s user 1.37s system 85% cpu 5.753 total
@otegami otegami changed the title Proposal: Add a Reminder in CMakeLists.txt for Submodule Download Proposal: Notify Developers with Error Message for Missing Submodules in CMakeLists.txt Feb 26, 2024
@kou
Copy link
Member

kou commented Feb 26, 2024

Could you write how to reproduce this?

Could you write what error is showed with the current CMakeLists.txt?

@kou
Copy link
Member

kou commented Feb 26, 2024

We don't need to re-clone. We can use git submodule update --init --recursive with cloned repository.

@otegami
Copy link
Contributor Author

otegami commented Feb 26, 2024

@kou
Thank you so much.
I've just updated the description of this issue by adding your comments.

@otegami
Copy link
Contributor Author

otegami commented Feb 26, 2024

We don't need to re-clone. We can use git submodule update --init --recursive with cloned repository

Thanks I don't know that. I will fix it!

@otegami
Copy link
Contributor Author

otegami commented Feb 26, 2024

We don't need to re-clone. We can use git submodule update --init --recursive with cloned repository

Thanks I don't know that. I will fix it!

I've done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants