-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Set DTrace preprocessor via the DTRACE_CPP variable #11853
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
Conversation
The way DTrace generates files depend on the given preprocessor. Without passing the CPP environment variable dtrace Python script uses the cpp by default. For systems where the CPP is set to something else, the generated files won't be created the same way, so instead the DTrace preprocessor can be overriden manually with the new DTRACE_CPP variable. For example: ./configure DTRACE_CPP="gcc -E -xc" --enable-dtrace Fixes phpGH-11847
For consistency, shouldn't we also have a I will try to test it later (not much available, you know... Holidays..) |
Wow 🤯 That is definitely the issue. Spaces are alright… I’ll describe my thinking here (you PHP implementation folks all probably know this already 😅). I was not aware of the difference between Now to possible solution… I don’t think DTrace needs its own preprocessor. If so, people should be able to override it when invoking both There may be a macro derived from Or, and I prefer this one, we may simply force diff --git a/build/php.m4 b/build/php.m4
index 921a78eb78..73dd1e8e27 100644
--- a/build/php.m4
+++ b/build/php.m4
@@ -2389,7 +2389,7 @@ dnl overwritten (Bug 61268).
$abs_srcdir/$ac_provsrc:;
$ac_bdir[$]ac_hdrobj: $abs_srcdir/$ac_provsrc
- CPP="\$(CPP)" CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) -e 's,PHP_,DTRACE_,g' \$[]@.bak > \$[]@
+ CPP="\$(CPP) -xc" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) -e 's,PHP_,DTRACE_,g' \$[]@.bak > \$[]@
\$(PHP_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj
@@ -2409,12 +2409,12 @@ EOF
$ac_bdir[$]ac_provsrc.lo: \$(PHP_DTRACE_OBJS)
echo "[#] Generated by Makefile for libtool" > \$[]@
@test -d "$dtrace_lib_dir" || mkdir $dtrace_lib_dir
- if CPP="\$(CPP)" CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $dtrace_d_obj -s $abs_srcdir/$ac_provsrc $dtrace_lib_objs 2> /dev/null && test -f "$dtrace_d_obj"; then [\\]
+ if CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $dtrace_d_obj -s $abs_srcdir/$ac_provsrc $dtrace_lib_objs 2> /dev/null && test -f "$dtrace_d_obj"; then [\\]
echo "pic_object=['].libs/$dtrace_prov_name[']" >> \$[]@ [;\\]
else [\\]
echo "pic_object='none'" >> \$[]@ [;\\]
fi
- if CPP="\$(CPP)" CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $ac_bdir[$]ac_provsrc.o -s $abs_srcdir/$ac_provsrc $dtrace_nolib_objs 2> /dev/null && test -f "$ac_bdir[$]ac_provsrc.o"; then [\\]
+ if CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $ac_bdir[$]ac_provsrc.o -s $abs_srcdir/$ac_provsrc $dtrace_nolib_objs 2> /dev/null && test -f "$ac_bdir[$]ac_provsrc.o"; then [\\]
echo "non_pic_object=[']$dtrace_prov_name[']" >> \$[]@ [;\\]
else [\\]
echo "non_pic_object='none'" >> \$[]@ [;\\]
@@ -2426,7 +2426,7 @@ EOF
*)
cat>>Makefile.objects<<EOF
$ac_bdir[$]ac_provsrc.o: \$(PHP_DTRACE_OBJS)
- CPP="\$(CPP)" CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o \$[]@ -s $abs_srcdir/$ac_provsrc $dtrace_objs
+ CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o \$[]@ -s $abs_srcdir/$ac_provsrc $dtrace_objs
EOF
;;
diff --git a/ext/oci8/config.m4 b/ext/oci8/config.m4
index 883e272fb1..6fcc6d9eab 100644
--- a/ext/oci8/config.m4
+++ b/ext/oci8/config.m4
@@ -124,7 +124,7 @@ dnl overwritten (Bug 61268).
PHP_EXT_SRCDIR([oci8])/$ac_provsrc:;
$ac_bdir[$]ac_hdrobj: $ac_srcdir[$]ac_provsrc
- CPP="\$(CPP)" CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) -e 's,PHPOCI_,DTRACE_,g' \$[]@.bak > \$[]@
+ CPP="\$(CPP) -xc" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) -e 's,PHPOCI_,DTRACE_,g' \$[]@.bak > \$[]@
\$(OCI8_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj
@@ -145,12 +145,12 @@ EOF
$ac_bdir[$]ac_provsrc.lo: \$(OCI8_DTRACE_OBJS)
echo "[#] Generated by Makefile for libtool" > \$[]@
@test -d "$dtrace_lib_dir" || mkdir $dtrace_lib_dir
- if CPP="\$(CPP)" CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $dtrace_d_obj -s $ac_srcdir[$]ac_provsrc $dtrace_oci8_lib_objs 2> /dev/null && test -f "$dtrace_d_obj"; then [\\]
+ if CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $dtrace_d_obj -s $ac_srcdir[$]ac_provsrc $dtrace_oci8_lib_objs 2> /dev/null && test -f "$dtrace_d_obj"; then [\\]
echo "pic_object=['].libs/$dtrace_prov_name[']" >> \$[]@ [;\\]
else [\\]
echo "pic_object='none'" >> \$[]@ [;\\]
fi
- if CPP="\$(CPP)" CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $ac_bdir[$]ac_provsrc.o -s $ac_srcdir[$]ac_provsrc $dtrace_nolib_objs 2> /dev/null && test -f "$ac_bdir[$]ac_provsrc.o"; then [\\]
+ if CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $ac_bdir[$]ac_provsrc.o -s $ac_srcdir[$]ac_provsrc $dtrace_nolib_objs 2> /dev/null && test -f "$ac_bdir[$]ac_provsrc.o"; then [\\]
echo "non_pic_object=[']$dtrace_prov_name[']" >> \$[]@ [;\\]
else [\\]
echo "non_pic_object='none'" >> \$[]@ [;\\]
@@ -162,7 +162,7 @@ EOF
AC_MSG_WARN([OCI8 extension: OCI8 DTrace support is not confirmed on this platform])
cat>>Makefile.objects<<EOF
$ac_bdir[$]ac_provsrc.o: \$(OCI8_DTRACE_OBJS)
- CPP="\$(CPP)" CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o \$[]@ -s $ac_srcdir[$]ac_provsrc $dtrace_oci8_objs
+ CC="\$(CC)" CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o \$[]@ -s $ac_srcdir[$]ac_provsrc $dtrace_oci8_objs
EOF
;; But… I’m talking here as a user of PHP build system who builds PHP regularly, including cross-compiling. There may be other consideration I am not aware of. From the outside, I prefer a simple solution which works and if there is a need for something obscure, people needing it are expected to understand how build systems work and how to modify them — there is no need to cater to them at the expense of introducing bloat. I believe a use case of using completely separate CPP just for |
Another option is to stop setting |
@f4z4on awesome, thanks. I'll check it out. |
I'm closing this PR to have a solution #11858... |
The way DTrace generates files depend on the given preprocessor. Without passing the CPP environment variable dtrace Python script uses the cpp by default.
For systems where the CPP is set to something else, the generated files won't be created the same way, so instead the DTrace preprocessor can be overriden manually with the new DTRACE_CPP variable. For example:
./configure DTRACE_CPP="gcc -E -xc" --enable-dtrace
Fixes GH-11847