C Code Won't Compile in MacOS Catalina or Big Sur

I am unable to compile C code on neither MacOS Catalina nor Big Sur. I see the header files present in /usr/include/, but I get errors from my C compiler.

Current error messages I get from the compiler are:
  • For "#include <time.h>" => error: cannot open source file "time.h"

  • For "#include <stdint.h>" => error: cannot open source file "stdint.h"

What I've tried:
  • Running the following command on Catalina says "upgrade successful", but does not resolve any errors; running it on Big Sur says that "the package path specified was invalid."

Code Block
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / 
  • I tried uninstalling and reinstalling XCode (Version 10.1)

  • I tried downloading the above .pkg file for Big Sur (because I was missing it) but was told my macOS version was too new

  • The files I need are stored in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include, so I added a new CPATH and PATH variable (separately) for that path to ~/.bash_profile and /etc/paths (I can't insert the link to that article for some reason but it's entitled "Setting Up Environment Variables in MacOS" on medium.com)

  • I tried to provide #include statements with explicit paths to those files, which quickly spiraled out of control

  • I tried to move all of the required files from the above directory to my project folder and changing the paths appropriately in the code

  • I tried to run the following command, which made the /usr/include folder show up in my development folder but am still getting the "cannot open source file" errors

Code Block
sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
Any advice would be helpful. Thank you!
Xcode 10.1 is not officially supported on Catalina and Big Sur. I recommend installing Xcode 12.4 and checking if that fixes things.
Thanks for the advice! I just upgraded to XCode 12.4 but unfortunately, nothing has changed.

Just to add some information:

I'm using an ARM 32-bit cross-compiler (arm-none-eabi). This is how I set it up on Big Sur:
  1. Downloaded "binutils-2.36.tar.xz" from ftp.gnu.org/gnu/binutils/

  2. Outside of the binutils directory, created a folder named "build32" and ran the following commands:

Code Block
../binutils-2.36/configure --target=arm-none-eabi --disable-nls --enable-languages=c --without-headers
make -j4 all
make install

3. Downloaded "gcc-arm-src-snapshot-10.2-2020.11.tar.xz" from developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads
4. Inside the main directory, created a subdirectory called "build32" and ran the following commands:

Code Block
../gcc-arm-src-snapshot-10.2-2020.11/configure --target=arm-none-eabi --disable-nls --enable-languages=c --without-headers
make -j4 all-gcc
sudo make install-gcc

Not sure if this could be the issue but again, any suggestions would be much appreciated!
C Code Won't Compile in MacOS Catalina or Big Sur
 
 
Q