pkg-config won't run
I wouldn’t sudo anything brew related for installs in /usr/local and use one Unix user only to manage homebrew. The only exception is some initial setup or remediation steps when you are explicitly instructed by the tool to use sudo

What’s happening is some permissions (using sudo likely) went bad in /usr/local so you might need to revert them. 

brew doctor


The above command is designed to find and help you fix many of the common ways people can have issues installing packages so I would start there. Also run a command to see what leaves you need in case you have to clean up and remove all the brewed items and reinstall one by one once your permissions are set. 

brew leaves