Building glib on Mac OS X

I was trying to install glib 2.x in Mac OS X, as a result of some yak shaving. Unfortunately by default the autoconf build didn’t work for me, but bombed out during the make step with:

/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:
_res_9_dn_expand
_res_9_init
_res_9_query
_res_9_search
collect2: ld returned 1 exit status
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld:
   Undefined symbols:_res_9_dn_expand_res_9_init_res_9_query_res_9_searchcollect2:
   ld returned 1 exit status

Various people on the internet have reported the same problem in building other things, and the fix seems to be to specify -lresolv to the linker. I was able to do this with:

$ LIBS=-lresolv ./configure
$ make
$ make install

Leave a Reply