Unable to identify issue with builder

Hi All,

First time poster, long time reader, hopefully I've included all the correct details.
I'm trying to build for the first time and seem to have issues at the same point each time and was hoping for some guidance.

The builder is per the wiki and I've tried Debian (11.2 and 12.1) with various git checkout.
Logs below are from an attempt at building a Raspberry Pi4 using "Main".

According to build.log the problem is here:

[35/282] /home/builder/openwrt/staging_dir/host/bin/g++ -O2 -I/home/builder/openwrt/staging_dir/host/include     -D_FILE_OFFSET_BITS=64    -DCMAKE_BOOTSTRAP    -DCMake_HAVE_CXX_MAKE_UNIQUE=1   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Bootstrap.cmk   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/LexerParser   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Utilities/std   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Utilities  -c /home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/cmCommonTargetGenerator.cxx -o cmCommonTargetGenerator.o
FAILED: cmCommonTargetGenerator.o 
/home/builder/openwrt/staging_dir/host/bin/g++ -O2 -I/home/builder/openwrt/staging_dir/host/include     -D_FILE_OFFSET_BITS=64    -DCMAKE_BOOTSTRAP    -DCMake_HAVE_CXX_MAKE_UNIQUE=1   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Bootstrap.cmk   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/LexerParser   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Utilities/std   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Utilities  -c /home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/cmCommonTargetGenerator.cxx -o cmCommonTargetGenerator.o
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[36/282] /home/builder/openwrt/staging_dir/host/bin/g++ -O2 -I/home/builder/openwrt/staging_dir/host/include     -D_FILE_OFFSET_BITS=64    -DCMAKE_BOOTSTRAP    -DCMake_HAVE_CXX_MAKE_UNIQUE=1   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Bootstrap.cmk   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/LexerParser   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Utilities/std   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Utilities  -c /home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/cmAddDependenciesCommand.cxx -o cmAddDependenciesCommand.o
[37/282] /home/builder/openwrt/staging_dir/host/bin/g++ -O2 -I/home/builder/openwrt/staging_dir/host/include     -D_FILE_OFFSET_BITS=64    -DCMAKE_BOOTSTRAP    -DCMake_HAVE_CXX_MAKE_UNIQUE=1   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Bootstrap.cmk   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/LexerParser   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Utilities/std   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Utilities  -c /home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/cmAddLibraryCommand.cxx -o cmAddLibraryCommand.o
[38/282] /home/builder/openwrt/staging_dir/host/bin/g++ -O2 -I/home/builder/openwrt/staging_dir/host/include     -D_FILE_OFFSET_BITS=64    -DCMAKE_BOOTSTRAP    -DCMake_HAVE_CXX_MAKE_UNIQUE=1   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Bootstrap.cmk   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/LexerParser   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Utilities/std   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Utilities  -c /home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/cmComputeTargetDepends.cxx -o cmComputeTargetDepends.o
[39/282] /home/builder/openwrt/staging_dir/host/bin/g++ -O2 -I/home/builder/openwrt/staging_dir/host/include     -D_FILE_OFFSET_BITS=64    -DCMAKE_BOOTSTRAP    -DCMake_HAVE_CXX_MAKE_UNIQUE=1   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Bootstrap.cmk   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/LexerParser   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Utilities/std   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Utilities  -c /home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/cmComputeLinkInformation.cxx -o cmComputeLinkInformation.o
[40/282] /home/builder/openwrt/staging_dir/host/bin/g++ -O2 -I/home/builder/openwrt/staging_dir/host/include     -D_FILE_OFFSET_BITS=64    -DCMAKE_BOOTSTRAP    -DCMake_HAVE_CXX_MAKE_UNIQUE=1   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Bootstrap.cmk   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/LexerParser   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Utilities/std   -I/home/builder/openwrt/build_dir/host/cmake-3.27.4/Utilities  -c /home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/cmComputeLinkDepends.cxx -o cmComputeLinkDepends.o
ninja: build stopped: subcommand failed.
---------------------------------------------
Error when bootstrapping CMake:
Problem while running /home/builder/openwrt/staging_dir/host/bin/ninja
---------------------------------------------
Log of errors: /home/builder/openwrt/build_dir/host/cmake-3.27.4/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
make[3]: *** [Makefile:58: /home/builder/openwrt/build_dir/host/cmake-3.27.4/.configured] Error 9
make[3]: Leaving directory '/home/builder/openwrt/tools/cmake'
time: tools/cmake/compile#64.00#110.47#280.18
    ERROR: tools/cmake failed to build.
make[2]: *** [tools/Makefile:228: tools/cmake/compile] Error 1
make[2]: Leaving directory '/home/builder/openwrt'
make[1]: *** [tools/Makefile:224: /home/builder/openwrt/staging_dir/host/stamp/.tools_compile_nyyynyynnnyyynynyyyyyyynyyynnynyynnynnyyyyyynyyyyyyyyyyynynnyyyyyyy] Error 2
make[1]: Leaving directory '/home/builder/openwrt'
make: *** [/home/builder/openwrt/include/toplevel.mk:232: world] Error 2

With area of cmake_bootstrap.log with issue appears here:

/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing#kwsys for details.  */

#ifdef TEST_KWSYS_CXX_STAT_HAS_ST_MTIM
#  include <sys/types.h>

#  include <sys/stat.h>
#  include <unistd.h>
int main()
{
  struct stat stat1;
  (void)stat1.st_mtim.tv_sec;
  (void)stat1.st_mtim.tv_nsec;
  return 0;
}
#endif

#ifdef TEST_KWSYS_CXX_STAT_HAS_ST_MTIMESPEC
#  include <sys/types.h>

#  include <sys/stat.h>
#  include <unistd.h>
int main()
{
  struct stat stat1;
  (void)stat1.st_mtimespec.tv_sec;
  (void)stat1.st_mtimespec.tv_nsec;
  return 0;
}
#endif

#ifdef TEST_KWSYS_CXX_HAS_SETENV
#  include <stdlib.h>
int main()
{
  return setenv("A", "B", 1);
}
#endif

#ifdef TEST_KWSYS_CXX_HAS_UNSETENV
#  include <stdlib.h>
int main()
{
  unsetenv("A");
  return 0;
}
#endif

#ifdef TEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
#  include <stdlib.h>
int main()
{
  char* e = environ[0];
  return e ? 0 : 1;
}
#endif

#ifdef TEST_KWSYS_CXX_HAS_GETLOADAVG
// Match feature definitions from SystemInformation.cxx
#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
#    define _GNU_SOURCE
#  endif
#  include <stdlib.h>
int main()
{
  double loadavg[3] = { 0.0, 0.0, 0.0 };
  return getloadavg(loadavg, 3);
}
#endif

#ifdef TEST_KWSYS_CXX_HAS_RLIMIT64
#  include <sys/resource.h>
int main()
{
  struct rlimit64 rlim;
  return getrlimit64(0, &rlim);
}
#endif

#ifdef TEST_KWSYS_CXX_HAS_UTIMES
#  include <sys/time.h>
int main()
{
  struct timeval* current_time = 0;
  return utimes("/example", current_time);
}
#endif

#ifdef TEST_KWSYS_CXX_HAS_UTIMENSAT
#  include <fcntl.h>
#  include <sys/stat.h>
#  if defined(__APPLE__)
#    include <AvailabilityMacros.h>
#    if MAC_OS_X_VERSION_MIN_REQUIRED < 101300
#      error "utimensat not available on macOS < 10.13"
#    endif
#  endif
int main()
{
  struct timespec times[2] = { { 0, UTIME_OMIT }, { 0, UTIME_NOW } };
  return utimensat(AT_FDCWD, "/example", times, AT_SYMLINK_NOFOLLOW);
}
#endif

#ifdef TEST_KWSYS_CXX_HAS_BACKTRACE
#  if defined(__PATHSCALE__) || defined(__PATHCC__) ||                        \
    (defined(__LSB_VERSION__) && (__LSB_VERSION__ < 41))
backtrace does not work with this compiler or os
#  endif
#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
#    define _GNU_SOURCE
#  endif
#  include <execinfo.h>
int main()
{
  void* stackSymbols[256];
  backtrace(stackSymbols, 256);
  backtrace_symbols(&stackSymbols[0], 1);
  return 0;
}
#endif

#ifdef TEST_KWSYS_CXX_HAS_DLADDR
#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
#    define _GNU_SOURCE
#  endif
#  include <dlfcn.h>
int main()
{
  Dl_info info;
  int ierr = dladdr((void*)main, &info);
  return 0;
}
#endif

#ifdef TEST_KWSYS_CXX_HAS_CXXABI
#  if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
#    define _GNU_SOURCE
#  endif
#  if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5130 && __linux &&             \
    __SUNPRO_CC_COMPAT == 'G'
#    include <iostream>
#  endif
#  include <cxxabi.h>
int main()
{
  int status = 0;
  size_t bufferLen = 512;
  char buffer[512] = { '\0' };
  const char* function = "_ZN5kwsys17SystemInformation15GetProgramStackEii";
  char* demangledFunction =
    abi::__cxa_demangle(function, buffer, &bufferLen, &status);
  return status;
}
#endif

#ifdef TEST_KWSYS_STL_HAS_WSTRING
#  include <string>
void f(std::wstring*)
{
}
int main()
{
  return 0;
}
#endif

#ifdef TEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H
#  include <ext/stdio_filebuf.h>
int main()
{
  return 0;
}
#endif
------------------------------------------
/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/kwsys/kwsysPlatformTestsCXX.cxx: In function 'int main()':
/home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/kwsys/kwsysPlatformTestsCXX.cxx:53:13: error: 'environ' was not declared in this scope; did you mean 'union'?
   53 |   char* e = environ[0];
      |             ^~~~~~~
      |             union
Test failed to compile
Try: /home/builder/openwrt/staging_dir/host/bin/g++
Line: /home/builder/openwrt/staging_dir/host/bin/g++ -O2 -I/home/builder/openwrt/staging_dir/host/include     -L/home/builder/openwrt/staging_dir/host/lib  -DTEST_KWSYS_STL_HAS_WSTRING /home/builder/openwrt/build_dir/host/cmake-3.27.4/Source/kwsys/kwsysPlatformTestsCXX.cxx -o cmake_bootstrap_133411_test
----------  file   -----------------------

Is the wiki you refer to?

Yes, correct.

My "cheat sheet"

# Clone desired source
git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt
git pull
 
# Select a specific code revision
git branch -a
git tag
git checkout v22.03.5

# Collect a default target build config file 
wget https://downloads.openwrt.org/releases/22.03.5/targets/bcm27xx/bcm2711/config.buildinfo -O .config
 
# Update the feeds
./scripts/feeds update -a
./scripts/feeds install -a
 
# Configure the firmware image and the kernel
make menuconfig

# Build the firmware image with logging
make -j1 V=s 2>&1 | tee build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"

Your cheat sheet is sane.

Cmake is cross-platform build environment. So the first thing I would look at is ensuring every component of your Build Environment is up to date.

Thanks, TBH, I've rebuilt the environment about 6 times this weekend so it should be up to date.
I have a Debian v11.2 and a v12.1 Hyper-V VM and both seem to fail in the same way.

As I was learning this build process I revert to an earlier "cold / powered off" snapshot to start clean every time.

One thing I haven't tried is adding the "older advice" environment items within the Debian / Ubuntu section.
As I was looking for only recent builds did not think this relevant but might give it a go anyway.

Good think! - I have no knowledge of using a Hypervisor with Linux (no Windows here).

OK, so tried both the "Modernised" and the additional "Older Advice" environment pre-requisites for Debian/Ubuntu.
Sadly no change outcome. Cmake fails in the same way.

First thing I noticed is that the version of cmake being built is NOT from the v22.03.5 tagged sources. The tag you are building from should be building cmake 3.22.3 (vs 3.27.4 in your example). This suggests your environment may not be setup as you noted in your "cheat sheet". You can check tools/cmake/Makefile for the version being used.

Also make sure you don't have a feeds.conf file superseding feeds.conf.default when building off the main branch. (This is not the problem here, but could be later on.)

"Older Advice" is not necessary for the Debian versions you are setup for.

1 Like

fatal error: Killed signal terminated actually suggests an OOM. You may want to check your kernel dmesg or similar to confirm.

Thank you for calling this out. I was looking for a deeper cause and this had slipped my notice.
It immediately raised flags that maybe Hyper-V involved.

I've since repurposed an old laptop with a new Debian 12.1 installation and the builds are now completing without issue.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.