Jean Delvare | 17 Apr 13:34 2012

Re: make lm-sensors 3.3.2 ERROR /usr/bin/ld.bfd.real: cannot find -liconv

Hi Martin,

Again, please keep the discussion list in Cc, for the interest of
other readers and the archives.

On Mon, 16 Apr 2012 18:13:38 +0100, Martin Suchanek wrote:
> > Please list all files that match /usr/lib/libiconv.so.*, and for each
> > of them, check which package provides it.
> >
> only
> /usr/lib/libiconv.so.2 ... php-5.3-fcgi-zend-server package

Hmm, OK. Very odd to have a generic library in such a specific package.
I presume this package isn't part of Ubuntu but is a proprietary
package from Zend?

> Then as a test you can edit prog/sensors/Module.mk, search for the
> > following line:
> >
> > LIBICONV := $(shell if /sbin/ldconfig -p | grep -q libiconv\\.so ; then
> > echo \-liconv; else echo; fi)
> >
> > Replace with:
> >
> > LIBICONV :=
> >
> > and try building again. Obviously this can't be a definitive fix but at
> > least it will tell us if you really need libiconv or not.
> >
> compiled ok
(Continue reading)

Martin Suchanek | 18 Apr 12:20 2012

Re: make lm-sensors 3.3.2 ERROR /usr/bin/ld.bfd.real: cannot find -liconv



On Tue, Apr 17, 2012 at 12:34 PM, Jean Delvare <khali <at> linux-fr.org> wrote:
Hi Martin,

Again, please keep the discussion list in Cc, for the interest of
other readers and the archives. 

Sorry, my bad habits within emailing with proprietary technical support - they have always interest about vice versa.

On Mon, 16 Apr 2012 18:13:38 +0100, Martin Suchanek wrote:
> > Please list all files that match /usr/lib/libiconv.so.*, and for each
> > of them, check which package provides it.
> >
> only
> /usr/lib/libiconv.so.2 ... php-5.3-fcgi-zend-server package

Hmm, OK. Very odd to have a generic library in such a specific package.
I presume this package isn't part of Ubuntu but is a proprietary
package from Zend?

Yes , it is proprietary package from Zend
 
> Then as a test you can edit prog/sensors/Module.mk, search for the
> > following line:
> >
> > LIBICONV := $(shell if /sbin/ldconfig -p | grep -q libiconv\\.so ; then
> > echo \-liconv; else echo; fi)
> >
> > Replace with:
> >
> > LIBICONV :=
> >
> > and try building again. Obviously this can't be a definitive fix but at
> > least it will tell us if you really need libiconv or not.
> >
> compiled ok
>
> Is there some conflict ?

Not really a conflict, rather the build system is confused because
libiconf.so.2 is available at runtime but libiconf.so isn't available
for build-time linking. I think we should ignore libiconv in this case,
and hope it's not needed. Please revert the previous change and try the
following patch instead, I'll apply it if it works for you.

---
 prog/sensors/Module.mk |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- lm-sensors.orig/prog/sensors/Module.mk      2008-03-26 14:37:44.000000000 +0100
+++ lm-sensors/prog/sensors/Module.mk   2012-04-17 13:32:29.857884198 +0200
<at> <at> -37,7 +37,7 <at> <at> INCLUDEFILES += $(PROGSENSORSSOURCES:.c=
 REMOVESENSORSBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(BINDIR)/%,$(PROGSENSORSTARGETS))
 REMOVESENSORSMAN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(PROGSENSORSMAN1DIR)/%,$(PROGSENSORSMAN1FILES))

-LIBICONV := $(shell if /sbin/ldconfig -p | grep -q libiconv\\.so ; then echo \-liconv; else echo; fi)
+LIBICONV := $(shell if /sbin/ldconfig -p | grep -q '/libiconv\.so$' ; then echo \-liconv; else echo; fi)

 $(PROGSENSORSTARGETS): $(PROGSENSORSSOURCES:.c=.ro) lib/$(LIBSHBASENAME)
       $(CC) $(EXLDFLAGS) -o $ <at> $(PROGSENSORSSOURCES:.c=.ro) $(LIBICONV) -Llib -lsensors


--
This '/libiconv\.so$' gave me error "/bin/sh: Syntax error: Unterminated quoted string". I do not know why ?

add info - /sbin/ldconfig -p | grep 'libiconv' returned:
    libiconv_hook.so.1 (libc6,x86-64) => /usr/lib/libiconv_hook.so.1
    libiconv_hook.so (libc6,x86-64) => /usr/lib/libiconv_hook.so
    libiconv.so.2 (libc6,x86-64) => /usr/lib/libiconv.so.2


Regards,
Martin
 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors <at> lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Jean Delvare | 18 Apr 13:22 2012

Re: make lm-sensors 3.3.2 ERROR /usr/bin/ld.bfd.real: cannot find -liconv

On Wed, 18 Apr 2012 11:20:40 +0100, Martin Suchanek wrote:
> This '/libiconv\.so$' gave me error "/bin/sh: Syntax error: Unterminated
> quoted string". I do not know why ?

My bad, I should have tested more carefully. I tested the command
outside of "make" and it worked, but "make" interprets '$' so it needs
special care.

Updated patch follows, hopefully it will work OK this time:

---
 prog/sensors/Module.mk |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- lm-sensors.orig/prog/sensors/Module.mk	2008-03-26 14:37:44.000000000 +0100
+++ lm-sensors/prog/sensors/Module.mk	2012-04-18 13:17:51.978110528 +0200
 <at>  <at>  -37,7 +37,7  <at>  <at>  INCLUDEFILES += $(PROGSENSORSSOURCES:.c=
 REMOVESENSORSBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(BINDIR)/%,$(PROGSENSORSTARGETS))
 REMOVESENSORSMAN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(PROGSENSORSMAN1DIR)/%,$(PROGSENSORSMAN1FILES))

-LIBICONV := $(shell if /sbin/ldconfig -p | grep -q libiconv\\.so ; then echo \-liconv; else echo; fi)
+LIBICONV := $(shell if /sbin/ldconfig -p | grep -q '/libiconv\.so$$' ; then echo \-liconv; else echo; fi)

 $(PROGSENSORSTARGETS): $(PROGSENSORSSOURCES:.c=.ro) lib/$(LIBSHBASENAME)
 	$(CC) $(EXLDFLAGS) -o $ <at>  $(PROGSENSORSSOURCES:.c=.ro) $(LIBICONV) -Llib -lsensors

--

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors <at> lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

Martin Suchanek | 18 Apr 15:11 2012

Re: make lm-sensors 3.3.2 ERROR /usr/bin/ld.bfd.real: cannot find -liconv



On Wed, Apr 18, 2012 at 12:22 PM, Jean Delvare <khali <at> linux-fr.org> wrote:
On Wed, 18 Apr 2012 11:20:40 +0100, Martin Suchanek wrote:
> This '/libiconv\.so$' gave me error "/bin/sh: Syntax error: Unterminated
> quoted string". I do not know why ?

My bad, I should have tested more carefully. I tested the command
outside of "make" and it worked, but "make" interprets '$' so it needs
special care.

Updated patch follows, hopefully it will work OK this time:

---
 prog/sensors/Module.mk |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- lm-sensors.orig/prog/sensors/Module.mk      2008-03-26 14:37:44.000000000 +0100
+++ lm-sensors/prog/sensors/Module.mk   2012-04-18 13:17:51.978110528 +0200
<at> <at> -37,7 +37,7 <at> <at> INCLUDEFILES += $(PROGSENSORSSOURCES:.c=
 REMOVESENSORSBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(BINDIR)/%,$(PROGSENSORSTARGETS))
 REMOVESENSORSMAN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(PROGSENSORSMAN1DIR)/%,$(PROGSENSORSMAN1FILES))

-LIBICONV := $(shell if /sbin/ldconfig -p | grep -q libiconv\\.so ; then echo \-liconv; else echo; fi)
+LIBICONV := $(shell if /sbin/ldconfig -p | grep -q '/libiconv\.so$$' ; then echo \-liconv; else echo; fi)

 $(PROGSENSORSTARGETS): $(PROGSENSORSSOURCES:.c=.ro) lib/$(LIBSHBASENAME)
       $(CC) $(EXLDFLAGS) -o $ <at> $(PROGSENSORSSOURCES:.c=.ro) $(LIBICONV) -Llib -lsensors


compiled/installed succesfully.
Should I test it by some way ?

(
There is one warning within sudo make install:
******************************************************************************
Warning: Library directory /usr/local/lib is not in /etc/ld.so.conf!
         Add it and run /sbin/ldconfig for the userspace tools to work.
******************************************************************************
I have checked /etc/ld.so.conf and it contains include /etc/ld.so.conf.d/*.conf which actually include /usr/local/bin in /etc/ld.so.conf.d/libc.conf
)

cheers,
Martin
--
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors <at> lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Jean Delvare | 18 Apr 16:42 2012

Re: make lm-sensors 3.3.2 ERROR /usr/bin/ld.bfd.real: cannot find -liconv

On Wed, 18 Apr 2012 14:11:47 +0100, Martin Suchanek wrote:
> On Wed, Apr 18, 2012 at 12:22 PM, Jean Delvare <khali <at> linux-fr.org> wrote:
> > My bad, I should have tested more carefully. I tested the command
> > outside of "make" and it worked, but "make" interprets '$' so it needs
> > special care.
> >
> > Updated patch follows, hopefully it will work OK this time:
> >
> > ---
> >  prog/sensors/Module.mk |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > --- lm-sensors.orig/prog/sensors/Module.mk      2008-03-26
> > 14:37:44.000000000 +0100
> > +++ lm-sensors/prog/sensors/Module.mk   2012-04-18 13:17:51.978110528 +0200
> >  <at>  <at>  -37,7 +37,7  <at>  <at>  INCLUDEFILES += $(PROGSENSORSSOURCES:.c=
> >  REMOVESENSORSBIN := $(patsubst
> > $(MODULE_DIR)/%,$(DESTDIR)$(BINDIR)/%,$(PROGSENSORSTARGETS))
> >  REMOVESENSORSMAN := $(patsubst
> > $(MODULE_DIR)/%,$(DESTDIR)$(PROGSENSORSMAN1DIR)/%,$(PROGSENSORSMAN1FILES))
> >
> > -LIBICONV := $(shell if /sbin/ldconfig -p | grep -q libiconv\\.so ; then
> > echo \-liconv; else echo; fi)
> > +LIBICONV := $(shell if /sbin/ldconfig -p | grep -q '/libiconv\.so$$' ;
> > then echo \-liconv; else echo; fi)
> >
> >  $(PROGSENSORSTARGETS): $(PROGSENSORSSOURCES:.c=.ro) lib/$(LIBSHBASENAME)
> >        $(CC) $(EXLDFLAGS) -o $ <at>  $(PROGSENSORSSOURCES:.c=.ro) $(LIBICONV)
> > -Llib -lsensors
> >
> >
> > compiled/installed succesfully.
> Should I test it by some way ?

If it build OK (without warning), that should be enough.

> (
> There is one warning within sudo make install:
> ******************************************************************************
> Warning: Library directory /usr/local/lib is not in /etc/ld.so.conf!
>          Add it and run /sbin/ldconfig for the userspace tools to work.
> ******************************************************************************
> I have checked /etc/ld.so.conf and it contains include
> /etc/ld.so.conf.d/*.conf which actually include /usr/local/bin in
> /etc/ld.so.conf.d/libc.conf
> )

This is another bug, when this check was written the includes
in /etc/ld.so.conf did not exist. So the check should be completed to
take this case into account. The following patch should do. I know it's
not complete as I hardcoded /etc/ld.so.conf.d/*.conf but in practice
that should be good enough.

---
 lib/Module.mk |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- lm-sensors.orig/lib/Module.mk	2012-04-05 10:33:39.000000000 +0200
+++ lm-sensors/lib/Module.mk	2012-04-18 16:41:28.432532280 +0200
 <at>  <at>  -144,10 +144,10  <at>  <at>  endif
 	     echo '         Run the following command: rm /usr/lib/$(LIBSHBASENAME)*' ; \
 	     echo '******************************************************************************' ; \
 	   fi ; \
-	   grep -q '^$(LIBDIR)$$' /etc/ld.so.conf || \
-	   grep -q '^$(LIBDIR)[[:space:]:,=]' /etc/ld.so.conf || \
-	   grep -q '[[:space:]:,]$(LIBDIR)$$' /etc/ld.so.conf || \
-	   grep -q '[[:space:]:,]$(LIBDIR)[[:space:]:,=]' /etc/ld.so.conf || \
+	   cat /etc/ld.so.conf /etc/ld.so.conf.d/*.conf 2>/dev/null | grep -q '^$(LIBDIR)$$' || \
+	   cat /etc/ld.so.conf /etc/ld.so.conf.d/*.conf 2>/dev/null | grep -q '^$(LIBDIR)[[:space:]:,=]' || \
+	   cat /etc/ld.so.conf /etc/ld.so.conf.d/*.conf 2>/dev/null | grep -q '[[:space:]:,]$(LIBDIR)$$' || \
+	   cat /etc/ld.so.conf /etc/ld.so.conf.d/*.conf 2>/dev/null | grep -q
'[[:space:]:,]$(LIBDIR)[[:space:]:,=]' || \
 		( echo '******************************************************************************' ; \
 		  echo 'Warning: Library directory $(LIBDIR) is not in /etc/ld.so.conf!' ; \
 		  echo '         Add it and run /sbin/ldconfig for the userspace tools to work.' ; \

--

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors <at> lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

Andrey Repin | 19 Apr 13:15 2012
Picon

Re: make lm-sensors 3.3.2 ERROR /usr/bin/ld.bfd.real: cannot find -liconv

Greetings, Jean Delvare!

> -          grep -q '^$(LIBDIR)$$' /etc/ld.so.conf || \
> -          grep -q '^$(LIBDIR)[[:space:]:,=]' /etc/ld.so.conf || \
> -          grep -q '[[:space:]:,]$(LIBDIR)$$' /etc/ld.so.conf || \
> -          grep -q '[[:space:]:,]$(LIBDIR)[[:space:]:,=]' /etc/ld.so.conf || \
> +          cat /etc/ld.so.conf /etc/ld.so.conf.d/*.conf 2>/dev/null | grep -q '^$(LIBDIR)$$' || \
> +          cat /etc/ld.so.conf /etc/ld.so.conf.d/*.conf 2>/dev/null | grep -q '^$(LIBDIR)[[:space:]:,=]' || \
> +          cat /etc/ld.so.conf /etc/ld.so.conf.d/*.conf 2>/dev/null | grep -q '[[:space:]:,]$(LIBDIR)$$' || \
> +          cat /etc/ld.so.conf /etc/ld.so.conf.d/*.conf 2>/dev/null | grep -q
'[[:space:]:,]$(LIBDIR)[[:space:]:,=]' || \
>                 ( echo '******************************************************************************' ; \
>                   echo 'Warning: Library directory $(LIBDIR) is not in /etc/ld.so.conf!' ; \
>                   echo '         Add it and run /sbin/ldconfig for the userspace tools to work.' ; \

http://en.wikipedia.org/wiki/Cat_(Unix)#Useless_use_of_cat

Move file lists to grep, save yourself a few CPU cycles.

--
WBR,
Andrey Repin (hell-for-yahoo <at> umail.ru) 19.04.2012, <15:08>

Sorry for my terrible english...

_______________________________________________
lm-sensors mailing list
lm-sensors <at> lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

Jean Delvare | 19 Apr 15:26 2012

Re: make lm-sensors 3.3.2 ERROR /usr/bin/ld.bfd.real: cannot find -liconv

Hi Andrey,

On Thu, 19 Apr 2012 15:15:24 +0400, Andrey Repin wrote:
> Greetings, Jean Delvare!
> 
> > -          grep -q '^$(LIBDIR)$$' /etc/ld.so.conf || \
> > -          grep -q '^$(LIBDIR)[[:space:]:,=]' /etc/ld.so.conf || \
> > -          grep -q '[[:space:]:,]$(LIBDIR)$$' /etc/ld.so.conf || \
> > -          grep -q '[[:space:]:,]$(LIBDIR)[[:space:]:,=]' /etc/ld.so.conf || \
> > +          cat /etc/ld.so.conf /etc/ld.so.conf.d/*.conf 2>/dev/null | grep -q '^$(LIBDIR)$$' || \
> > +          cat /etc/ld.so.conf /etc/ld.so.conf.d/*.conf 2>/dev/null | grep -q '^$(LIBDIR)[[:space:]:,=]'
|| \
> > +          cat /etc/ld.so.conf /etc/ld.so.conf.d/*.conf 2>/dev/null | grep -q '[[:space:]:,]$(LIBDIR)$$'
|| \
> > +          cat /etc/ld.so.conf /etc/ld.so.conf.d/*.conf 2>/dev/null | grep -q
'[[:space:]:,]$(LIBDIR)[[:space:]:,=]' || \
> >                 ( echo '******************************************************************************' ; \
> >                   echo 'Warning: Library directory $(LIBDIR) is not in /etc/ld.so.conf!' ; \
> >                   echo '         Add it and run /sbin/ldconfig for the userspace tools to work.' ; \
> 
> http://en.wikipedia.org/wiki/Cat_(Unix)#Useless_use_of_cat
> 
> Move file lists to grep, save yourself a few CPU cycles.

This is on purpose. /etc/ld.so.conf.d/*.conf may match nothing (as is
the case on my own system), passing that as a parameter to "grep" would
cause it to return an error code, even if the requested directory was
found in /etc/ld.so.conf. This could be worked around by checking the
exact value of $? after the call, but this would make the code a lot
more complex than it is currently, for a rather small benefit. We don't
care that much about performance in "make install", you don't run that
command several times every day.

As far as performance is concerned, a much cheaper optimization is to
merge all 4 regular expressions into a single one - which I just did:
http://lm-sensors.org/changeset/6046

--

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors <at> lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors


Gmane