Fix compile with 'shared=no'.

Part of this patch was written by howard.liu@foxmail.com.

Reported-by:  howard.liu@foxmail.com
Signed-off-by: Ben Greear <greearb@candelatech.com>