You are likely using two different toolchains unknowingly, one from Apple (installed via Xcode) and one from GNU (installed via Homebrew or MacPorts). If you type ranlib --version and see version info showing that ranlib is GNU, this is the case.
Make sure that /usr/bin comes in your $PATH before /usr/local/bin and /opt/local/bin. When you run which -a ranlib, the first result in the list should be /usr/bin/ranlib. Same for which -a ar-- the first result should be /usr/bin/ar. If it is not so, you need to fix your $PATH.
Once you fix your path and clean your project, try building again and things should work.