On Feb 10, 11:25 pm, Ben Schmidt <[email protected]> wrote: > >> $ cc -o conftest -g -I/usr/local/include -L/usr/local/lib conftest.c > >> -lm -ltermlib -lelf -lnsl -lsocket -liconv > >> "conftest.c", line 192: warning: statement not reached > > > This sounds like a bug with the linker for not erroring out when it > > can't link against the libraries it has been told to link with. I tried > > that test locally (Linux system, so gcc) and the compile/link failed. > > Just on the offchance...is the problem that /usr/local/lib is given > there with an -L option, so found while compiling/linking, but isn't in > your LIBPATH, so isn't being searched by ld at runtime? It's a bit of a > long shot, as I would expect a lot more to be broken if there are a > bunch of libs in /usr/local/lib not being found, but it's worth > checking.
In fact, this was the problem. For some reason known only to my sysadmin, there was a libiconv.so in /usr/local/lib, but it is not configured to be found at runtime (/usr/include/iconv.h and /usr/local/ include/iconv.h also exist). By adding --without-local-dir to my configure options, I was able to avoid the bug. > >> It seems to me that the correct solution is to *not* include -liconv > >> unless libiconv.so is actually present (and working). I'm not sure how > >> to achieve that with autoconf-style programs. The function being used > >> in this case is ac_fn_c_try_link() which has the following comment: > > > One could change configure to try and run the program, but that's > > generally to be avoided since it inhibits cross-compiling. > > Shouldn't the configure test just test for iconv headers and not include > the library if there are no headers? Whether cross compiling or not, > your development environment should be such that headers for installed > (on the target system) libraries are available, and headers for > non-installed libraries are not. If you have a situation where libiconv > is not installed, but you have headers floating around, you should trash > the headers (or install the library!). The feature test actually attempts to link the program (it doesn't just test for the header) and the linker does (correctly) fail if the library is not found at link time. So, without -L/usr/local/lib, - liconv is not added to LIBS and everything works properly. Thanks again for your help! -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
