Fixed some issues with the build rules linking ldlibs