perf icon indicating copy to clipboard operation
perf copied to clipboard

build examples fails

Open nishihatapalmer opened this issue 2 years ago • 4 comments

Hi,

can build the library, but make examples fails with:

/usr/bin/ld: /tmp/ccDOH6Fz.o:/home/matt/dev/smart/perf/examples/full/harness.h:19: multiple definition of `measurements'; /tmp/ccX0hXle.o:/home/matt/dev/smart/perf/examples/full/harness.h:19: first defined here
/usr/bin/ld: /tmp/ccDOH6Fz.o:/home/matt/dev/smart/perf/examples/full/harness.h:22: multiple definition of `all_measurements'; /tmp/ccX0hXle.o:/home/matt/dev/smart/perf/examples/full/harness.h:22: first defined here
/usr/bin/ld: /tmp/ccDOH6Fz.o:/home/matt/dev/smart/perf/examples/full/harness.h:24: multiple definition of `measure_instruction_count'; /tmp/ccX0hXle.o:/home/matt/dev/smart/perf/examples/full/harness.h:24: first defined here
/usr/bin/ld: /tmp/ccDOH6Fz.o:/home/matt/dev/smart/perf/examples/full/harness.h:26: multiple definition of `measure_cycle_count'; /tmp/ccX0hXle.o:/home/matt/dev/smart/perf/examples/full/harness.h:26: first defined here
/usr/bin/ld: /tmp/ccDOH6Fz.o:/home/matt/dev/smart/perf/examples/full/harness.h:28: multiple definition of `measure_context_switches'; /tmp/ccX0hXle.o:/home/matt/dev/smart/perf/examples/full/harness.h:28: first defined here
/usr/bin/ld: /tmp/ccDOH6Fz.o:/home/matt/dev/smart/perf/examples/full/harness.h:31: multiple definition of `measure_cpu_clock'; /tmp/ccX0hXle.o:/home/matt/dev/smart/perf/examples/full/harness.h:31: first defined here
/usr/bin/ld: /tmp/ccDOH6Fz.o:/home/matt/dev/smart/perf/examples/full/harness.h:33: multiple definition of `measure_cpu_branches'; /tmp/ccX0hXle.o:/home/matt/dev/smart/perf/examples/full/harness.h:33: first defined here

nishihatapalmer avatar Nov 13 '22 09:11 nishihatapalmer

same here, @nishihatapalmer were you able to find smth else?

dnb02 avatar Feb 25 '24 15:02 dnb02

No, I just wrote my own code. The source here was useful, and I also read the Linux documentation. Wasn't too hard in the end.

nishihatapalmer avatar Feb 25 '24 15:02 nishihatapalmer

did you try libpfm?

dnb02 avatar Feb 26 '24 07:02 dnb02

I've added a Dockerfile that shows how it can be built and run. It "should just work" to run make and then ./build/examples/full, for example. Note that there are some privileges required. In the case of the example for running the container, the container will be given full privileges.

AlexGustafsson avatar Apr 19 '24 11:04 AlexGustafsson

Closing. Feel free to reopen if your issues remain unsolved.

AlexGustafsson avatar Oct 19 '24 15:10 AlexGustafsson