Title
#general
y

ycpr

09/24/2019, 4:26 PM
I faced a problem with linking
libc.so.6
while trying to compile osquery on
3.16.0-6-amd64 #1 SMP Debian 3.16.57-2 (2018-07-14) x86_64 GNU/Linux
. It compiles on Debian 9 though. Do I do something wrong? I get the following
cmake
output:
ycpr@deb8osq-dev:~/osquery/build$ cmake -DOSQUERY_TOOLCHAIN_SYSROOT=/usr/local/osquery-toolchain ../src
-- The C compiler identification is Clang 8.0.1
-- The CXX compiler identification is Clang 8.0.1
-- Check for working C compiler: /usr/local/osquery-toolchain/usr/bin/clang
-- Check for working C compiler: /usr/local/osquery-toolchain/usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/osquery-toolchain/usr/bin/clang++
-- Check for working CXX compiler: /usr/local/osquery-toolchain/usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Not found: ccache. Install it and put it into the PATH if you want to speed up partial builds.
-- Found Git: /usr/bin/git (found version "2.1.4") 
-- osquery version: 4.0.0-122-g7eda0af-dirty
-- Build type: RelWithDebInfo
-- Shared libraries: OFF
-- Found Python2: /usr/bin/python2.7 (found version "2.7.9") found components:  Interpreter 
-- Found Python3: /usr/bin/python3.4 (found version "3.4.2") found components:  Interpreter 
-- Importing: facebook/markupsafe
-- Importing: facebook/jinja2
-- Importing: source/augeas
-- Found FLEX: /usr/bin/flex (found version "2.5.39") 
-- Found BISON: /usr/bin/bison (found version "3.0.2") 
-- Importing: source/augeas/gnulib
-- Importing: source/berkeley-db
-- Importing: source/boost
Submodule 'foreach' (<https://github.com/boostorg/foreach.git>) registered for path 'foreach'
Cloning into 'libs/foreach'...
fatal: reference is not a tree: 4240a1d095cf4a5e04093a1b91b1f0c791a58da9
Unable to checkout '4240a1d095cf4a5e04093a1b91b1f0c791a58da9' in submodule path 'foreach'
CMake Error at libraries/cmake/source/modules/utils.cmake:64 (message):
  Failed to update the following git submodule:
  "/home/ycpr/osquery/src/libraries/cmake/source/boost/src/libs/foreach"
Call Stack (most recent call first):
  libraries/cmake/source/modules/utils.cmake:115 (initializeGitSubmodule)
  libraries/cmake/source/modules/Findboost.cmake:10 (importSourceSubmodule)
  CMakeLists.txt:134 (find_package)
  CMakeLists.txt:52 (importLibraries)
  CMakeLists.txt:174 (main)


-- Configuring incomplete, errors occurred!
See also "/home/ycpr/osquery/build/CMakeFiles/CMakeOutput.log".
See also "/home/ycpr/osquery/build/CMakeFiles/CMakeError.log".
zwass

zwass

09/24/2019, 4:29 PM
Try running cmake again if you get these
reference is not a tree
errors. There's something we need to work out in the shallow cloning logic for some of these third party repos.
y

ycpr

09/24/2019, 5:18 PM
I ran
cmake
a dozen times and got to another error in another submodule:
ycpr@deb8osq-dev:~/osquery/build$ cmake -DOSQUERY_TOOLCHAIN_SYSROOT=/usr/local/osquery-toolchain ../src/
-- Not found: ccache. Install it and put it into the PATH if you want to speed up partial builds.
-- osquery version: 4.0.0-122-g7eda0af-dirty
-- Build type: RelWithDebInfo
-- Shared libraries: OFF
-- Importing: facebook/markupsafe
-- Importing: facebook/jinja2
-- Importing: source/augeas
-- Importing: source/augeas/gnulib
-- Importing: source/berkeley-db
-- Importing: source/boost
-- Importing: source/icu
-- Importing: source/bzip2
-- Importing: source/gflags
CMake Error at libraries/cmake/source/gflags/CMakeLists.txt:13 (add_subdirectory):
  The source directory

    /home/ycpr/osquery/src/libraries/cmake/source/gflags/src

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  libraries/cmake/source/gflags/CMakeLists.txt:27 (gflagsMain)


CMake Error at CMakeLists.txt:169 (message):
  The 'gflags' was found but it couldn't be imported correctly
Call Stack (most recent call first):
  CMakeLists.txt:52 (importLibraries)
  CMakeLists.txt:174 (main)


-- Configuring incomplete, errors occurred!
See also "/home/ycpr/osquery/build/CMakeFiles/CMakeOutput.log".
See also "/home/ycpr/osquery/build/CMakeFiles/CMakeError.log".
zwass

zwass

09/24/2019, 5:44 PM
Hmm, is there a CMakeLists.txt file in that directory?
y

ycpr

09/24/2019, 6:07 PM
src
directory is empty, there is a CMakeLists.txt in
gflags
a

alessandrogario

09/24/2019, 7:02 PM
This is highly dependent on the git version, and really sucks. Workaround:
git submodule deinit --all --force
&&
git submodule update --init --recursive
7:03 PM
This will deregister all the submodules (--force is needed because the patch system touches the source folder for now) and pull them back again without shallow
y

ycpr

09/27/2019, 4:10 PM
@alessandrogario Thank you! It did the trick for me.