kjdev/php-ext-brotli

error: ‘BROTLI_LIB_VERSION’ undeclared (first use in this function)

ahmed-sigmalux opened this issue · 2 comments

Encountering this error on the latest build:

/home/user/php-ext-brotli/brotli.c: In function ‘zm_info_brotli’:
/home/user/php-ext-brotli/brotli.c:60:52: error: ‘BROTLI_LIB_VERSION’ undeclared (first use in this function)
     php_info_print_table_row(2, "Library Version", BROTLI_LIB_VERSION);
                                                    ^~~~~~~~~~~~~~~~~~
/home/user/php-ext-brotli/brotli.c:60:52: note: each undeclared identifier is reported only once for each function it appears in
Makefile:194: recipe for target 'brotli.lo' failed
make: *** [brotli.lo] Error 1
kjdev commented

The definition of BROTLI_LIB_VERSION is done in config.m4.

65: AC_DEFINE_UNQUOTED(BROTLI_LIB_VERSION, "$LIBBROTLIDEC_VERSION", [system library version])
69: AC_DEFINE_UNQUOTED(BROTLI_LIB_VERSION, "1.0.1", [bundled library version])

What did the configure option specify?

  • Built in (v1.0.1)

    % git clone --recursive --depth=1 https://github.com/kjdev/php-ext-brotli.git
    % cd php-ext-brotli
    % phpize
    % ./configure
    % make  # OK
    
  • System library (v0.6.0 on Fedora 26)

    % git clone --recursive --depth=1 https://github.com/kjdev/php-ext-brotli.git
    % cd php-ext-brotli
    % phpize
    % ./configure --with-libbrotli
    % make # OK
    
    % pkg-config libbrotlidec --modversion
    0.6.0
    

This fixed the problem:

./configure --with-libbrotli