So I got 2 different instances, both CPU supports AVX2, I was expecting the shared library built from one instance can be used in another, however that's not the case. I was able to narrow the issue down to the -march=native flag: When replace it with -mavx2 -mpclmul it works perfectly in both instances. Just a note for anyone who may got same issue.