It's true it's never easy to rebuke sin and the Bible gives a warning about that. Proverbs 9:7-8 says, "He that reproveth a scorner getteth to himself shame: and he that rebuketh a wicked man getteth himself a blot. Reprove not a scorner, lest he hate thee: rebuke a wise man, and he will love thee." and Proverbs 23:9 says, "Speak not in the ears of a fool: for he will despise the wisdom of thy words." When you rebuke a mocker, you should not even expect to be praised. When Solomon mentioned those verses, it was a warning that when you are going to do your job warning others, do not expect to get praised. You might want to think how the prophets of the Old Testament were outcasts. Elijah had to hide because Ahab and Jezebel wanted him dead. Jeremiah lived a very lonely life warning Judah about the coming judgment. A pastor who rebukes sin is not bound to be popular because the world has a very different way of thinking. Unsaved people do not think like the saved because their souls were sold to Satan the very moment they committed their first sin.
I always hear this nonsense that people tell me that if my pastor is so great then why is he not popular at all? That's a good question that I could answer because fallen man loves their sin and what's worse, many self-righteous people are living in habitual sin while thinking nothing is wrong with them. 1 Corinthians 1:18 warns, "For the preaching of the cross is to them that perish foolishness; but unto us which are saved it is the power of God." For the unsaved man is that they are basically good so they don't need forgiveness, for them life is all about enjoying one's self, for them they tend to think popularity means you are right but that's not Biblical. The Bible declares the painful truth you are not basically good but a sinner (and lifestyle is a huge evidence of man's fallen nature), that life should be focused on God and not on man, and that popularity does not change the truth.