Use LD_LIBRARY_PATH in test building

Prepare for dynamic library build
Build as dynamic library