fix linking with "-Wl,--as-needed"