Community
cancel
Showing results for 
Search instead for 
Did you mean: 
raoufeh
Beginner
52 Views

PCM Installation issue Kernel3

Jump to solution

Hi all,

I am trying to install Intel PCM in the following system:
uname -a
Linux PowerEdge-R510 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

I previously used it at the same machine with Kernel 2.6.35 and Ubuntu 10.10 but when i upgraded to Ubintu
11.10 and kernel 3 I couldn`t install PCM due to a list of undefined reference errors (attached) like:

undefined reference to `sem_open'


apparently, these errors are related to lpthread library.
Googleing the error I mostly see linker issues which can be solved by adding --lpthread -lrt to the make files. But it looks like this is already included in the make file,

I was wondering if anyone else encountered such problem and if the developers know how to solve it?


Thanks,
RSH


0 Kudos

Accepted Solutions
Patrick_F_Intel1
Employee
52 Views
Hello RSH,
Can you edit the Makefile and look for the rule to build pcm.x and change the line
from
$(CC) $(OPT) -lpthread -lrt msr.o pci.o cpucounters.o cpucounterstest.o -o pcm.x
to
$(CC) $(OPT) -lpthread -lrt msr.o pci.o cpucounters.o cpucounterstest.o -o pcm.x -lpthread -lrt

Don't delete the starting tab.
As you can see, '-lpthread -lrt' is already on the compile line but some linkers require the libraries to be specified last.Some linkersare single pass linkers so the order in which .o files and libraries are specified matters.
Hope this helps,
Pat

View solution in original post

5 Replies
Patrick_F_Intel1
Employee
53 Views
Hello RSH,
Can you edit the Makefile and look for the rule to build pcm.x and change the line
from
$(CC) $(OPT) -lpthread -lrt msr.o pci.o cpucounters.o cpucounterstest.o -o pcm.x
to
$(CC) $(OPT) -lpthread -lrt msr.o pci.o cpucounters.o cpucounterstest.o -o pcm.x -lpthread -lrt

Don't delete the starting tab.
As you can see, '-lpthread -lrt' is already on the compile line but some linkers require the libraries to be specified last.Some linkersare single pass linkers so the order in which .o files and libraries are specified matters.
Hope this helps,
Pat

View solution in original post

raoufeh
Beginner
52 Views
Hi Pat,

Thanks for the reply, but it's the same story even with this change,
I even did the change for all the rules that had some libreary in it.

The gcc version in the new Ubuntu is:

gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)

in the old system where i could install PCM the gcc version was 4.5.5

I guess it should be something related to the linker ! But don`t know what.

Thanks,
RSH

Patrick_F_Intel1
Employee
52 Views
Can you try:
make LDFLAGS="-Wl,--no-as-needed"
Patrick_F_Intel1
Employee
52 Views
You might have to add
-Wl,--no-as-needed
after the '-lrt' in the compile cmds in the Makefile... as in '-lrt -Wl,--no-as-needed'
raoufeh
Beginner
52 Views
Hi Pat,

Thanks for your helpful reply,

The problem was solved by applying your suggestion to put -lpthread at theend of the line and adding them to the second compile line:

cpucounters.o: msr.h msr.cpp cpucounters.h cpucounters.cpp types.h width_extender.h
$(CC) $(OPT) -c cpucounters.cpp -lpthread -lrt

I attached the revised makefile.

My linker version was:
ld -v
GNU ld (GNU Binutils for Ubuntu) 2.21.53.20110810

Cheers,
RSH