Skip to content

Commit 7df5478

Browse files
committed
build: Check and set perf --log-fd option
Linux perf tool version 3.2 introduced a new option "--log-fd" defaults to 0, which leads to error "Failed opening logfd: Illegal argument" when executing perf tests. Set logfd to stderr to let perf test work. Issue rust-lang#1538
1 parent 1375b31 commit 7df5478

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

configure

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,16 @@ then
363363
err "either clang or gcc is required"
364364
fi
365365

366+
if [ ! -z "$CFG_PERF" ]
367+
then
368+
$CFG_PERF --log-fd 2>&1 | grep 'unknown option' > /dev/null
369+
if [ ! -z $? ];
370+
then
371+
CFG_PERF_WITH_LOGFD=1
372+
putvar CFG_PERF_WITH_LOGFD
373+
fi
374+
fi
375+
366376
step_msg "making directories"
367377

368378
for i in \

mk/platform.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ ifneq ($(findstring linux,$(CFG_OSTYPE)),)
5858
CFG_LDENV := LD_LIBRARY_PATH
5959
CFG_DEF_SUFFIX := .linux.def
6060
ifdef CFG_PERF
61+
ifdef CFG_PERF_WITH_LOGFD
62+
CFG_PERF_TOOL := $(CFG_PERF) stat -r 3 --log-fd 2
63+
else
6164
CFG_PERF_TOOL := $(CFG_PERF) stat -r 3
65+
endif
6266
else
6367
ifdef CFG_VALGRIND
6468
CFG_PERF_TOOL :=\

0 commit comments

Comments
 (0)