Software Tuning, Performance Optimization & Platform Monitoring
Discussion regarding monitoring and software tuning methodologies, Performance Monitoring Unit (PMU) of Intel microprocessors, and platform updating.

PCM Installation issue Kernel3

raoufeh
Beginner
494 Views

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
1 Solution
Patrick_F_Intel1
Employee
494 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

0 Kudos
5 Replies
Patrick_F_Intel1
Employee
495 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
0 Kudos
raoufeh
Beginner
494 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

0 Kudos
Patrick_F_Intel1
Employee
494 Views
Can you try:
make LDFLAGS="-Wl,--no-as-needed"
0 Kudos
Patrick_F_Intel1
Employee
494 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'
0 Kudos
raoufeh
Beginner
494 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
0 Kudos
Reply