The compiler will attempt to complete linkage in the order the objects or files are presented. In this case, since you had put -lpolarssl
first, there were no unresolved symbols needed from that library, so nothing got linked in.
Putting -lpolarssl
last lets the compiler resolve unresolved symbols from your source file from that library.