slim: build fixes

Two patches are pretty obvious. The library order is needed to build
successfully with -Wl,--as-needed