Bug 531496 - configure.ac should use 'ld' from $PATH for checking version-script syntax, not hardcode /usr/bin/ld
Summary: configure.ac should use 'ld' from $PATH for checking version-script syntax, n...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-10-28 15:43 UTC by Steve Yarmie
Modified: 2015-03-16 14:43 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-16 14:43:33 UTC
Embargoed:


Attachments (Terms of Use)
patch to add ws in src/Makefile.in (507 bytes, patch)
2009-10-28 15:51 UTC, Steve Yarmie
no flags Details | Diff
here's the corrected patch (410 bytes, patch)
2009-11-09 06:15 UTC, Steve Yarmie
no flags Details | Diff

Description Steve Yarmie 2009-10-28 15:43:49 UTC
Description of problem:
libvirt-0.7.2/src/Makefile.in line 1918 missing a space here:
 $(VERSION_SCRIPT_FLAGS)<SPACE>libvirt.syms

Version-Release number of selected component (if applicable):
libvirt-0.7.2

How reproducible:
./configure && make ...

Steps to Reproduce:
1. ./configure ...
2. make
3.
  
Actual results:

[...]
../gnulib/lib/.libs/libgnu.a(vasnprintf.o)
(--whole-archivelibvirt.syms: file not recognized: File format not recognized
collect2: ld returned 1 exit status )
make[3]: *** [libvirt.la] Error 1
make[3]: Leaving directory `/mnt/iscsi/1/src/kvm/src/libvirt/libvirt-0.7.2-bin-amd-001/src'

Expected results:
clean build ;)

Additional info:
Patch attached...

Comment 1 Steve Yarmie 2009-10-28 15:51:50 UTC
Created attachment 366456 [details]
patch to add ws in src/Makefile.in

Comment 2 Daniel Berrangé 2009-10-28 16:00:54 UTC
There is not supposed to be any whitespace in there.

  $(VERSION_SCRIPT_FLAGS)

expands to  "-Wl,--version-script="  which thus results in

  -Wl,--version-script=libvirt.syms

being passed to GCC.  Adding in whitespace would break this.

Comment 3 Steve Yarmie 2009-10-28 17:55:42 UTC
Thanks. For some reason on my systems it's expanding as :
VERSION_SCRIPT_FLAGS = -Wl,-M -Wl,
without "--version-script="
I used two different toolchains and still got the same result. 
I'm investigating further...

Comment 4 Steve Yarmie 2009-10-28 18:43:48 UTC
I found that line 69 of configure.in does a check to see if `ld` supports the --version-script option. The test is written with hard-coded /path/to/ld
(/usr/bin/ld is assumed).

I keep my toolchain segregated from the system software - e.g.:in /opt/dev/*
so the check failed for me - causing the option to be omitted from VERSION_SCRIPT_FLAGS.

Perhaps there needs to be a check for path to `ld` 
I can imagine someone simply installing binutils in /usr/local while some other `ld` is in /usr/bin and possibly getting unexpected results... just a thought

Comment 5 Daniel Berrangé 2009-10-28 18:48:47 UTC
So if we just change the configure script too run  'ld' instead of '/usr/bin/ld'  would that be sufficient for you ?  I assume you'd have your desired /opt/dev/<BLAH>  directory in $PATH before running configure ..

Comment 6 Steve Yarmie 2009-10-28 19:29:12 UTC
If I just edit the configure script to run `ld` everything works perfectly

If I edit configure.in and then run autogen.sh the src/Makefile results for VERSION_SCRIPT_FLAGS is fine but:

the build failed because the generated libtool script dies with errors.
_This is probably unrelated to the original problem_, but instead could be because my toolchain is very new (autoconf-2.6.4 automake-1.11 libtool-2.2.6  binutils-2.19.1 gcc-4.4.2 )

Comment 7 Daniel Berrangé 2009-10-28 19:53:07 UTC
Yeah that second issue is almost certainly a compatibility problem with the autotools versions

Comment 8 Steve Yarmie 2009-11-09 06:15:43 UTC
Created attachment 368114 [details]
here's the corrected patch

corrected patch simply adjusts configure.in to use 'ld' from PATH

Comment 9 Ján Tomko 2015-03-16 14:43:33 UTC
Fixed by:
commit 98fb83ce25f46e0236706fa6e0943032d921935f
Author:     Matthias Bolte <matthias.bolte>
AuthorDate: 2010-04-27 09:43:55 +0200
Commit:     Matthias Bolte <matthias.bolte>
CommitDate: 2010-04-28 23:49:00 +0200

    cygwin/mingw: Fix version script handling
    
    Let configure detect ld instead of hardcoding /usr/bin/ld, because
    MinGW may have ld in /bin.
    
    Only use a .def file to export symbols on MinGW. Cygwin's ld supports
    the normal .syms file used on Linux.

git describe: v0.8.0-136-g98fb83c contains: v0.8.1~27


Note You need to log in before you can comment on or make changes to this bug.