I am trying to build from Windows to Android with Android NDK and MinGWg-w64 (winlibs-x86_64-posix-seh-gcc-14.2.0-llvm-18.1.8-mingw-w64ucrt-12.0.0-r1) Everything goes fine until I got an error like this:
D:\Projects\ProjectFoo\src\someFile.cpp:29:11: error: no member named 'push_range' in 'std::stack<TIntermNode *>'
stack.push_range(analyzer.getPipelineOutputs());
~~~~~ ^
:\Projects\ProjectFoo\src\someFile.cpp:90:23: error: no member named 'push_range' in 'std::stack<TIntermNode *>'
stack.push_range(Nodes);
~~~~~ ^
I guess this is because the push_range function is only after the C++ 23 standard. I included this into my CMakeLists.txt
as well as in my build script, but it seem it has been ignored. Or is there a problem with the compiler?
This is my build script:
@echo off
call :build arm64-v8a
if errorlevel 1 goto error
exit /b 0
:build
set ANDR_ARCH=%~1
set ANDR_NDK_HOME=D:\Android\ndk\26.1.10909125
set MINGW_MAKE_PATH=D:\winlibs-x86_64-posix-seh-gcc-14.2.0-llvm-18.1.8-mingw-w64ucrt-12.0.0-r1\mingw64\bin
rd /s /q %ANDR_ARCH% > nul 2>&1
mkdir %ANDR_ARCH%
cd %ANDR_ARCH%
C:\CMake\bin\cmake.exe -G "MinGW Makefiles" ..^
-DCMAKE_MAKE_PROGRAM="%MINGW_MAKE_PATH%\mingw32-make.exe"^
-DCMAKE_TOOLCHAIN_FILE="%ANDR_NDK_HOME%\build\cmake\android.toolchain.cmake"^
-DCMAKE_BUILD_TYPE=Release^
-DCMAKE_SYSTEM_NAME=Android^
-DANDROID_ABI=arm64-v8a^
-DCMAKE_CXX_STANDARD=26^
pause
if errorlevel 1 exit /b errorlevel
C:\CMake\bin\cmake.exe --build . -j 12
pause
cd ..
exit /b 0
:error
cd ..
pause
exit /b errorlevel
This has nothing to do with your MinGW compiler but your NDK version.
Android NDK 26.1 comes with a certain version of Clang and Libc++ from January 2023. Meanwhile, the commit that added std::stack::push_range
was merged in June 2023.
Update your NDK to r27 or later and that specific method will be part of libc++.
EDIT: you can verify this yourself by locating the libc++ header files inside the NDK