Added -Wl,-as-needed flag