Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Fix compiler warnings #1906

Merged
merged 1 commit into from
Mar 23, 2024

Conversation

MichelleJin12
Copy link
Contributor

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: #1276

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

@paranlee
Copy link
Contributor

paranlee commented Mar 17, 2024

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

@@ -14,6 +14,8 @@ struct script_info;

#if defined(HAVE_LIBPYTHON2) || defined(HAVE_LIBPYTHON3)

#undef _XOPEN_SOURCE
#undef _POSIX_C_SOURCE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right! This header file activated when configure script have_libpython* condition from existing user's libpython.
Then, check-deps/Makefile -> HAVE_LIBPYTHON* macro would be enabled.

Copy link
Owner

@namhyung namhyung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Can you please add a comment that it's to fix the compiler warning on 2.7 and those two feature macros will be defined in the python header?

Fix compiler warnings when using python2.7
_POSIX_C_SOURCE and _XOPEN_SOURCE macros are defined in python header.

/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: namhyung#1276

Signed-off-by: Michelle Jin <shjy180909@gmail.com>
Copy link
Owner

@namhyung namhyung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@namhyung namhyung merged commit 880afeb into namhyung:master Mar 23, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

compiler warnings in aarch64 fedora
3 participants