Skip to contentSkip to conversation

(from cvs) sensors binary compile probs on rh8

DISCUSSION Philip Edelbrock 3 participants 15 messages May 19, 2005

lore
Share & tools
lore
#0 lore raw

FYI-

gcc -o prog/sensors/sensors prog/sensors/main.ro prog/sensors/chips.ro -Llib -lsensors
lib/libsensors.so: undefined reference to log' lib/libsensors.so: undefined reference to exp'
collect2: ld returned 1 exit stat

Phil

#1 lore raw
Quoted 8 lines

FYI-

gcc -o prog/sensors/sensors prog/sensors/main.ro prog/sensors/chips.ro -Llib -lsensors
lib/libsensors.so: undefined reference to log' lib/libsensors.so: undefined reference to exp'
collect2: ld returned 1 exit stat

Looks like we need an extra "-lm" on the command line.

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
#2 lore raw
In reply to Philip Edelbrock
Quoted 5 lines

It's possible that it's just my strange computer. This isn't a RH8 install from scratch, but an upgrade. There could be a legacy lib or something causing trouble which may not appear on another Athlon running RH8.... has anybody else tried on an Athlon?

I got the very same CPU on one of my systems and never encountered the problem so far (including the latest pre-2.7.0 CVS snapshots). I'll retry to make sure.

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
#3 lore raw
In reply to Philip Edelbrock

Phil, what processor are you compiling for? Or what's wrong with <math.h>? It works for me, but gcc is generating floating point assembler instructions and so it doesn't need -lm.
If we do add a -lm it should be added to lib/Module.mk for the library, not in prog/sensors/Module.mk for sensors.

Quoted 11 lines · Jean Delvare
Quoted 7 lines

FYI-

gcc -o prog/sensors/sensors prog/sensors/main.ro prog/sensors/chips.ro -Llib -lsensors
lib/libsensors.so: undefined reference to log' lib/libsensors.so: undefined reference to exp'
collect2: ld returned 1 exit stat

Looks like we need an extra "-lm" on the command line.

#4 lore raw
In reply to Philip Edelbrock

A '-lm' tacked onto the end of the gcc seems to make it work, although I'm going to restart with an i2c patched kernel to be sure. Here's my system, btw:

[phil@drtheopolis phil]$ cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 6
model : 4
model name : AMD Athlon(tm) Processor
stepping : 2
cpu MHz : 1295.416
cache size : 256 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 mmx fxsr syscall mmxext 3dnowext 3dnow
bogomips : 2588.67

[phil@drtheopolis phil]$ cat /proc/version
Linux version 2.4.20-pre7 ([email protected]) (gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-112)) #2 SMP Sun Sep 15 12:47:08 PDT 2002

[phil@drtheopolis phil]$ lspci
00:00.0 Host bridge: Silicon Integrated Systems [SiS]: Unknown device 0730 (rev 02)
00:00.1 IDE interface: Silicon Integrated Systems [SiS] 5513 [IDE] (rev d0) 00:01.0 ISA bridge: Silicon Integrated Systems [SiS] 85C503/5513 00:01.2 USB Controller: Silicon Integrated Systems [SiS] 7001 (rev 07) 00:01.3 USB Controller: Silicon Integrated Systems [SiS] 7001 (rev 07) 00:01.4 Multimedia audio controller: Silicon Integrated Systems [SiS] SiS PCI Audio Accelerator (rev 02)
00:02.0 PCI bridge: Silicon Integrated Systems [SiS] 5591/5592 AGP 00:09.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139 (rev 10)
00:0e.0 USB Controller: VIA Technologies, Inc. VT82C586B USB (rev 50) 00:0e.1 USB Controller: VIA Technologies, Inc. VT82C586B USB (rev 50) 00:0e.2 USB Controller: VIA Technologies, Inc.: Unknown device 3104 (rev 51) 01:00.0 VGA compatible controller: Silicon Integrated Systems [SiS] SiS630 GUI Accelerator+3D (rev 31)

[phil@drtheopolis phil]$ gcc --version
gcc (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)

[phil@drtheopolis phil]$ cat /etc/redhat-release
Red Hat Linux release 8.0 (Psyche)

Phil

Quoted 25 lines · Mark Studebaker

Phil, what processor are you compiling for? Or what's wrong with <math.h>?
It works for me, but gcc is generating floating point assembler instructions
and so it doesn't need -lm.
If we do add a -lm it should be added to lib/Module.mk for the library, not in prog/sensors/Module.mk for sensors.

Quoted 12 lines · Jean Delvare
Quoted 7 lines

FYI-

gcc -o prog/sensors/sensors prog/sensors/main.ro prog/sensors/chips.ro -Llib -lsensors
lib/libsensors.so: undefined reference to log' lib/libsensors.so: undefined reference to exp'
collect2: ld returned 1 exit stat

Looks like we need an extra "-lm" on the command line.

#5 lore raw
In reply to Philip Edelbrock

:'(

[phil@drtheopolis phil]$ sensors -v
sensors version 2.7.0

[phil@drtheopolis phil]$ sensors
Segmentation fault (core dumped)

[phil@drtheopolis phil]$ gdb sensors
GNU gdb Red Hat Linux (5.2.1-4)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"...
(gdb) run
Starting program: /usr/local/bin/sensors

Program received signal SIGSEGV, Segmentation fault. 0x4207931a in strcmp () from /lib/i686/libc.so.6 (gdb) bt

#0  0x4207931a in strcmp () from /lib/i686/libc.so.6
#1  0x40028bd9 in sensors_match_chip () from /usr/lib/libsensors.so.1
#2  0x08049171 in do_the_real_work ()
#3  0x08049073 in main ()
#4  0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6

It's possible that it's just my strange computer. This isn't a RH8 install from scratch, but an upgrade. There could be a legacy lib or something causing trouble which may not appear on another Athlon running RH8.... has anybody else tried on an Athlon?

Phil

Quoted 25 lines · Mark Studebaker

Phil, what processor are you compiling for? Or what's wrong with <math.h>?
It works for me, but gcc is generating floating point assembler instructions
and so it doesn't need -lm.
If we do add a -lm it should be added to lib/Module.mk for the library, not in prog/sensors/Module.mk for sensors.

Quoted 12 lines · Jean Delvare
Quoted 7 lines

FYI-

gcc -o prog/sensors/sensors prog/sensors/main.ro prog/sensors/chips.ro -Llib -lsensors
lib/libsensors.so: undefined reference to log' lib/libsensors.so: undefined reference to exp'
collect2: ld returned 1 exit stat

Looks like we need an extra "-lm" on the command line.

#6 lore raw
In reply to Philip Edelbrock

don't know what the segfault problem is but I duplicated the log/exp not found on my redhat system so I'm putting in a -lm into lib/Module.mk now.
mds

Quoted 69 lines · Philip Edelbrock

:'(

[phil@drtheopolis phil]$ sensors -v
sensors version 2.7.0

[phil@drtheopolis phil]$ sensors
Segmentation fault (core dumped)

[phil@drtheopolis phil]$ gdb sensors
GNU gdb Red Hat Linux (5.2.1-4)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"...
(gdb) run
Starting program: /usr/local/bin/sensors

Program received signal SIGSEGV, Segmentation fault. 0x4207931a in strcmp () from /lib/i686/libc.so.6 (gdb) bt

#0  0x4207931a in strcmp () from /lib/i686/libc.so.6
#1  0x40028bd9 in sensors_match_chip () from /usr/lib/libsensors.so.1
#2  0x08049171 in do_the_real_work ()
#3  0x08049073 in main ()
#4  0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6

It's possible that it's just my strange computer. This isn't a RH8 install from scratch, but an upgrade. There could be a legacy lib or something causing trouble which may not appear on another Athlon running RH8.... has anybody else tried on an Athlon?

Phil

Quoted 26 lines · Mark Studebaker

Phil, what processor are you compiling for? Or what's wrong with <math.h>?
It works for me, but gcc is generating floating point assembler instructions
and so it doesn't need -lm.
If we do add a -lm it should be added to lib/Module.mk for the library, not in prog/sensors/Module.mk for sensors.

Quoted 13 lines · Jean Delvare
Quoted 7 lines

FYI-

gcc -o prog/sensors/sensors prog/sensors/main.ro prog/sensors/chips.ro -Llib -lsensors
lib/libsensors.so: undefined reference to log' lib/libsensors.so: undefined reference to exp'
collect2: ld returned 1 exit stat

Looks like we need an extra "-lm" on the command line.

#7 lore raw
In reply to Philip Edelbrock
Quoted 5 lines

my man page for ld.so clearly says that /usr/lib and /lib are last. You can also see this from the output of 'ldconfig -v'.

Is yours different?

arrakis:~> /sbin/ldconfig -Nv | grep ^/ | sed -e 's/:$//' /lib
/usr/lib
/opt/xpdf-1/lib
/usr/local/lib
/usr/X11R6/lib
/usr/i386-slackware-linux/lib
/opt/gnome/lib
/usr/openwin/lib
/opt/kde/lib

So I have /lib and /usr/lib first. Here follows my /etc/ld.so.conf for reference:

/opt/xpdf-1/lib
/usr/local/lib
/usr/X11R6/lib
/usr/i386-slackware-linux/lib
/opt/gnome/lib
/usr/openwin/lib
/opt/kde/lib

I guess the order depends on the system and we can't assume anything. Some shell/perl magic could let us know if more than one library is present and which one will be used. This is something I can do if you tell me where to do it and what it should do.

Signature · 2 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
#8 lore raw
In reply to Philip Edelbrock

guess you saw the mail that it's a libc 2.3 thing...
Can you recompile w/ -g (sensors and libsensors) and get a better bt? could be something I did to libsensors...

Quoted 69 lines · Philip Edelbrock

:'(

[phil@drtheopolis phil]$ sensors -v
sensors version 2.7.0

[phil@drtheopolis phil]$ sensors
Segmentation fault (core dumped)

[phil@drtheopolis phil]$ gdb sensors
GNU gdb Red Hat Linux (5.2.1-4)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"...
(gdb) run
Starting program: /usr/local/bin/sensors

Program received signal SIGSEGV, Segmentation fault. 0x4207931a in strcmp () from /lib/i686/libc.so.6 (gdb) bt

#0  0x4207931a in strcmp () from /lib/i686/libc.so.6
#1  0x40028bd9 in sensors_match_chip () from /usr/lib/libsensors.so.1
#2  0x08049171 in do_the_real_work ()
#3  0x08049073 in main ()
#4  0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6

It's possible that it's just my strange computer. This isn't a RH8 install from scratch, but an upgrade. There could be a legacy lib or something causing trouble which may not appear on another Athlon running RH8.... has anybody else tried on an Athlon?

Phil

Quoted 26 lines · Mark Studebaker

Phil, what processor are you compiling for? Or what's wrong with <math.h>?
It works for me, but gcc is generating floating point assembler instructions
and so it doesn't need -lm.
If we do add a -lm it should be added to lib/Module.mk for the library, not in prog/sensors/Module.mk for sensors.

Quoted 13 lines · Jean Delvare
Quoted 7 lines

FYI-

gcc -o prog/sensors/sensors prog/sensors/main.ro prog/sensors/chips.ro -Llib -lsensors
lib/libsensors.so: undefined reference to log' lib/libsensors.so: undefined reference to exp'
collect2: ld returned 1 exit stat

Looks like we need an extra "-lm" on the command line.

#9 lore raw
In reply to Philip Edelbrock

Ah, I found the trouble. I've got too many libsensors installed, and when sensors is compiled, it will link against an old one. At some point, we changed the default lib installation directory from /usr/lib to /usr/local/lib. Bins get linked against /usr/lib/libsensors.so instead of the newer /usr/local/libsensors.so.

So, in essence, a newer include for the lib is used to link against an old lib.

Once I deleted the old libs from /usr/lib and got it linking to the new lib, it worked fine.

Should we have a check for an old lib? Or explicitly link against libsensors.1.4.0.so (if this is possible?).

Phil

Quoted 80 lines · Mark Studebaker

guess you saw the mail that it's a libc 2.3 thing...
Can you recompile w/ -g (sensors and libsensors) and get a better bt? could be something I did to libsensors...

Quoted 72 lines · Philip Edelbrock

:'(

[phil@drtheopolis phil]$ sensors -v
sensors version 2.7.0

[phil@drtheopolis phil]$ sensors
Segmentation fault (core dumped)

[phil@drtheopolis phil]$ gdb sensors
GNU gdb Red Hat Linux (5.2.1-4)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) run
Starting program: /usr/local/bin/sensors

Program received signal SIGSEGV, Segmentation fault. 0x4207931a in strcmp () from /lib/i686/libc.so.6
(gdb) bt
#0 0x4207931a in strcmp () from /lib/i686/libc.so.6
#1 0x40028bd9 in sensors_match_chip () from /usr/lib/libsensors.so.1 #2 0x08049171 in do_the_real_work ()
#3 0x08049073 in main ()
#4 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6

It's possible that it's just my strange computer. This isn't a RH8 install from scratch, but an upgrade. There could be a legacy lib or something causing trouble which may not appear on another Athlon running RH8.... has anybody else tried on an Athlon?

Phil

Quoted 28 lines · Mark Studebaker

Phil, what processor are you compiling for? Or what's wrong with <math.h>?
It works for me, but gcc is generating floating point assembler instructions
and so it doesn't need -lm.
If we do add a -lm it should be added to lib/Module.mk for the library, not in prog/sensors/Module.mk for sensors.

Quoted 15 lines · Jean Delvare
Quoted 8 lines

FYI-

gcc -o prog/sensors/sensors prog/sensors/main.ro
prog/sensors/chips.ro
-Llib -lsensors
lib/libsensors.so: undefined reference to `log'
lib/libsensors.so: undefined reference to `exp'
collect2: ld returned 1 exit stat

Looks like we need an extra "-lm" on the command line.

#10 lore raw
In reply to Philip Edelbrock

From reading 'man ld.so' and 'man ldconfig', it's apparent that /usr/lib and /lib are searched _after_ all the libraries listed in /etc/ld.so.conf. So the only problem is if /usr/local/lib is not listed in /etc/ld.so.conf at all.

Did you have /usr/local/lib/ in /etc/ld.so.conf or did you have to add it?

If Redhat doesn't have /usr/local/lib in there, I think that's the check we need to have.

Quoted 104 lines · Philip Edelbrock

Ah, I found the trouble. I've got too many libsensors installed, and when sensors is compiled, it will link against an old one. At some point, we changed the default lib installation directory from /usr/lib to /usr/local/lib. Bins get linked against /usr/lib/libsensors.so instead of the newer /usr/local/libsensors.so.

So, in essence, a newer include for the lib is used to link against an old lib.

Once I deleted the old libs from /usr/lib and got it linking to the new lib, it worked fine.

Should we have a check for an old lib? Or explicitly link against libsensors.1.4.0.so (if this is possible?).

Phil

Quoted 81 lines · Mark Studebaker

guess you saw the mail that it's a libc 2.3 thing...
Can you recompile w/ -g (sensors and libsensors) and get a better bt? could be something I did to libsensors...

Quoted 73 lines · Philip Edelbrock

:'(

[phil@drtheopolis phil]$ sensors -v
sensors version 2.7.0

[phil@drtheopolis phil]$ sensors
Segmentation fault (core dumped)

[phil@drtheopolis phil]$ gdb sensors
GNU gdb Red Hat Linux (5.2.1-4)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) run
Starting program: /usr/local/bin/sensors

Program received signal SIGSEGV, Segmentation fault. 0x4207931a in strcmp () from /lib/i686/libc.so.6
(gdb) bt
#0 0x4207931a in strcmp () from /lib/i686/libc.so.6
#1 0x40028bd9 in sensors_match_chip () from /usr/lib/libsensors.so.1 #2 0x08049171 in do_the_real_work ()
#3 0x08049073 in main ()
#4 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6

It's possible that it's just my strange computer. This isn't a RH8 install from scratch, but an upgrade. There could be a legacy lib or something causing trouble which may not appear on another Athlon running RH8.... has anybody else tried on an Athlon?

Phil

Quoted 29 lines · Mark Studebaker

Phil, what processor are you compiling for? Or what's wrong with <math.h>?
It works for me, but gcc is generating floating point assembler instructions
and so it doesn't need -lm.
If we do add a -lm it should be added to lib/Module.mk for the library, not in prog/sensors/Module.mk for sensors.

Quoted 16 lines · Jean Delvare
Quoted 8 lines

FYI-

gcc -o prog/sensors/sensors prog/sensors/main.ro
prog/sensors/chips.ro
-Llib -lsensors
lib/libsensors.so: undefined reference to `log'
lib/libsensors.so: undefined reference to `exp'
collect2: ld returned 1 exit stat

Looks like we need an extra "-lm" on the command line.

#11 lore raw
In reply to Philip Edelbrock

(I can't remember if I've replied to this yet)

I didn't have to add /usr/local/lib to it (I've added it a long time ago), but it looks in /usr/lib first. In fact, I think /lib and /usr/lib are built into the lib search path and don't need to be in ld.so.conf?

I wonder if we can add a checking function in the include header to test for the lib version (and call it when sensors is run). The header version and the lib version should always be indentical, right?

Phil

Quoted 123 lines · Mark Studebaker
Quoted 2 lines

From reading 'man ld.so' and 'man ldconfig', it's apparent that /usr/lib and /lib are searched _after_ all

the libraries listed in /etc/ld.so.conf. So the only problem is if /usr/local/lib is not listed
in /etc/ld.so.conf at all.

Did you have /usr/local/lib/ in /etc/ld.so.conf or did you have to add it?

If Redhat doesn't have /usr/local/lib in there, I think that's the check we need to have.

Quoted 106 lines · Philip Edelbrock

Ah, I found the trouble. I've got too many libsensors installed, and when sensors is compiled, it will link against an old one. At some point, we changed the default lib installation directory from /usr/lib to /usr/local/lib. Bins get linked against /usr/lib/libsensors.so instead of the newer /usr/local/libsensors.so.

So, in essence, a newer include for the lib is used to link against an old lib.

Once I deleted the old libs from /usr/lib and got it linking to the new lib, it worked fine.

Should we have a check for an old lib? Or explicitly link against libsensors.1.4.0.so (if this is possible?).

Phil

Quoted 83 lines · Mark Studebaker

guess you saw the mail that it's a libc 2.3 thing...
Can you recompile w/ -g (sensors and libsensors) and get a better bt? could be something I did to libsensors...

Quoted 75 lines · Philip Edelbrock

:'(

[phil@drtheopolis phil]$ sensors -v
sensors version 2.7.0

[phil@drtheopolis phil]$ sensors
Segmentation fault (core dumped)

[phil@drtheopolis phil]$ gdb sensors
GNU gdb Red Hat Linux (5.2.1-4)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) run
Starting program: /usr/local/bin/sensors

Program received signal SIGSEGV, Segmentation fault. 0x4207931a in strcmp () from /lib/i686/libc.so.6
(gdb) bt
#0 0x4207931a in strcmp () from /lib/i686/libc.so.6
#1 0x40028bd9 in sensors_match_chip () from /usr/lib/libsensors.so.1 #2 0x08049171 in do_the_real_work ()
#3 0x08049073 in main ()
#4 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6

It's possible that it's just my strange computer. This isn't a RH8 install from scratch, but an upgrade. There could be a legacy lib or something causing trouble which may not appear on another Athlon running RH8.... has anybody else tried on an Athlon?

Phil

Quoted 31 lines · Mark Studebaker

Phil, what processor are you compiling for? Or what's wrong with <math.h>?
It works for me, but gcc is generating floating point assembler instructions
and so it doesn't need -lm.
If we do add a -lm it should be added to lib/Module.mk for the library,
not in prog/sensors/Module.mk for sensors.

Quoted 17 lines · Jean Delvare
Quoted 8 lines

FYI-

gcc -o prog/sensors/sensors prog/sensors/main.ro
prog/sensors/chips.ro
-Llib -lsensors
lib/libsensors.so: undefined reference to `log'
lib/libsensors.so: undefined reference to `exp'
collect2: ld returned 1 exit stat

Looks like we need an extra "-lm" on the command line.

#12 lore raw
In reply to Philip Edelbrock

my man page for ld.so clearly says that /usr/lib and /lib are last. You can also see this from the output of 'ldconfig -v'.

Is yours different?

Also note that the email we got a few days ago from the user, he was picking up the library in /usr/local/lib... so I'm really confused now...

Quoted 139 lines · Philip Edelbrock

(I can't remember if I've replied to this yet)

I didn't have to add /usr/local/lib to it (I've added it a long time ago), but it looks in /usr/lib first. In fact, I think /lib and /usr/lib are built into the lib search path and don't need to be in ld.so.conf?

I wonder if we can add a checking function in the include header to test for the lib version (and call it when sensors is run). The header version and the lib version should always be indentical, right?

Phil

Quoted 123 lines · Mark Studebaker
Quoted 2 lines

From reading 'man ld.so' and 'man ldconfig', it's apparent that /usr/lib and /lib are searched _after_ all

the libraries listed in /etc/ld.so.conf. So the only problem is if /usr/local/lib is not listed
in /etc/ld.so.conf at all.

Did you have /usr/local/lib/ in /etc/ld.so.conf or did you have to add it?

If Redhat doesn't have /usr/local/lib in there, I think that's the check we need to have.

Quoted 106 lines · Philip Edelbrock

Ah, I found the trouble. I've got too many libsensors installed, and when sensors is compiled, it will link against an old one. At some point, we changed the default lib installation directory from /usr/lib to /usr/local/lib. Bins get linked against /usr/lib/libsensors.so instead of the newer /usr/local/libsensors.so.

So, in essence, a newer include for the lib is used to link against an old lib.

Once I deleted the old libs from /usr/lib and got it linking to the new lib, it worked fine.

Should we have a check for an old lib? Or explicitly link against libsensors.1.4.0.so (if this is possible?).

Phil

Quoted 83 lines · Mark Studebaker

guess you saw the mail that it's a libc 2.3 thing...
Can you recompile w/ -g (sensors and libsensors) and get a better bt? could be something I did to libsensors...

Quoted 75 lines · Philip Edelbrock

:'(

[phil@drtheopolis phil]$ sensors -v
sensors version 2.7.0

[phil@drtheopolis phil]$ sensors
Segmentation fault (core dumped)

[phil@drtheopolis phil]$ gdb sensors
GNU gdb Red Hat Linux (5.2.1-4)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) run
Starting program: /usr/local/bin/sensors

Program received signal SIGSEGV, Segmentation fault. 0x4207931a in strcmp () from /lib/i686/libc.so.6
(gdb) bt
#0 0x4207931a in strcmp () from /lib/i686/libc.so.6
#1 0x40028bd9 in sensors_match_chip () from /usr/lib/libsensors.so.1 #2 0x08049171 in do_the_real_work ()
#3 0x08049073 in main ()
#4 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6

It's possible that it's just my strange computer. This isn't a RH8 install from scratch, but an upgrade. There could be a legacy lib or something causing trouble which may not appear on another Athlon running RH8.... has anybody else tried on an Athlon?

Phil

Quoted 31 lines · Mark Studebaker

Phil, what processor are you compiling for? Or what's wrong with <math.h>?
It works for me, but gcc is generating floating point assembler instructions
and so it doesn't need -lm.
If we do add a -lm it should be added to lib/Module.mk for the library,
not in prog/sensors/Module.mk for sensors.

Quoted 17 lines · Jean Delvare
Quoted 8 lines

FYI-

gcc -o prog/sensors/sensors prog/sensors/main.ro
prog/sensors/chips.ro
-Llib -lsensors
lib/libsensors.so: undefined reference to `log'
lib/libsensors.so: undefined reference to `exp'
collect2: ld returned 1 exit stat

Looks like we need an extra "-lm" on the command line.

#13 lore raw
In reply to Philip Edelbrock

The other day I put some makefile magic into lib/Module.mk which assumed /usr/lib and /lib were last. I'll rework it.

Quoted 33 lines · Jean Delvare
Quoted 4 lines

my man page for ld.so clearly says that /usr/lib and /lib are last. You can also see this from the output of 'ldconfig -v'.

Is yours different?

arrakis:~> /sbin/ldconfig -Nv | grep ^/ | sed -e 's/:$//' /lib
/usr/lib
/opt/xpdf-1/lib
/usr/local/lib
/usr/X11R6/lib
/usr/i386-slackware-linux/lib
/opt/gnome/lib
/usr/openwin/lib
/opt/kde/lib

So I have /lib and /usr/lib first. Here follows my /etc/ld.so.conf for reference:

/opt/xpdf-1/lib
/usr/local/lib
/usr/X11R6/lib
/usr/i386-slackware-linux/lib
/opt/gnome/lib
/usr/openwin/lib
/opt/kde/lib

I guess the order depends on the system and we can't assume anything. Some shell/perl magic could let us know if more than one library is present and which one will be used. This is something I can do if you tell me where to do it and what it should do.

#14 lore raw
In reply to Philip Edelbrock

I don't have /lib listed in ld.so.conf, but it checks it first, followed by /usr/lib, then the paths I listed in /usr/lib. This is rh8.0 with ldconfig (GNU libc) 2.2.93. You probably know this, but you can check to see which libs are used by doing a 'ldd sensors', btw. Mine says:

[root@drtheopolis afpd]# ldd /usr/local/bin/sensors

        libsensors.so.1 => /usr/local/lib/libsensors.so.1 (0x40024000)
        libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
        libm.so.6 => /lib/i686/libm.so.6 (0x4004e000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000

Phil

Quoted 164 lines · Mark D. Studebaker

my man page for ld.so clearly says that /usr/lib and /lib are last. You can also see this from the output of 'ldconfig -v'.

Is yours different?

Also note that the email we got a few days ago from the user, he was picking up the library in /usr/local/lib... so I'm really confused now...

Quoted 149 lines · Philip Edelbrock

(I can't remember if I've replied to this yet)

I didn't have to add /usr/local/lib to it (I've added it a long time ago), but it looks in /usr/lib first. In fact, I think /lib and /usr/lib are built into the lib search path and don't need to be in ld.so.conf?

I wonder if we can add a checking function in the include header to test for the lib version (and call it when sensors is run). The header version and the lib version should always be indentical, right?

Phil

Quoted 132 lines · Mark Studebaker
Quoted 4 lines

From reading 'man ld.so' and 'man ldconfig', it's apparent that /usr/lib and /lib are searched _after_ all

the libraries listed in /etc/ld.so.conf. So the only problem is if /usr/local/lib is not listed
in /etc/ld.so.conf at all.

Did you have /usr/local/lib/ in /etc/ld.so.conf or did you have to add it?

If Redhat doesn't have /usr/local/lib in there, I think that's the check we need to have.

Quoted 113 lines · Philip Edelbrock

Ah, I found the trouble. I've got too many libsensors installed, and when sensors is compiled, it will link against an old one. At some point, we changed the default lib installation directory from /usr/lib to /usr/local/lib. Bins get linked against /usr/lib/libsensors.so instead of the newer /usr/local/libsensors.so.

So, in essence, a newer include for the lib is used to link against an old lib.

Once I deleted the old libs from /usr/lib and got it linking to the new lib, it worked fine.

Should we have a check for an old lib? Or explicitly link against libsensors.1.4.0.so (if this is possible?).

Phil

Quoted 90 lines · Mark Studebaker

guess you saw the mail that it's a libc 2.3 thing...
Can you recompile w/ -g (sensors and libsensors) and get a better bt? could be something I did to libsensors...

Quoted 80 lines · Philip Edelbrock

:'(

[phil@drtheopolis phil]$ sensors -v
sensors version 2.7.0

[phil@drtheopolis phil]$ sensors
Segmentation fault (core dumped)

[phil@drtheopolis phil]$ gdb sensors
GNU gdb Red Hat Linux (5.2.1-4)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) run
Starting program: /usr/local/bin/sensors

Program received signal SIGSEGV, Segmentation fault. 0x4207931a in strcmp () from /lib/i686/libc.so.6
(gdb) bt
#0 0x4207931a in strcmp () from /lib/i686/libc.so.6
#1 0x40028bd9 in sensors_match_chip () from /usr/lib/libsensors.so.1 #2 0x08049171 in do_the_real_work ()
#3 0x08049073 in main ()
#4 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6

It's possible that it's just my strange computer. This isn't a RH8 install from scratch, but an upgrade. There could be a legacy lib or something causing trouble which may not appear on another Athlon running RH8.... has anybody else tried on an Athlon?

Phil

Quoted 35 lines · Mark Studebaker

Phil, what processor are you compiling for? Or what's wrong with <math.h>?
It works for me, but gcc is generating floating point assembler instructions
and so it doesn't need -lm.
If we do add a -lm it should be added to lib/Module.mk for the library,
not in prog/sensors/Module.mk for sensors.

Quoted 19 lines · Jean Delvare
Quoted 10 lines

FYI-

gcc -o prog/sensors/sensors prog/sensors/main.ro
prog/sensors/chips.ro
-Llib -lsensors
lib/libsensors.so: undefined reference to `log'
lib/libsensors.so: undefined reference to `exp'
collect2: ld returned 1 exit stat

Looks like we need an extra "-lm" on the command line.