bugGNU Wget - Bugs: bug #48193, Build fails unless -liconv set...

 
 

bug #48193: Build fails unless -liconv set explicitly in LDFLAGS

Submitted by:  ilovezfs <ilovezfs>
Submitted on:  Fri 10 Jun 2016 10:46:26 AM UTC  
 
Category:  Build/Install Severity:  3 - Normal
Priority:  5 - Normal Status:  Fixed
Privacy:  Public Assigned to:  Tim Ruehsen <rockdaboot>
Originator Name:  ilovezfs Open/Closed:  Closed
Release:  None Operating System:  Mac OS
Reproducibility:  None Fixed Release:  trunk
Planned Release:  2.0 Regression:  Yes
Work Required:  None Patch Included:  Yes

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Wed 15 Feb 2017 07:10:14 PM UTC, comment #17: 

My bad, just removing the single line indeed results in a broken configure script (it is just a shell script with an empty else block).

The warning about 'AM_PATH_GPGME' is expected, when you don't have libgpgme installed. But this is a different, unrelated issue.

Tim Ruehsen <rockdaboot>
Project AdministratorIn charge of this item.
Wed 15 Feb 2017 05:19:57 PM UTC, comment #16: 

I commented out that line.

Autoreconf emitted this warning: configure.ac:499: warning: macro 'AM_PATH_GPGME' not found in library

Then running ./configure ended with: ./configure: line 44129: syntax error near unexpected token `fi'
./configure: line 44129: `fi'

Apparently the entire else-block needed removal.  I did that, and then started over.  Autoreconf still emits the warning, but then ./configure succeeded and so did the subsequent `make`.

Charles <chdiza>
Mon 13 Feb 2017 09:06:45 AM UTC, comment #15: 

Thanks, your config.log shows what is going wrong...

In configure.ac there is a line
LIBICONV=
which was ok before a certain commit - nowadays we always need libiconv, so this line must be removed.

This line will only be executed with --disable-iri, as you found out.

Could you remove or comment that line, and execute autoreconf && ./configure <with your options incl. --disable-iri> && make. Just to make sure the problem is solved.

Tim Ruehsen <rockdaboot>
Project AdministratorIn charge of this item.
Sun 12 Feb 2017 10:58:03 PM UTC, comment #14: 

Ok, I uploaded those two things.

Charles <chdiza>
Sun 12 Feb 2017 05:14:07 PM UTC, comment #13: 

Please add your config.log and your src/config.h (after the ./configure that results in failures)

Tim Ruehsen <rockdaboot>
Project AdministratorIn charge of this item.
Sun 12 Feb 2017 03:02:04 PM UTC, comment #12: 

More info: it seems to be something about this particular set of config flags: --with-ssl=openssl --with-libssl-prefix=/usr/local/ssl --disable-pcre --disable-iri

If I simply get rid of the --disable-iri flag, 1.19.1 will build find on macOS 10.12.3.  If I readd that flag, I get the exact error message that started this thread.

Charles <chdiza>
Sun 12 Feb 2017 03:35:43 AM UTC, comment #11: 

This is not fixed as of 1.19.1.  I just tried building it on macOS 10.12.3 and got the exact error that initiated this thread.

Charles <chdiza>
Tue 21 Jun 2016 12:44:42 PM UTC, comment #10: 

Thanks, Bruno.

I added all the libraries (that gnulib-tool mentions) to the end of the link command.

Tim Ruehsen <rockdaboot>
Project AdministratorIn charge of this item.
Sun 19 Jun 2016 11:07:14 PM UTC, comment #9: 

Rather than
LDADD = $(LIBOBJS) $(LTLIBICONV) ../lib/libgnu.a
it would be better to write
LDADD = $(LIBOBJS) ../lib/libgnu.a $(LTLIBICONV)

The reason is that $(LTLIBICONV) refers to - more or less - a system library, and it can be a shared library. If the object files in libgnu.a reference the 'iconv' symbol but $(LIBOBJS) don't, you may still get a link error. Moving all the shared/system libraries to the end of the link command line fixes this.

Bruno Haible <haible>
Sat 11 Jun 2016 08:43:58 PM UTC, comment #8: 

Please everybody test the attached patch on different platforms and report back. Thanks.

(file #37453)

Tim Ruehsen <rockdaboot>
Project AdministratorIn charge of this item.
Sat 11 Jun 2016 12:40:34 PM UTC, comment #7: 

Yes, that worked.

For reference, the difference in the generated Makefile is
```
bash-3.2$ diff src/Makefile.orig src/Makefile
305c305,306
< wget_DEPENDENCIES = $(LIBOBJS) ../lib/libgnu.a
---

> am__DEPENDENCIES_1 =
> wget_DEPENDENCIES = $(LIBOBJS) $(am__DEPENDENCIES_1) ../lib/libgnu.a

721,723d721
< GPGME_CFLAGS =
< GPGME_CONFIG = no
< GPGME_LIBS =
1390c1388
< LDADD = $(LIBOBJS) ../lib/libgnu.a
---

> LDADD = $(LIBOBJS) $(LTLIBICONV) ../lib/libgnu.a


```

ilovezfs <ilovezfs>
Sat 11 Jun 2016 10:24:07 AM UTC, comment #6: 

As you can see, $(LTLIBICONV) should be added to the linking stage.
Maybe the whole src/Makefile.am should be rewritten... it looks quirked.

./boostrap says:
####
You may need to use the following Makefile variables when linking. Use them in <program>_LDADD when linking a program, or
in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library.
  $(GETADDRINFO_LIB)
  $(HOSTENT_LIB)
  $(INET_NTOP_LIB)
  $(LIBSOCKET)
  $(LIB_CLOCK_GETTIME)
  $(LIB_CRYPTO)
  $(LIB_SELECT)
  $(LTLIBICONV) when linking with libtool, $(LIBICONV) otherwise
  $(LTLIBINTL) when linking with libtool, $(LIBINTL) otherwise
  $(LTLIBTHREAD) when linking with libtool, $(LIBTHREAD) otherwise
  $(SERVENT_LIB)
####

Basically we should add all of them to wget_LDADD, to have gnulib working on all supported platforms. I am not a real expert here, though.

For further testing, please change this in src/Makefile.am:
-LDADD = $(LIBOBJS) ../lib/libgnu.a
+LDADD = $(LIBOBJS) $(LTLIBICONV) ../lib/libgnu.a

Then execute
  autoreconf && ./configure && make

Tim Ruehsen <rockdaboot>
Project AdministratorIn charge of this item.
Fri 10 Jun 2016 09:28:13 PM UTC, comment #5: 

bash-3.2$ grep -i iconv src/config.h src/Makefile
src/config.h:/* Define if you have the iconv() function and it works. */
src/config.h:#define HAVE_ICONV 1
src/config.h:/* Define to 1 if you have the <iconv.h> header file. */
src/config.h:#define HAVE_ICONV_H 1
src/config.h:/* Define as const if the declaration of iconv() needs const. */
src/config.h:#define ICONV_CONST
src/Makefile: $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/iconv_h.m4 \
src/Makefile:GNULIB_ICONV = 1
src/Makefile:ICONV_CONST =
src/Makefile:ICONV_H =
src/Makefile:LIBICONV =
src/Makefile:LTLIBICONV = -liconv
src/Makefile:NEXT_AS_FIRST_DIRECTIVE_ICONV_H = <iconv.h>
src/Makefile:NEXT_ICONV_H = <iconv.h>
src/Makefile:REPLACE_ICONV = 0
src/Makefile:REPLACE_ICONV_OPEN = 0
src/Makefile:REPLACE_ICONV_UTF = 0

ilovezfs <ilovezfs>
Fri 10 Jun 2016 09:04:45 PM UTC, comment #4: 

Ah, looks like something is missing in src/Makefile.am.

Please send the output of
  grep -i iconv src/config.h src/Makefile

Tim Ruehsen <rockdaboot>
Project AdministratorIn charge of this item.
Fri 10 Jun 2016 04:14:02 PM UTC, comment #3: 

Nope, same issue. I still have to manually add -liconv to LDFLAGS in the environment, otherwise make fails.

ilovezfs <ilovezfs>
Fri 10 Jun 2016 03:47:39 PM UTC, comment #2: 

Sorry, mistake by me - iconv is already included.

Please #include <iconv.h> unconditionally in src/url.c (remove the lines with #ifdef HAVE_ICONV and the corresponding #endif) and try again 'make'.

Tim Ruehsen <rockdaboot>
Project AdministratorIn charge of this item.
Fri 10 Jun 2016 03:40:47 PM UTC, comment #1: 

Could you add a line

iconv

to ./bootstrap.conf and execute

./bootstrap && ./configure && make again

And report back here if that solves the problem for you !?

Tim Ruehsen <rockdaboot>
Project AdministratorIn charge of this item.
Fri 10 Jun 2016 10:46:26 AM UTC, original submission:  

This is a regression introduced by 59b920874daa565a1323ffa1e756e80493190686

The error is
```
Making all in src
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
clang  -DNDEBUG    -o wget connect.o convert.o cookies.o ftp.o css_.o css-url.o ftp-basic.o ftp-ls.o hash.o host.o hsts.o html-parse.o html-url.o http.o init.o log.o main.o netrc.o progress.o ptimer.o recur.o res.o retr.o spider.o url.o warc.o utils.o exits.o build_info.o   version.o ftp-opie.o openssl.o http-ntlm.o ../lib/libgnu.a -L/usr/local/opt/openssl/lib -lssl -lcrypto -ldl -lz 
Undefined symbols for architecture x86_64:
  "_iconv", referenced from:
      _url_file_name in url.o
  "_iconv_close", referenced from:
      _url_file_name in url.o
  "_iconv_open", referenced from:
      _url_file_name in url.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

ilovezfs <ilovezfs>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #39746:  config.h added by chdiza (88KiB - application/octet-stream)
file #39747:  config.log added by chdiza (2MiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chdiza (Posted a comment)
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by rockdaboot (Posted a comment)
  • -email is unavailable- added by ilovezfs (Submitted the item)
  •  

     

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-02-15 rockdaboot Assigned toNone => rockdaboot
        Open/ClosedOpen => Closed
        Fixed ReleaseNone => trunk
        Planned Release1.18.1 => 2.0
    2017-02-12 chdiza Attached File- => Added config.h, #39746
        Attached File- => Added config.log, #39747
    2016-06-21 rockdaboot StatusNone => Fixed
        Planned ReleaseNone => 1.18.1
    2016-06-11 rockdaboot Attached File- => Added 0001-Add-libraries-to-LDADD-for-wget.patch, #37453
        Patch IncludedNone => Yes

    Back to the top


    Powered by Savane 3.5