I hope another Ubuntu user has tried to run Intel power gadget and knows what problem I am having.

I am trying to install the power gadget, running the make file i get an error message:

/usr/lib/power_gadget/rapl.c:516: undefined reference to `log'

This line refers to the line in a .c file:

return (log((double)(time / RAPL_TIME_UNIT)) - A_LNF[F]) / LN2;

Is this log function being called correctly? Am I missing a dependency on my Ubuntu setup? Is there perhaps a missing library file in my download?

Thanks in advance for any help

Regards

Roz

Edit, the make file is below:

CFLAGS=-g

all: rapl_lib_shared rapl_lib_static power_gadget_static

rapl_lib_shared: 
    gcc $(CFLAGS) -fpic -c msr.c cpuid.c rapl.c 
    gcc $(CFLAGS) -shared -o librapl.so msr.o cpuid.o rapl.o

rapl_lib_static: 
    gcc $(CFLAGS) -c msr.c cpuid.c rapl.c 
    ar rcs librapl.a msr.o cpuid.o rapl.o

power_gadget_static: 
    gcc $(CFLAGS) power_gadget.c -I. -L. -lm -o power_gadget ./librapl.a

power_gadget: 
    gcc $(CFLAGS) power_gadget.c -I. -L. -lm -lrapl -o power_gadget 

gprof: CFLAGS = -pg
gprof: all
    ./power_gadget -e 100 -d 60 >/dev/null 2>&1
    gprof power_gadget > power_gadget.gprof
    rm -f gmon.out
    make clean

clean: 
    rm -f power_gadget librapl.so librapl.a msr.o cpuid.o rapl.o 
share|improve this question
    
Can you point us how this file is compiled? Perhaps there is an error in the makefile: stackoverflow.com/questions/9145264/undefined-reference-to-l‌​og – Melon Feb 3 '14 at 21:16

I got the same problem and managed to solve it by simply change the -lm flag to the end off the GCC command.

So the Makefile now looks like this:

CFLAGS=-g

all: rapl_lib_shared rapl_lib_static power_gadget_static

rapl_lib_shared: 
gcc $(CFLAGS) -fpic -c msr.c cpuid.c rapl.c
gcc $(CFLAGS) -shared -o librapl.so msr.o cpuid.o rapl.o

rapl_lib_static:
gcc $(CFLAGS) -c msr.c cpuid.c rapl.c
ar rcs librapl.a msr.o cpuid.o rapl.o

power_gadget_static: 
gcc $(CFLAGS) power_gadget.c -I. -L. -o power_gadget ./librapl.a -lm

power_gadget:
gcc $(CFLAGS) power_gadget.c -I. -L. -lrapl -o power_gadget -lm

gprof: CFLAGS = -pg
gprof: all
./power_gadget -e 100 -d 60 >/dev/null 2>&1
gprof power_gadget > power_gadget.gprof
rm -f gmon.out
make clean

clean:
rm -f power_gadget librapl.so librapl.a msr.o cpuid.o rapl.o
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.