bugGNU Wget - Bugs: bug #50260, Link failed caused by bad linker...

 
 

bug #50260: Link failed caused by bad linker option -R

Submitter:  Yousong Zhou <yousong>
Submitted:  Thu 09 Feb 2017 03:14:16 AM UTC
   
 
Category:  Build/Install Severity:  3 - Normal
Priority:  5 - Normal Status:  Fixed
Privacy:  Public Assigned to:  rockdaboot
Originator Name:  Open/Closed:  Closed
Release:  1.19 Operating System:  GNU/Linux
Reproducibility:  Every Time Fixed Release:  None
Planned Release:  1.19.1 Regression:  Yes
Work Required:  None Patch Included:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 10 Feb 2017 04:27:35 PM UTC, comment #8: 

Thanks for all your work and feedback !

Just pushed a commit to fix this.

Tim Ruehsen <rockdaboot>
Group administrator
Fri 10 Feb 2017 11:53:51 AM UTC, comment #7: 

Yes, using LIB<NAME> instead of LTLIB<NAME> worked.  And indeed, according to the gnulib manual, the LTLIB<NAME> was intended for linking with libtool.

https://www.gnu.org/software/gnulib/manual/html_node/Searching-for-Libraries.html

Yousong Zhou <yousong>
Fri 10 Feb 2017 09:04:24 AM UTC, comment #6: 

Please explain what makes you think it was that commit.

If it is, could you change
  $(LTLIBICONV) $(LTLIBINTL) $(LTLIBTHREAD)
into
  $(LIBICONV) $(LIBINTL) $(LIBTHREAD)
and test again ?

The LT prefix should be no harm when not using libtool, but who knows...


Tim Ruehsen <rockdaboot>
Group administrator
Fri 10 Feb 2017 07:00:10 AM UTC, comment #5: 

Digging further, this was probably caused by the commit adding LTLIBICONV to LDADD for wget


commit d4f97dc9afd149afe1f7b16a84eebb4bab1f044a
Author: Tim Rühsen <tim.ruehsen@gmx.de>
Date:   Sat Jun 11 22:38:42 2016 +0200

    Add libraries to LDADD for wget

    * src/Makefile.am: Add $(GETADDRINFO_LIB) $(HOSTENT_LIB) $(INET_NTOP_LIB)
     $(LIBSOCKET) $(LIB_CLOCK_GETTIME) $(LIB_CRYPTO) $(LIB_SELECT)
     $(LTLIBICONV) $(LTLIBINTL) $(LTLIBTHREAD) $(SERVENT_LIB) to LDADD


Yousong Zhou <yousong>
Fri 10 Feb 2017 05:13:29 AM UTC, comment #4: 

The error happened with wget-1.19 vanilla tarball.

The -R option was probably from m4/lib-link.m4 (search for "-R$found_dir" in that file) and according from the comment there, it was intended for libtool.

That macro in m4/lib-link.m4 was imported by the AM_ICONV macro in configure.ac

Below is the related snippet in the generated src/Makefile after configure run


LTLIBICONV='-L/home/yousong/.usr/lib -liconv -R/home/yousong/.usr/lib'


Note that I have those wget dependency libs including libiconv-1.14 in a non-standard location ~/.usr/

This should be reproducible with the following steps

 - clone the build-scripts git repo
 - remove the do_patch func in build-wget.sh
 - remove the PKG_AUTOCONF_FIXUP=1 in build-wget.sh
 - "make wget/install/test" will build do the download, compile, install is test_dir/ without polluting system-level settings.

Yousong Zhou <yousong>
Thu 09 Feb 2017 11:32:02 AM UTC, comment #3: 

Wget does/should not use libtool.

The -R option seems to be a linker (ld) option, the whole issue is not reproducible here (also GNU/Linux).

Please attach config.log and all the exact steps (tarball/git, bootstrap, configure, etc) plus the output.

Tim Ruehsen <rockdaboot>
Group administrator
Thu 09 Feb 2017 07:07:33 AM UTC, comment #2: 

Patching configure.ac to use libtool with AC_PROG_LIBTOOL fixed the link issue for me, though I had to also patch the m4/po.m4 file to workaround the gettext version check.

The patch hunks are available at https://github.com/yousong/build-scripts/blob/683ff79878665fd1a422c4f9a8fddf2fd30be718/build-wget.sh.  Feel free to pick them if they suit your needs ;)

Yousong Zhou <yousong>
Thu 09 Feb 2017 03:16:35 AM UTC, comment #1: 

Sorry, 1.17.1 was intended as a comparison instead of 1.18.

Yousong Zhou <yousong>
Thu 09 Feb 2017 03:14:16 AM UTC, original submission:  

With 1.19


gcc  -I/home/yousong/.usr/include   -I/home/yousong/.usr/include   -DHAVE_LIBSSL -I/home/yousong/.usr/include   -DNDEBUG -isystem /home/yousong/.usr/include  -L/home/yousong/.usr/lib -Wl,-rpath,/home/yousong/.usr/lib -L/home/yousong/.usr/lib64 -Wl,-rpath,/home/yousong/.usr/lib64 -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 xattr.o utils.o exits.o build_info.o   version.o ftp-opie.o openssl.o http-ntlm.o ../lib/libgnu.a     -lrt     -L/home/yousong/.usr/lib -liconv -R/home/yousong/.usr/lib     -L/home/yousong/.usr/lib -lpcre   -luuid -L/home/yousong/.usr/lib -lssl -lcrypto   -L/home/yousong/.usr/lib -lz
gcc: error: unrecognized option '-R'


With 1.18


gcc  -I/home/yousong/.usr/include   -I/home/yousong/.usr/include   -DHAVE_LIBSSL -I/home/yousong/.usr/include   -DNDEBUG -isystem /home/yousong/.usr/include  -L/home/yousong/.usr/lib -Wl,-rpath,/home/yousong/.usr/lib -L/home/yousong/.usr/lib64 -Wl,-rpath,/home/yousong/.usr/lib64 -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 /home/yousong/.usr/lib/libiconv.so -Wl,-rpath -Wl,/home/yousong/.usr/lib  -L/home/yousong/.usr/lib -lpcre   -luuid -L/home/yousong/.usr/lib -lssl -lcrypto   -L/home/yousong/.usr/lib -lz    -lrt


The problem is that I build my own copy of wget and its dependencies and install them into a non-standard location.  The build system of wget incorrectly thought that libtool was used and specified the library location with -R which gcc did not understand and erred.

The script I am using is available at https://github.com/yousong/build-scripts/blob/master/build-wget.sh

Yousong Zhou <yousong>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-02-10 rockdaboot StatusNone Fixed
        Assigned toNone rockdaboot
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.19.1

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code