php / php-src

The PHP Interpreter
https://www.php.net
Other
38.16k stars 7.75k forks source link

Building with Oracle Developer Studio compiler fails #15272

Open petk opened 2 months ago

petk commented 2 months ago

Description

On Solaris 11.4 with Oracle Developer Studio compiler 12.6 the following code:

./buildconf
./configure
gmake

Resulted in this output:

configure: error: Required inet_ntop not found

But I expected this output instead:

# Successful build

The issue here is not the inet_ntop but that this combination of compiler and linker doesn't support the --ffp-contract=off flag to build dynamic executable:

cc: Warning: Option -ffp-contract=off passed to ld, if ld is invoked, ignored otherwise
ld: fatal: option '-ffp-contract=off' is incompatible with building a dynamic executable

But this can be (still) easily bypassed by removing the --ffp-contract=off flag from configure.ac (or if we refactor the specific flag check into a link test instead of only compile):

--- a/configure.ac
+++ b/configure.ac
-dnl See https://github.com/php/php-src/issues/14140
-AX_CHECK_COMPILE_FLAG([-ffp-contract=off], [CFLAGS="$CFLAGS -ffp-contract=off"])
-

However, then the compile errors start to pop up on the gmake step:

/php-src/ext/opcache/jit/ir/dynasm/minilua.c", line 2492: warning: improper pointer/integer combination: op "="
"/php-src/ext/opcache/jit/ir/dynasm/minilua.c", line 2541: warning: improper pointer/integer combination: op "="
"/php-src/ext/opcache/jit/ir/ir.h", line 75: #error: "Unknown addr size"

"php-src/Zend/zend_atomic.h", line 307: #warning: No atomics support detected. Please open an issue with platform details.
"php-src/Zend/zend_multiply.h", line 338: warning: statement not reached

/php-src/ext/opcache/zend_file_cache.c", line 911: warning: assignment type mismatch:
        pointer to function(pointer to struct _zend_class_entry {char type, pointer to struct _zend_string {..}

/php-src/ext/opcache/ZendAccelerator.c", line 4241: warning: statement not reached

Building with GCC works ok, otherwise. Should such compiler be even supported by PHP or not?

PHP Version

PHP 8.2+

Operating System

Oracle Solaris 11.4

devnexen commented 2 months ago

Note that last sun studio release is from 2017. That reason alone is sufficient for not bothering with IMHO. Not the same thing than asking to support Intel ICC for example. Not sure it fully support C99, the zend engine uses a lot of gcc/clang specific features.

Somewhat related to this one.

petk commented 2 months ago

What about if we do a fatal error in the configure step to notify the user to use GNU C or Clang compiler on Solaris when SunPro compiler is detected? This compiler does seem dead to me too. Or should be better say here that it is not moving beyond the C 11 standard: https://forums.oracle.com/ords/apexds/post/is-developer-studio-abandoned-and-discontinued-by-oracle-3285

devnexen commented 2 months ago

I m personally fine with configure failure in that case.

nielsdos commented 2 months ago

What about if we do a fatal error in the configure step to notify the user to use GNU C or Clang compiler on Solaris when SunPro compiler is detected? This compiler does seem dead to me too.

I agree with this.

NattyNarwhal commented 2 months ago

I wouldn’t do a hard failure; there’s always the possibility of things like cproc getting more popular. A warning should be sufficient.

(My stance on Studio et al support is more, if you have a patch…)

petk commented 2 months ago

Another option here would be to configure script check if there is gcc (or clang) available as an alternative and use that compiler. But the issue is that changing this configure.ac is (still) a bit difficult considering what all of this might impact. I should check and test all of this.

I've also checked some other open source C projects, none build with Oracle Developer Studio compiler.

--- a/configure.ac
+++ b/configure.ac
-AC_PROG_CC([cc gcc])
+AC_PROG_CC