If you set File > Preferences > Show verbose output during: compilation and then compile some code it will show all the compilation commands the Arduino IDE runs. You might do that and then compare them against the commands you're running to see if you can spot the difference.