namhyung / uftrace

Function graph tracer for C/C++/Rust/Python
https://uftrace.github.io/slide/
GNU General Public License v2.0
2.92k stars 419 forks source link

build: Fix compiler warnings #1906

Closed MichelleJin12 closed 3 months ago

MichelleJin12 commented 3 months ago

Fix compiler warnings when using python2.7

/usr/include/python2.7/pyconfig-64.h:1191:0: error: "_POSIX_C_SOURCE" redefined [-Werror]
 #define _POSIX_C_SOURCE 200112L
 ^
In file included from /usr/include/inttypes.h:25:0,
                 from /home/uftrace/libmcount/mcount.h:12,
                 from /home/uftrace/utils/script.h:11,
                 from /home/uftrace/utils/script.c:13:
/usr/include/features.h:168:0: note: this is the location of the previous definition
 # define _POSIX_C_SOURCE 200809L
 ^
In file included from /usr/include/python2.7/pyconfig.h:6:0,
                 from /usr/include/python2.7/Python.h:8,
                 from /home/uftrace/utils/script-python.h:18,
                 from /home/uftrace/utils/script.h:13,
                 from /home/uftrace/utils/script.c:13:
/usr/include/python2.7/pyconfig-64.h:1213:0: error: "_XOPEN_SOURCE" redefined [-Werror]
 #define _XOPEN_SOURCE 600
 ^
In file included from /usr/include/inttypes.h:25:0,
                 from /home/uftrace/libmcount/mcount.h:12,
                 from /home/uftrace/utils/script.h:11,
                 from /home/uftrace/utils/script.c:13:
/usr/include/features.h:170:0: note: this is the location of the previous definition
 # define _XOPEN_SOURCE 700
 ^

Fixed: https://github.com/namhyung/uftrace/issues/1276

Signed-off-by: Michelle Jin shjy180909@gmail.com

paranlee commented 3 months ago

@MichelleJin12 Thank you, this issue could be reproduced in RHEL7 when configure libpython: [ ON ] - python tracing & scripting support configuration enabled.