Remove -L flag. It's been deprecated since 1.0.x
Reduce memory allocation during pkg update while here add debugs
Fix compile with GCC