Where would I find the System library?

I’m trying to build a very simple Fortran “Hello World” example, and it compiles, but complains that it can’t link against the “-lSystem” library:

ld: library not found for -lSystem

I’m trying to build on macOS if that makes a difference. Where does the System library live? I don’t see a libSystem.a along with the other flang libraries in lib.

Actually, I found an answer on StackOverflow:

export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
export LIBRARY_PATH="$LIBRARY_PATH:$SDKROOT/usr/lib"

You can also pass -Wl,-syslibroot as detailed here.