Fix Ptex for static linkage