Re: [PATCH 1/4] perf tools: pass PYTHON config to feature detection

From: Arnaldo Carvalho de Melo
Date: Tue Feb 07 2017 - 14:49:39 EST


Em Wed, Feb 01, 2017 at 10:38:01PM -0800, David Carrillo-Cisneros escreveu:
> Python's CC and link Makefile variables were not passed to feature
> detection, causing feature detection to use system's Python rather than
> PYTHON_CONFIG's one. This created a mismatch between the detected Python
> support and the one actually used by perf when PYTHON_CONFIG is specified.
>
> Fix it by moving Python's variable initialization to before feature
> detection and pass FLAGS_PYTHON_EMBED to Python's feature detection's
> build target.

So, all builds on Ubuntu with the devel files for perf end up with:

ubuntu:12.04.5, 14.04.4, 16.04, 16.10 (cross builds, native ones)

GEN /tmp/build/perf/libtraceevent-dynamic-list
/bin/sh: 1: [: U: unexpected operator
Either missing one of [ /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so] or bad version of nm

Details:

perfbuilder@341e71da5019:/git/linux$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.10 (Yakkety Yak)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.10"
VERSION_ID="16.10"
HOME_URL="http://www.ubuntu.com/";
SUPPORT_URL="http://help.ubuntu.com/";
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/";
PRIVACY_POLICY_URL="http://www.ubuntu.com/legal/terms-and-policies/privacy-policy";
VERSION_CODENAME=yakkety
UBUNTU_CODENAME=yakkety
perfbuilder@341e71da5019:/git/linux$ ls -la /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 13576 Feb 7 19:38 /tmp/build/perf/plugin_cfg80211.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 20256 Feb 7 19:38 /tmp/build/perf/plugin_function.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 13680 Feb 7 19:38 /tmp/build/perf/plugin_hrtimer.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 13760 Feb 7 19:38 /tmp/build/perf/plugin_jbd2.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 13976 Feb 7 19:38 /tmp/build/perf/plugin_kmem.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 28680 Feb 7 19:38 /tmp/build/perf/plugin_kvm.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 14248 Feb 7 19:38 /tmp/build/perf/plugin_mac80211.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 18800 Feb 7 19:38 /tmp/build/perf/plugin_sched_switch.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 20136 Feb 7 19:38 /tmp/build/perf/plugin_scsi.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 14504 Feb 7 19:38 /tmp/build/perf/plugin_xen.so
perfbuilder@341e71da5019:/git/linux$

perfbuilder@341e71da5019:/git/linux$ file=/tmp/build/perf/plugin_jbd2.so ; nm -u -D $file | awk 'NF>1 {print $$file}' | sort -u
U pevent_register_print_function
U pevent_unregister_print_function
U trace_seq_printf
perfbuilder@341e71da5019:/git/linux$


Now running with "make V=1 ...".

make -C /git/linux/tools/lib/traceevent/ plugin_dir= O=/tmp/build/perf/ /tmp/build/perf/libtraceevent-dynamic-list
symbol_type=`nm -u -D /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so | awk 'NF>1 {print $1}' | sort -u`; if [ "$symbol_type" == "U" ];then (echo '{'; nm -u -D /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so | awk 'NF>1 {print "\t"$2";"}' | sort -u; echo '};'; ) > /tmp/build/perf/libtraceevent-dynamic-list; else (echo Either missing one of [ /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so] or bad version of nm) 1>&2; fi
/bin/sh: 1: [: U: unexpected operator
Either missing one of [ /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so] or bad version of nm

The output below looks like the same as on fedora25, where this seems to work:

perfbuilder@341e71da5019:/git/linux$ nm -u -D /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so

/tmp/build/perf/plugin_jbd2.so:
U pevent_register_print_function
U pevent_unregister_print_function
U trace_seq_printf

/tmp/build/perf/plugin_hrtimer.so:
U pevent_print_func_field
U pevent_print_num_field
U pevent_register_event_handler
U pevent_unregister_event_handler
U trace_seq_printf

/tmp/build/perf/plugin_kmem.so:
U __stack_chk_fail
U pevent_find_field
U pevent_find_function
U pevent_find_function_address
U pevent_read_number_field
U pevent_register_event_handler
U pevent_unregister_event_handler
U trace_seq_printf

/tmp/build/perf/plugin_kvm.so:
U __stack_chk_fail
U pevent_get_field_raw
U pevent_get_field_val
U pevent_print_num_field
U pevent_register_event_handler
U pevent_register_print_function
U pevent_unregister_event_handler
U pevent_unregister_print_function
U sprintf
U trace_seq_printf

/tmp/build/perf/plugin_mac80211.so:
U __stack_chk_fail
U pevent_find_field
U pevent_print_num_field
U pevent_read_number_field
U pevent_register_event_handler
U pevent_unregister_event_handler
U strncmp
U trace_seq_printf
U trace_seq_putc

/tmp/build/perf/plugin_sched_switch.so:
U __stack_chk_fail
U pevent_find_any_field
U pevent_get_field_val
U pevent_register_comm
U pevent_register_event_handler
U pevent_unregister_event_handler
U trace_seq_printf
U trace_seq_putc
U trace_seq_puts
U trace_seq_terminate

/tmp/build/perf/plugin_function.so:
U __stack_chk_fail
U free
U memset
U pevent_find_function
U pevent_get_field_val
U pevent_register_event_handler
U pevent_unregister_event_handler
U realloc
U strcmp
U strdup
U trace_seq_printf
U trace_seq_putc
U traceevent_plugin_add_options
U traceevent_plugin_remove_options
U warning

/tmp/build/perf/plugin_xen.so:
U pevent_register_print_function
U pevent_unregister_print_function
U trace_seq_printf

/tmp/build/perf/plugin_scsi.so:
U pevent_register_print_function
U pevent_unregister_print_function
U trace_seq_printf
U trace_seq_putc

/tmp/build/perf/plugin_cfg80211.so:
U pevent_register_print_function
U pevent_unregister_print_function
perfbuilder@341e71da5019:/git/linux$

I've run out of time this afternoon to look at this, will continue later or tomorrow,
unless, preferrably, that you find this problem first :-)

- Arnaldo