Fix linking errors and add all required libraries

Change-Id: Id5c489e379af9f268b232f6bed8c1368f7971af2