When I try to build c++ static app in Mac M1, ld will show that "library not found for "-lcrt0.o". The following is a demo:
main.cpp
#include <iostream>
int main() {
std::cout << "Hello World!";
return 0;
}
The compile process works when using the following command:
g++ -g -Wall main.cpp -o main -std=c++0x
But it fails when I add flag "-static" in to command:
g++ -g -Wall main.cpp -o main -std=c++0x -static
Here is the error message:
ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)