An invalid path to the ref_glx.so file is present in version 0.12beta of ufoai.net. I have the same error under Linux as many had, but no proposed solution worked for me (changing vars in default.cfg, or other cmdline arguments). So I tried to "strace" ufoai, and i found:
stat64("// generated by ufo, do not modify/ref_glx.so", 0xbfcd4ee4) = -1 ENOENT (No such file or directory)
So the game is REALLY searching this file in the "/ generated by ufo, do not modify/" directory! To verify, I tried to create it and copy the file in it, and it worked!
mkdir "/ generated by ufo, do not modify/"
cp ref_glx.so "/ generated by ufo, do not modify/"
...