Error compiling for Ubiquiti Aircube AC

Hi everyone!
I'm having issues compiling OpenWrt v21.02.2 for Ubiquiti's Aircube AC. I wanted to compile it from scratch to be able to customize the image for mass flashing, but so far CMake seems to break, therefore no cross-toolchain.

My setup is as follows:

  • vagrant virtual machine (Tried both bullseye and buster releases)
  • installed build dependencies as stated here
  • Checked out v21.02.2 branch
  • Used ath79/generic official build config with Aircube AC as profile

Everything works fine from the beginning up until trying to build the toolchain. Specifically it breaks at compiling CMake. The specific code snippet with the error is:

Checking whether 'g++ -O2 -I/home/vagrant/openwrt/staging_dir/host/include    ' supports 'filesystem'.
Try: g++
Line: g++ -O2 -I/home/vagrant/openwrt/staging_dir/host/include     /home/vagrant/openwrt/build_dir/host/cmake-3.19.1/Source/Checks/cm_cxx_filesystem.cxx -o cmake_bootstrap_2536_test
----------  file   -----------------------

#include <filesystem>

int main()
{
  std::filesystem::path p0(L"/a/b/c");

  std::filesystem::path p1("/a/b/c");
  std::filesystem::path p2("/a/b/c");
  if (p1 != p2) {
    return 1;
  }

#if defined(_WIN32)
  std::filesystem::path p3("//host/a/b/../c");
  if (p3.lexically_normal().generic_string() != "//host/a/c") {
    return 1;
  }

  std::filesystem::path p4("c://a/.///b/../");
  if (p4.lexically_normal().generic_string() != "c:/a/") {
    return 1;
  }
#endif

  return 0;
}
------------------------------------------
/home/vagrant/openwrt/build_dir/host/cmake-3.19.1/Source/Checks/cm_cxx_filesystem.cxx: In function 'int main()':
/home/vagrant/openwrt/build_dir/host/cmake-3.19.1/Source/Checks/cm_cxx_filesystem.cxx:6:8: error: 'std::filesystem' has not been declared
   std::filesystem::path p0(L"/a/b/c");
        ^~~~~~~~~~
/home/vagrant/openwrt/build_dir/host/cmake-3.19.1/Source/Checks/cm_cxx_filesystem.cxx:8:8: error: 'std::filesystem' has not been declared
   std::filesystem::path p1("/a/b/c");
        ^~~~~~~~~~
/home/vagrant/openwrt/build_dir/host/cmake-3.19.1/Source/Checks/cm_cxx_filesystem.cxx:9:8: error: 'std::filesystem' has not been declared
   std::filesystem::path p2("/a/b/c");
        ^~~~~~~~~~
/home/vagrant/openwrt/build_dir/host/cmake-3.19.1/Source/Checks/cm_cxx_filesystem.cxx:10:7: error: 'p1' was not declared in this scope
   if (p1 != p2) {
       ^~
/home/vagrant/openwrt/build_dir/host/cmake-3.19.1/Source/Checks/cm_cxx_filesystem.cxx:10:13: error: 'p2' was not declared in this scope
   if (p1 != p2) {
             ^~
Test failed to compile
Try: gmake
/home/vagrant/openwrt/build_dir/host/cmake-3.19.1/bootstrap: 853: /home/vagrant/openwrt/build_dir/host/cmake-3.19.1/bootstrap: gmake: not found
gmake does not work
Try: make
make[4]: Entering directory '/home/vagrant/openwrt/build_dir/host/cmake-3.19.1/Bootstrap.cmk/cmake_bootstrap_2536_test_dir'
"gcc" -L/home/vagrant/openwrt/staging_dir/host/lib  -O2 -I/home/vagrant/openwrt/staging_dir/host/include    -o test test.c
make[4]: Leaving directory '/home/vagrant/openwrt/build_dir/host/cmake-3.19.1/Bootstrap.cmk/cmake_bootstrap_2536_test_dir'
1
make works

Any help is very much welcome. Thanks!

Are you sure you actually installed the right dependables in the build environment since it say gmake isn’t found?

What OS are you using to build with in the virtual machine because bullseye and buster is Linux Debian/Ubuntu but you referred to Mac dependables in the link?

Are you sure you actually installed the right dependables in the build environment since it say gmake isn’t found?

I followed the guides here and here for the entire process

What OS are you using to build with in the virtual machine because bullseye and buster is Linux Debian/Ubuntu but you referred to Mac dependables in the link?

The link contains dependencies for many distros, as well as Mac. I used the block of code under the debian/ubuntu section.

Well, it seems to have something to do with version 3.10 of CMake looking for a C++17 feature that gcc8 has behind a switch. For those with this issue in Debian Buster/Bulseye systems adding CXX_FLAGS=-std=c++17 fixed it.
Another thing to note, this happened on tag v21.02.2, but v21.02.3 did not exhibit this behavior.

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