Hi. I primarily program in C++ for embedded development, and I saw that Zig offers easy cross-compilation for C/C++.
I tried it out and it worked great, but suddenly I'm no longer able to build. I've undone all my changes and even gone down to a simple "Hello world" application in C++ that Zig will no longer compile, saying that --dependency-file is an invalid linker flag.
I've seen on the GitHub that this is a known unsupported flag, but I'm very baffled as to why it was working fine for a while, and now this flag is being added to any project I create and compile with zig c++.
I know there's a fix by adding some extra CMake flags, but I'm more interested in understanding the why, because it wasn't happening a few hours ago.
My CMake file is simply:
cmake_minimum_required(VERSION 3.30)
project(test)
set(CMAKE_CXX_STANDARD 17)
add_executable(test main.cpp)
and I am invoking zig through CMake.
I am running on Ubuntu 22.04 LTS, with CMake 4.0.1.
I am not even cross-compiling anymore and the issue still persists. Is there some kind of cache for zig other than in ~/.cache/zig? Interestingly enough, if I install CMake 4.0.1 and this same version of Zig into a Docker Ubuntu 18.04 container, I do not see this issue.
Any info would be appreciated.