On 2/9/21 12:59 PM, compo...@colannino.dev wrote:
Recently, I've tried compiling a custom extension against PHP 8.0.2 and have received the following error:

In file included from /home/james/git/trogdor-pp/src/php7/trogdord/game.cpp:1: /home/james/local/php8.0.2/include/php/Zend/zend_long.h:124:3: error: #error "Unknown SIZEOF_SIZE_T"
  124 | # error "Unknown SIZEOF_SIZE_T"
      |   ^~~~~

I've not encountered this before and I'm not sure what's changed about my environment other than I upgraded from 8.0.1 to 8.0.2. Does anyone know why this is happening? I dug into the header to see what the problem was, and it's related to the definition of SIZEOF_SIZE_T, but I'm not able to debug any further.

Any help would be appreciated. Thank you!

It looks like I can resolve this by doing:

extern "C" {
    #include "php.h"
    #include "php_config.h"
}

Instead of just:

extern "C" {
    #include "php.h"
}

I'm not sure what changed (the old way still works for me when I compile against 7.3 and 7.4, and it was working previously for me as recently as 8.0.1), but the extra include fixes the problem for me, so I'm considering this solved. Thanks, everyone!

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to