When trying to run an Xcode project, you may receive the following error: “ld: library not found for -lXXX”. This means that the linker could not find a static library that your project depends on.
There are 3 ways to fix this error:
- Add the missing library to your project.
- Change the “Library Search Paths” build setting in your project to include the directory where the missing library is located.
- Add the path of the static library to the “LD_LIBRARY_PATH” environment variable.
In addition, you can also add the following -L/Library/Developer/CommandLineTools/usr/lib/swift_static/macosx/