<div dir="ltr"><div>FWIW, I encountered similar looking errors while trying to configure and build a statically linked gvim binary . The complete information (including configure logs etc.,) can be found at <a href="https://groups.google.com/forum/#!topic/vim_use/rQBp0rsJ98U" target="_blank">https://groups.google.com/forum/#!topic/vim_use/rQBp0rsJ98U</a> . <br>
<br></div><div>To summarize, consider the following<br>rajulocal@hogwarts:~/compile_static_gvim_native/problems$ cat conftest.c <br>/* confdefs.h */<br>#define PACKAGE_NAME ""<br>#define PACKAGE_TARNAME ""<br>
#define PACKAGE_VERSION ""<br>#define PACKAGE_STRING ""<br>#define PACKAGE_BUGREPORT ""<br>#define PACKAGE_URL ""<br>#define UNIX 1<br>#define STDC_HEADERS 1<br>#define HAVE_SYS_WAIT_H 1<br>
#define HAVE_SELINUX 1<br>#define FEAT_HUGE 1<br>#define USE_XSMP_INTERACT 1<br>#define HAVE_LIBNSL 1<br>#define FEAT_NETBEANS_INTG 1<br>/* end confdefs.h. */<br>#include <X11/Xlib.h><br>int<br>main ()<br>{<br>XrmInitialize ()<br>
;<br> return 0;<br>}<br><br></div><div>This program compiles without the "-static" option. But gives errors otherwise.<br><br>The following command works. But the one after does not.<br><br>rajulocal@hogwarts:~/compile_static_gvim_native/problems$ gcc -o conftest -g -O2 -I/usr/local/include -L/usr/local/lib file1.c -lX11 -lnsl -lselinux<br>
<br>rajulocal@hogwarts:~/compile_static_gvim_native/problems$ gcc -o conftest -g -O2 -I/usr/local/include -static -L/usr/local/lib file1.c -lX11 -lnsl -lselinux<br>/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xim_trans.o): In function `_XimXTransSocketUNIXConnect':<br>
(.text+0xe12): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking<br>/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o): In function `require_socket':<br>
(.text+0x652): undefined reference to `xcb_take_socket'<br>/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o): In function `poll_for_event':<br>(.text+0x7d4): undefined reference to `xcb_poll_for_event'<br>
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o): In function `poll_for_response':<br>(.text+0x8c2): undefined reference to `xcb_poll_for_reply'<br>/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o): In function `_XSend':<br>
(.text+0xada): undefined reference to `xcb_writev'<br>/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o): In function `_XReadEvents':<br>(.text+0xc38): undefined reference to `xcb_connection_has_error'<br>
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o): In function `_XReadEvents':<br>(.text+0xcd4): undefined reference to `xcb_wait_for_event'<br>/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o): In function `_XEventsQueued':<br>
(.text+0xdfd): undefined reference to `xcb_connection_has_error'<br>/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o): In function `_XAllocIDs':<br>(.text+0xedb): undefined reference to `xcb_generate_id'<br>
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o): In function `_XReply':<br>(.text+0x1045): undefined reference to `xcb_wait_for_reply'<br>/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(ClDisplay.o): In function `XCloseDisplay':<br>
(.text+0xd3): undefined reference to `xcb_disconnect'<br>/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(OpenDis.o): In function `OutOfMemory':<br>(.text+0x4d4): undefined reference to `xcb_disconnect'<br>
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(OpenDis.o): In function `XOpenDisplay':<br>(.text+0x8fd): undefined reference to `xcb_get_setup'<br>/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(OpenDis.o): In function `XOpenDisplay':<br>
(.text+0xb41): undefined reference to `xcb_get_maximum_request_length'<br>/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':<br>(.text+0x1ac): undefined reference to `xcb_parse_display'<br>
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':<br>(.text+0x206): undefined reference to `xcb_connect_to_display_with_auth_info'<br>/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':<br>
(.text+0x226): undefined reference to `xcb_get_file_descriptor'<br>/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':<br>(.text+0x243): undefined reference to `xcb_generate_id'<br>
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':<br>(.text+0x29c): undefined reference to `pthread_cond_init'<br>/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':<br>
(.text+0x2ae): undefined reference to `pthread_cond_init'<br>/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':<br>(.text+0x2b6): undefined reference to `xcb_connection_has_error'<br>
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':<br>(.text+0x2d6): undefined reference to `xcb_connect'<br>collect2: error: ld returned 1 exit status<br>
<br>rajulocal@hogwarts:~/compile_static_gvim_native/problems$ gcc -v<br>Using built-in specs.<br>COLLECT_GCC=gcc<br>COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper<br>Target: x86_64-linux-gnu<br>Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu<br>
Thread model: posix<br>gcc version 4.7.2 (Debian 4.7.2-5) <br><br>rajulocal@hogwarts:~/compile_static_gvim_native/problems$ dpkg -l libc6 <br>ii libc6:amd64 2.13-38 amd64 Embedded GNU C Library: Shared libraries<br>
ii libc6:i386 2.13-38 i386 Embedded GNU C Library: Shared libraries<br><br>rajulocal@hogwarts:~/compile_static_gvim_native/problems$ uname -a<br>
Linux hogwarts 3.2.0-4-amd64 #1 SMP Debian 3.2.39-2 x86_64 GNU/Linux<br><br>-- <br></div><div>Kamaraju S. Kusumanchi<br><a href="http://malayamaarutham.blogspot.com/">http://malayamaarutham.blogspot.com/</a><br></div></div>