NSObject related compile issue on Linux

I have give option2 a try. It required more engineering time than I expected.

Also considering the upstream may not accept it, I just stop my time on implementing it and focus on solving another more serious Linux issue.