Welcome to Centmin Mod Community
Become a Member

Beta Branch add GCC 9.2+ support to PHP compile routine in 123.09beta01

Discussion in 'Centmin Mod Github Commits' started by eva2000, Sep 9, 2019.

  1. eva2000

    eva2000 Administrator Staff Member

    49,887
    11,487
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,843
    Local Time:
    5:03 AM
    Nginx 1.21.x
    MariaDB 10.x
    add GCC 9.2+ support to PHP compile routine in 123.09beta01

    - Add optional support for DEVTOOLSETNINE='y' which is only available for private testing right now so setting this in persistent config file /etc/centminmod/custom_config.inc prior to centmin.sh menu option 5 PHP recompiles/upgrades won't utilise GCC 9.2+ right now as you won't have GCC 9.2+ installed by Centmin Mod.
    - Centmin Mod 123.09beta01 users won't have that support until SCL yum repo releases GCC 9.2 via devtoolset-9 which is planned for by SCL eventually. For private testing I have built my own GCC 9+ binaries and YUM RPM packages for Centmin Mod and CentOS 7 just to get early compatibility testing so that Centmin Mod 123.09beta01+ and newer have GCC 9 and eventually GCC 10 and Clang 8+ compiler ready support for Nginx and PHP-FPM compilation routines Beta Branch - Testing GCC 8, GCC 9 & Clang 5/6/7 compiler for Centmin Mod Nginx & PHP-FPM


    Continue reading...

    123.09beta01 branch
     
  2. eva2000

    eva2000 Administrator Staff Member

    49,887
    11,487
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,843
    Local Time:
    5:03 AM
    Nginx 1.21.x
    MariaDB 10.x
    Below is php benchmark on Intel Core i7 4790K Haswell dedicated server for PHP 7.4.0RC1 built with both GCC 8.3.1 (default) in CentOS 7 Centmin Mod 123.09beta01 and with optional GCC 9.2.0 support compared with Remi YUM repo's PHP-FPM 7.4.0RC1, 7.3.9, 7.2.22, 7.1.22 and 7.0.33. GCC 9.2 built binaries will have more performance boost in theory with newer cpu models newer than Intel Skylake or AMD Zen2 just as GCC 8 had for newer than Intel Broadwell cpus. As just the Intel Core i7 4790K Haswell older than Intel Broadwell cpu isn't the best example for performance boost that GCC 9 built binaries will have for Centmin Mod Nginx and PHP-FPM performance.

    GCC 9.2.0
    Code (Text):
    gcc -v
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/opt/gcc-9.2.0/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper
    Target: x86_64-redhat-linux
    Configured with: ../configure --prefix=/opt/gcc-9.2.0 --disable-multilib --enable-bootstrap --enable-plugin --with-gcc-major-version-only --enable-shared --disable-nls --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-install-libiberty --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++ --enable-initfini-array --disable-libgcj --enable-gnu-indirect-function --with-tune=generic --build=x86_64-redhat-linux --enable-lto --enable-gold
    Thread model: posix
    gcc version 9.2.0 (GCC)
    

    GCC 8.3.1
    Code (Text):
    gcc -v
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
    Target: x86_64-redhat-linux
    Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-8/root/usr --mandir=/opt/rh/devtoolset-8/root/usr/share/man --infodir=/opt/rh/devtoolset-8/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-8.3.1-20190311/obj-x86_64-redhat-linux/isl-install --disable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
    Thread model: posix
    gcc version 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC)
    


    Centmin Mod's GCC 9.2.0 built PHP 7.4.0RC1 is slighly faster than GCC 8.3.1 (default) PHP 7.4.0RC1 builds.

    php74-gcc9-vs-gcc8-01.png

    Centmin Mod 123.09beta01 already has Nginx supporting GCC 9.2.0 via private GCC 9.2 built RPMs - just waiting on SCL devtoolset-9 GCC 9.2 support. But Centmin Mod's Nginx and PHP-FPM routines are GCC 9.2 ready. Will be working on GCC 10 support soon via custom GCC 10 built RPMs as well :D
     
  3. tininho

    tininho Active Member

    182
    44
    28
    May 22, 2019
    Ratings:
    +135
    Local Time:
    10:03 PM
    Is it possible to utilize GCC 9.2 via Centminmod with something like this: tinof/centmininit

    I can't get it to work with DEVTOOLSETNINE='y', building fails (centminmod menu 4/5).
     
  4. eva2000

    eva2000 Administrator Staff Member

    49,887
    11,487
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,843
    Local Time:
    5:03 AM
    Nginx 1.21.x
    MariaDB 10.x
    That may break system's native GCC version doing your method of install so hope you did it on test server ?

    Unfortunately, right Centmin Mod 123.09beta01's GCC 9.2 support is hardcoded to my custom GCC 9.2 RPM build's GCC 9.2 version detection only to ensure I control how GCC 9.2 is installed and setup.
     
  5. tininho

    tininho Active Member

    182
    44
    28
    May 22, 2019
    Ratings:
    +135
    Local Time:
    10:03 PM
    Ok, so I am using your script (with slight modifications) from centminmod/centminmod-gcc to build packages on AMD Ryzen test server with GCC 9.2.

    1) Is it possible to force -O3-march=znver2 ? It seems the GCC does not recognize it correctly on my KVM-based VPS.
    2) Should GCC10 work, if I just replace the GCC_SNAPSHOTNINE string with (...)LATEST-10/ ?

    I am happy if you can help out, but taking no offence if you can't, since it's really not your job to help with this :)
     
    Last edited: Oct 18, 2019
  6. eva2000

    eva2000 Administrator Staff Member

    49,887
    11,487
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,843
    Local Time:
    5:03 AM
    Nginx 1.21.x
    MariaDB 10.x
    You also need to set in persistent config file either PHP_PGO='y' OR GCCINTEL_PHP='y' to ensure PHP is built with it's march target with GCC versions. FYI setting PHP_PGO='y' auto enables GCCINTEL_PHP too.

    Haven't tested GCC10 yet fully with Centmin Mod nginx/php-fpm routines yet so I'd advise against it for now.
     
  7. tininho

    tininho Active Member

    182
    44
    28
    May 22, 2019
    Ratings:
    +135
    Local Time:
    10:03 PM
    With PHP_PGO='y', MARCH_TARGETNATIVE='y', MARCH_TARGETNATIVE_ALWAYS='y'

    PHP upgrade (on GCC 9.2) finishes with:

    * PHP compiled with CPU_MARCH=k8-sse3
    * PHP upgraded and auto reinstalled PHP extensions
    * PHP_PGO='y' detected. PHP compiled with Profile Guided Optimizations

    I find this strange, it does not apply march=znver2 for some reason?
     
  8. eva2000

    eva2000 Administrator Staff Member

    49,887
    11,487
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,843
    Local Time:
    5:03 AM
    Nginx 1.21.x
    MariaDB 10.x
  9. tininho

    tininho Active Member

    182
    44
    28
    May 22, 2019
    Ratings:
    +135
    Local Time:
    10:03 PM
    php_upgrade log: centminmod_123.09beta01.b292_191019-150516_php_upgrade
    less /proc/cpuinfo: lessproc_cpuinfo
    tinof/centmininit

    I have asked Unesty.net support about this, since the processor is identified as:

    6 Common KVM processor
    6 4042.404
    Response from Unesty support:

    This issue can be a result because of Proxmox because in every system whether AMD or Intel are configured that "Common KVM processor" is shown.
    March works correctly on Vultr VPS/Bare metal and Upcloud, so I assume it's an issue with this "Proxmox" virtualizer?
     
    Last edited: Oct 22, 2019
  10. eva2000

    eva2000 Administrator Staff Member

    49,887
    11,487
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,843
    Local Time:
    5:03 AM
    Nginx 1.21.x
    MariaDB 10.x
    yeah problem is Promox seems causinges GCC 9.2.1 to not correctly identity cpu used or the cpu used isn't a AMD Ryzen cpu
    Code (Text):
    gcc -c -Q -march=native --help=target | egrep '\-mtune|\-mprefer-vector-width|\-march|\-msse|\-msse2|\-msse2avx|\-msse3|\-mavx|\-msse4|\-mssse3|\-mpclmul' | tee /root/centminlogs/gcc_php_native.log
      -march=                             k8-sse3
      -mavx                               [disabled]
      -mavx2                              [disabled]
      -mavx256-split-unaligned-load     [disabled]
      -mavx256-split-unaligned-store     [disabled]
      -mavx5124fmaps                      [disabled]
      -mavx5124vnniw                      [disabled]
      -mavx512bitalg                      [disabled]
      -mavx512bw                          [disabled]
      -mavx512cd                          [disabled]
      -mavx512dq                          [disabled]
      -mavx512er                          [disabled]
      -mavx512f                           [disabled]
      -mavx512ifma                        [disabled]
      -mavx512pf                          [disabled]
      -mavx512vbmi                        [disabled]
      -mavx512vbmi2                       [disabled]
      -mavx512vl                          [disabled]
      -mavx512vnni                        [disabled]
      -mavx512vpopcntdq                   [disabled]
      -mpclmul                            [disabled]
      -mprefer-vector-width=              none
      -msse                               [enabled]
      -msse2                              [enabled]
      -msse2avx                           [disabled]
      -msse3                              [enabled]
      -msse4                              [disabled]
      -msse4.1                            [disabled]
      -msse4.2                            [disabled]
      -msse4a                             [disabled]
      -msse5                            
      -msseregparm                        [disabled]
      -mssse3                             [disabled]
      -mtune-ctrl=                      
      -mtune=                             k8
    
     
  11. tininho

    tininho Active Member

    182
    44
    28
    May 22, 2019
    Ratings:
    +135
    Local Time:
    10:03 PM
    I am trying to learn to work with your Centminmod-GCC tool. I have managed to get it to work for me, but the next day something is broken again, and I get a build with GCC 6 (meaning that GCC9 build failed).

    So once again, I started again with your v1.1. I run it with
    Code:
    mkdir gcc; cd gcc; wget https://raw.githubusercontent.com/tinof/centmininit/master/installv11.sh; chmod +x installv11.sh; ./installv11.sh install9
    
    Fail (I removed the log file)

    If I change the code like I used to get it working:
    Code:
    -> GCC_DOWNLOADPREREQ='y'
    
    -> GCC_SNAPSHOTNINE='http://www.netgull.com/gcc/snapshots/LATEST-9/'
    -> #GCC_SNAPSHOTNINE='https://gnu.freemirror.org/gnu/gcc/gcc-9.2.0/'
    
    Fail (I removed the log file)

    I will continue experiments, but I am having difficulties understanding what went wrong. Meaning, that the log file is a bit hard to understand for me. Any advice would be greatly appreciated.

    EDIT: Seems they have emptied netgull.com's LATEST-9 folder. Changing to Index of /gnu/gcc/gcc-9.2.0/
     
    Last edited: Nov 14, 2019
  12. eva2000

    eva2000 Administrator Staff Member

    49,887
    11,487
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,843
    Local Time:
    5:03 AM
    Nginx 1.21.x
    MariaDB 10.x
    centminmod-gcc is provided as is on github without any support as it mainly written for my usage. But yes seems the download mirror for GCC 9 is empty now for at http://www.netgull.com/gcc/snapshots/LATEST-9/ hmmm. There's other GCC 9 mirrors though GCC mirror sites - GNU Project - Free Software Foundation (FSF). But not all mirrros are up to date.
     
  13. tininho

    tininho Active Member

    182
    44
    28
    May 22, 2019
    Ratings:
    +135
    Local Time:
    10:03 PM
  14. eva2000

    eva2000 Administrator Staff Member

    49,887
    11,487
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,843
    Local Time:
    5:03 AM
    Nginx 1.21.x
    MariaDB 10.x
    some apps (not centmin mod related) I build with GCC 9.2 custom built RPMs had errors.
     
  15. tininho

    tininho Active Member

    182
    44
    28
    May 22, 2019
    Ratings:
    +135
    Local Time:
    10:03 PM
    Recently MariaDB connection has failed after using LATEST-9 to build GCC, and then compiled Nginx with that.

    Wordpress page loses functionality:
    Code:
    database connection failed
    [11:32][root@- ~]# service mysql restart
    Redirecting to /bin/systemctl restart mysql.service
    Failed to restart mysql.service: Unit not found.


    Many errors on the build log, I listed some of them here:
    Code:
    checking for sys/filio.h
    
    objs/autotest.c:3:10: fatal error: sys/filio.h: No such file or directory
        3 | #include <sys/filio.h>
          |          ^~~~~~~~~~~~~
    compilation terminated.
    ----------
    
    
    #include <sys/filio.h>
    
    int main(void) {
        return 0;
    }
    
    checking for EPOLLEXCLUSIVE
    
    objs/autotest.c: In function 'main':
    objs/autotest.c:9:43: error: 'EPOLLEXCLUSIVE' undeclared (first use in this function)
        9 |                       ee.events = EPOLLIN|EPOLLEXCLUSIVE;
          |                                           ^~~~~~~~~~~~~~
    objs/autotest.c:9:43: note: each undeclared identifier is reported only once for each function it a$
    ----------
    
    checking for /dev/poll
    
    objs/autotest.c:4:10: fatal error: sys/devpoll.h: No such file or directory
        4 | #include <sys/devpoll.h>
          |          ^~~~~~~~~~~~~~~
    compilation terminated.
    
    checking for SO_ACCEPTFILTER
    
    objs/autotest.c: In function 'main':
    objs/autotest.c:7:31: error: 'SO_ACCEPTFILTER' undeclared (first use in this function); did you mea$
        7 |     setsockopt(0, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0);
          |                               ^~~~~~~~~~~~~~~
          |                               SO_LOCK_FILTER
    objs/autotest.c:7:31: note: each undeclared identifier is reported only once for each function it a$
    ----------
    
    #include <sys/types.h>
    #include <unistd.h>
    #include <sys/socket.h>
    
    int main(void) {
        setsockopt(0, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0);
        return 0;
    }
    
    
    EDIT: I will test it out with the default settings and leave it be for now, if it does not kick in. Thank you for providing such a tool to learn around the subject!
     
    Last edited: Nov 15, 2019
  16. eva2000

    eva2000 Administrator Staff Member

    49,887
    11,487
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,843
    Local Time:
    5:03 AM
    Nginx 1.21.x
    MariaDB 10.x
    use - mysql isn't valid in CentOS 7
    Code (Text):
    service mysqld restart

    Code (Text):
    mysqlrestart

    or
    Code (Text):
    systemctl restart mariadb


    if nginx or php-fpm binary gets built and works it should be fine as compilations aren't usually clean of all errors/warnings
     
  17. tininho

    tininho Active Member

    182
    44
    28
    May 22, 2019
    Ratings:
    +135
    Local Time:
    10:03 PM
    EDIT: After I've built Nginx&PHP with GCC9 I have to manually start MariaDB. So manual start is required after server restart, or after Nginx&PHP rebuild. This happens with the latest centmin beta code as of today.
     
    Last edited: Nov 16, 2019
  18. eva2000

    eva2000 Administrator Staff Member

    49,887
    11,487
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,843
    Local Time:
    5:03 AM
    Nginx 1.21.x
    MariaDB 10.x
    they wouldn't have anything to do with each other. To confirm I suggest you test a new test VPS from fresh centmin mod install first then try GCC 9 again as you may have messed up the existing VPS with your GCC 9 install tests previously. Again GCC 9 install of mine is provided as is without support for my personal use right now.