You should use global compile flags + -fPIC, but I do not see why is it needed?
It could be really nice to fix others too (like cache and srw at least)