Connectors for anchoring solar modules or supporting elements to the ground or to building structures