Undefined reference to `g_memdup2'

You sure you are building against Glib 2.70? I’d double check your linker. g_memdup2 should be there with any glib 2.68+ version.