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

[BUG]: broken build [-Wincompatible-pointer-types] #16531

Open
remicollet opened this issue Feb 16, 2024 · 14 comments
Open

[BUG]: broken build [-Wincompatible-pointer-types] #16531

remicollet opened this issue Feb 16, 2024 · 14 comments
Assignees
Labels
bug A bug report status: unverified Unverified

Comments

@remicollet
Copy link
Contributor

With recent GCC 14 (on Fedora 40)

Build fails with tons of:

/builddir/build/BUILD/php83-php-phalcon5-5.6.1/phalcon-5.6.1/phalcon.zep.c: In function 'zim_Phalcon_Storage_Adapter_Weak_increment':
/opt/remi/php83/root/usr/include/php/Zend/zend_API.h:2059:58: error: passing argument 2 of 'zend_parse_arg_str' from incompatible pointer type [-Wincompatible-pointer-types]
 2059 |                 if (UNEXPECTED(!zend_parse_arg_str(_arg, &dest, check_null, _i))) { \
/opt/remi/php83/root/usr/include/php/Zend/zend_portability.h:363:52: note: in definition of macro 'UNEXPECTED'
  363 | # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
      |                                                    ^~~~~~~~~
/opt/remi/php83/root/usr/include/php/Zend/zend_API.h:2066:9: note: in expansion of macro 'Z_PARAM_STR_EX'
 2066 |         Z_PARAM_STR_EX(dest, 0, 0)
      |         ^~~~~~~~~~~~~~
/builddir/build/BUILD/php83-php-phalcon5-5.6.1/phalcon-5.6.1/phalcon.zep.c:204823:17: note: in expansion of macro 'Z_PARAM_STR'
204823 |                 Z_PARAM_STR(key)
       |                 ^~~~~~~~~~~
/opt/remi/php83/root/usr/include/php/Zend/zend_API.h:2241:76: note: expected 'zend_string **' {aka 'struct _zend_string **'} but argument is of type 'zval *' {aka 'struct _zval_struct *'}
 2241 | static zend_always_inline bool zend_parse_arg_str(zval *arg, zend_string **dest, bool check_null, uint32_t arg_num)
      |                                                              ~~~~~~~~~~~~~~^~~~

Was already reported for a long time.

This was a warning, this in now an error

@Jeckerson
Copy link
Member

Yes, I remember your report and issue is still opened - zephir-lang/zephir#2326

There was my attempts during last months to improve it, but it is not trivial task to do. As whole Zephir relies on zval instead of specific types as zend_string or any other. But, there are already improvements in another types, such as zend_bool and zend_long. Which are located in Zephir's development branch.

I'll try to review it in near future...

@remicollet
Copy link
Contributor Author

As whole Zephir relies on zval instead of specific types as zend_string or any other.

If this case, DON'T use Z_PARAM_STR
Instead use Z_PARAM_ZVAL and check Z_TYPE_P(arg) == IS_STRING yourself

@stfast
Copy link

stfast commented Apr 29, 2024

Fedora 40 was released a week ago and we would go along with PHP 8.3 in this release.
Are there any timeline to compile phalcon with GCC 14, so we can plan system upgrade?

@remicollet
Copy link
Contributor Author

@stfast notice than on Fedora, you can use my repo which provides more PHP versions and more extensions than in official repository, including phalcon, see https://rpms.remirepo.net/wizard/

@stfast
Copy link

stfast commented Apr 30, 2024

Remi I admire your work, great, hard and wonderfull job you you are working, but I've allways had problems with (cycylic) package dependancies with your Remi repos on Fedora upgrades in the past. Thank you reminding me, I will try.

@andypost
Copy link

Any progress on the issue, I have to remove the package from Alpinelinux repo as no way to build it using GCC14

@HiralRajgor
Copy link

@niden

Please help us on this issue, as alpine linux package is removed from repo due to this.

@Jeckerson
Copy link
Member

On it

@jukuan
Copy link

jukuan commented Sep 30, 2024

same issue. Any updates on it? or replacements?suggestions?
A lot of people really need the phalcon package for alpine :)
Thanks in advance.

@Jeckerson
Copy link
Member

@andypost @jukuan How do you install in Alpine?

@Jeckerson
Copy link
Member

Just tried to compile on latest version of alpine with PHP8.3 and it requires near 5Gb of RAM:
image

before that it killed process with error:

cc: fatal error: Killed signal terminated program cc1

For some urgent cases: use swap files with 4-5Gb to compile it on VMs/VPS with small RAM.
Guide how to create swap file - Create swap file on Linux

I'll investigate what might be possible to do, but current warnings are not the core problem is original issue.

@HiralRajgor
Copy link

same issue. Any updates on it? or replacements?suggestions? A lot of people really need the phalcon package for alpine :) Thanks in advance.

Yeah True, I had to work on weekend, as my prod release got delayed due to package removal lol.

But I did some alternates, it might not be the best way but anyways it saved me :

  • I already have the compiled .so file downloaded from my running container phalcon.so so I have added this file in my project, and when my docker container runs, phalcon.so file is available at [https://github.com/phalcon/cphalcon/releases/tag/v5.8.0] as well.
    i have just copied this phalcon.so file to /usr/lib/php82/modules in my alpine linux
  • Then created one phalcon.ini file /etc/php82/conf.d/phalcon.ini, this file is containing extension=phalcon
  • I found one more phalcon file in my running container and downloaded this file and added in my project, php_phalcon.h and then same when docker container runs copied this file to /usr/include/php82/ext/phalcon/php_phalcon.h

@jukuan
Copy link

jukuan commented Oct 1, 2024

@andypost @jukuan How do you install in Alpine?

Now I'm using docker:

ENV PHALCON_VERSION=5.8.0
WORKDIR /usr/src/php/ext
RUN set -xe && \
    curl -LO https://github.com/phalcon/cphalcon/archive/v${PHALCON_VERSION}.tar.gz && \
    tar xzf v${PHALCON_VERSION}.tar.gz && cd cphalcon-${PHALCON_VERSION}/build && ./install && \
    echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/phalcon.ini && \
    cd ../.. && rm -rf v${PHALCON_VERSION}.tar.gz cphalcon-${PHALCON_VERSION}

But previously i used just the "php82-pecl-phalcon" package:

- apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/testing php82-pecl-phalcon=5.8.0-r0

and that way stopped working last 3-4 days, because package has been removed by vendor.

@jukuan
Copy link

jukuan commented Oct 18, 2024

My solution is to build the Phalcon from the source code for my alpine container. The basic Dockerfile snippes is below. Don't rely on the testing repositories any more :)

Feel free to use it and/or tell me what might be improved.

FROM php:8.2-cli-alpine

ARG PHALCON_VER=5.8.0

RUN set -eux; \
    cd /tmp && \
    curl -sSJL -o phalcon.tar.gz "https://github.com/phalcon/cphalcon/archive/v${PHALCON_VER}.tar.gz" && \
    mkdir -p /usr/src/phalcon && \
    tar -xzf phalcon.tar.gz -C /usr/src/phalcon --strip-components=1 && \
    cd /usr/src/phalcon/build && ./install && \
    docker-php-ext-enable decimal phalcon  && \
    \
# Clean up
    apk del \
        autoconf \
        gcc \
        g++ \
        git \
        libaio \
        libc-dev \
        make \
        pkgconf \
        re2c \
    && rm -rf /var/cache/apk/* /tmp/*
    
COPY --from=composer:2.8 /usr/bin/composer /usr/local/bin/composer

WORKDIR /var/www/html
CMD ["php", "-a"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: unverified Unverified
Projects
None yet
Development

No branches or pull requests

6 participants