I am going to compile postgresql from source, but the system already has postgresql related binaries such as pg_config, which gives me a lot of environment variables etc when I run it. I did not install postgresql an I've double checked from software manager. Why do I have postgresql related files? They lead to problems when I try to develop extensions with the custom compiled version of postgresql since various environment variables have already been configured.
Probably some other installed package depends upon postgresql, so the binaries got pulled in. You can run
to see all the reverse dependencies.