1

I am trying to compile i3 version 4.14.1 under Cygwin 2.884 (Windows 7). I have installed needed libiconv library via Cygwin setup but while running ./configure I get this error:

configure: error: in `/home/msamec/Downloads/i3-4.14.1/x86_64-unknown cygwin':
configure: error: cannot find the required iconv_open() function despite trying 
to link with -liconv
See `config.log' for more details

Any clue what can I do to help it find the library?

I have tried to compile the library libiconv-1.13.1 manually but I have encountered some errors I don't know how to resolve:

libtool: link: /bin/gcc -shared  .libs/localcharset.o .libs/relocatable.o      -o .libs/cygcharset-1.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libcharset.dll.a
.libs/relocatable.o: In function `DllMain':
/home/msamec/Downloads/libiconv-1.13.1/libcharset/lib/./relocatable.c:324: undefined reference to `cygwin_conv_to_posix_path'
/home/msamec/Downloads/libiconv-1.13.1/libcharset/lib/./relocatable.c:324:(.text+0x113): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `cygwin_conv_to_posix_path'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:59: libcharset.la] Error 1
make[2]: Leaving directory '/home/msamec/Downloads/libiconv-1.13.1/libcharset/lib'
make[1]: *** [Makefile:34: all] Error 2
make[1]: Leaving directory '/home/msamec/Downloads/libiconv-1.13.1/libcharset'
make: *** [Makefile:42: lib/localcharset.h] Error 2

I have grepped the iconv_open() function name and found it in the cygwin folder

/usr/i686-pc-cygwin/sys-root/usr/include/iconv.h

and also in the libiconv folder

/usr/include/iconv.h

But for some reason the configure script is not able to find it.

Here is my config.log

Here is my iconv.h https://gist.github.com/anonymous/0b117d1680954d591f989256b508bfc5

I have checked where is this libary file inconv.h located on Ubuntu. Unlinke in cygwin it is in /lib/ while in cygwin it is here /usr/include/. Tried copying the library to that location but that did not help either. I was able to reproduce the issue on my home Windows 10 as well.

EDIT: Here is the configure file that I am using: enter link description here

  • /usr/i686-pc-cygwin/sys-root/usr/include/iconv.h is only for cross compilation – matzeri May 23 '18 at 3:39
1

The test is failing as

| char iconv_open ();
| int
| main ()
| {
| return iconv_open ();
|   ;
|   return 0;
| }
configure:6391: /bin/gcc -o conftest.exe    conftest.c -liconv  -lev  >&5
/tmp/ccz9hxNr.o:conftest.c:(.text+0xe): undefined reference to `iconv_open'
/tmp/ccz9hxNr.o:conftest.c:(.text+0xe): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `iconv_open'

is looking for iconv_open in the library libiconv, wrongly. The test code should use the provided /usr/include/iconv.h where there is a

#define iconv_open libiconv_open

and the cygwin library libiconv exports:

$ objdump -x /usr/lib/libiconv.dll.a | grep iconv_open
[  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 libiconv_open_into
[  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp_libiconv_open_into
[  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 libiconv_open
[  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp_libiconv_open

the symbol libiconv_open. You need to correct the test to use iconv.h.

The test is defined in configure.ac

AC_SEARCH_LIBS([iconv_open], [iconv], , [AC_MSG_FAILURE([cannot find the required iconv_open() function despite trying to link with -liconv])])

a possible workaround is to change it in something that will test both options.

AC_SEARCH_LIBS([iconv_open],[iconv],,
AC_SEARCH_LIBS([libiconv_open],[iconv],,[AC_MSG_FAILURE([cannot find the required iconv_open() function despite trying to link with -liconv])]))

Disclaimer: not tested and you need to run autoreconf to rebuild configure

  • Thanks a lot for the answer matzeri. I am not sure how to modify the test, I cannot find conftest.x anywhere. Do you mean that I should modfiy the configure script?I am still bit of a noob in makefiles and these things, I thought the problem might be in this area (starting on a line 6396 in configure script: for ac_lib in '' iconv; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_iconv_open=$ac_res fi – msam May 23 '18 at 8:49
  • I have added the link to the configure file gist to my original question. – msam May 23 '18 at 9:00
  • Thanks for update.This made the configure pass but then I got this error when I ran make: link – msam May 23 '18 at 14:23
  • Have you overwritten the /usr/include/iconv.h ? The content seem to not match with the original cygwin one. Line 79 is a comment. – matzeri May 23 '18 at 14:35
  • I think I probabbly did, I tried to compile it manually because I had no luck with original cygwin implementation. I just installed fresh cygwin in a different folder, and only added libiconv packages. There is no iconv.h in the /usr/include/ I found it only under /usr/i686-pc-cygwin/sys-root/usr/include – msam May 24 '18 at 7:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.