swoole-src icon indicating copy to clipboard operation
swoole-src copied to clipboard

Unable to build Swoole: error: expected ‘)’ before ‘long’

Open razonyang opened this issue 3 years ago • 4 comments

Please answer these questions before submitting your issue.

  1. What did you do? If possible, provide a simple script for reproducing the error.

I want to set up the environment on Scrutinizer CI, but failed to build Swoole.

  1. What did you expect to see?

Build successfully.

  1. What did you see instead?

Full log can be found at https://scrutinizer-ci.com/g/razonyang/psr7-swoole/inspections/82711dd7-e79f-4b2e-ae01-bc7db9489369.

 g++ -I. -I/tmp/pear/temp/swoole -I/tmp/pear/temp/pear-build-scrutinizer6BILj2/swoole-5.0.0/include -I/tmp/pear/temp/pear-build-scrutinizer6BILj2/swoole-5.0.0/main -I/tmp/pear/temp/swoole -I/home/scrutinizer/.phpenv/versions/8.1.1/include/php -I/home/scrutinizer/.phpenv/versions/8.1.1/include/php/main -I/home/scrutinizer/.phpenv/versions/8.1.1/include/php/TSRM -I/home/scrutinizer/.phpenv/versions/8.1.1/include/php/Zend -I/home/scrutinizer/.phpenv/versions/8.1.1/include/php/ext -I/home/scrutinizer/.phpenv/versions/8.1.1/include/php/ext/date/lib -I/tmp/pear/temp/swoole -I/tmp/pear/temp/swoole/include -I/tmp/pear/temp/swoole/stubs -I/tmp/pear/temp/swoole/ext-src -I/tmp/pear/temp/swoole/thirdparty -I/tmp/pear/temp/swoole/thirdparty/hiredis -DHAVE_CONFIG_H -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11 -DENABLE_PHP_SWOOLE -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/swoole/src/protocol/dtls.cc -MMD -MF src/protocol/dtls.dep -MT src/protocol/dtls.lo  -fPIC -DPIC -o src/proto
col/.libs/dtls.o
/tmp/pear/temp/swoole/src/protocol/dtls.cc: In function ‘BIO_METHOD* swoole::dtls::BIO_get_methods()’:
/tmp/pear/temp/swoole/src/protocol/dtls.cc:128:47: error: expected primary-expression before ‘long’
     BIO_meth_set_callback_ctrl(_bio_methods, (long (*)(BIO *, int, BIO_info_cb *)) BIO_callback_ctrl);
                                               ^~~~
/tmp/pear/temp/swoole/src/protocol/dtls.cc:128:47: error: expected ‘)’ before ‘long’
Makefile:439: recipe for target 'src/protocol/dtls.lo' failed
make: *** [src/protocol/dtls.lo] Error 1
ERROR: `make' failed
  1. What version of Swoole are you using (show your php --ri swoole)?

5

  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?

php: 8.1.1

.scrutinizer.yml configuration as following.

checks:
  php: true

filter:
  paths:
    - src/

build:
  image: default-bionic

  environment:
    php:
      version: 8.1
      pecl_extensions:
        - swoole
      ini:
        xdebug.mode: coverage

  nodes:
    analysis:
      tests:
        override:
          - php-scrutinizer-run

    phpunit:
      dependencies:
        override:
          - composer self-update
          - composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

      tests:
        override:
          - command: ./vendor/bin/phpunit --coverage-clover ./coverage.xml
            on_node: 1
            coverage:
              file: coverage.xml
              format: php-clover

razonyang avatar Sep 17 '22 02:09 razonyang

what is your openssl and gcc version?

NathanFreeman avatar Sep 20 '22 14:09 NathanFreeman

@NathanFreeman I ran the build again, OS information as follows.

$ uname -a
Linux container-3 5.15.0-25-generic #25-Ubuntu SMP Wed Mar 30 15:54:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

$ openssl version
OpenSSL 1.1.0g  2 Nov 2017

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.4.0-1ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04)

The full build log could be found in https://scrutinizer-ci.com/g/razonyang/psr7-swoole/inspections/26f7e812-a639-48bf-b36b-87d60639e7a3.

razonyang avatar Sep 20 '22 14:09 razonyang

I reproduce it,your openssl version is low. You can upgrade your openssl (openssl1.1.1q) to fix it. I will make a new pr about openssl1.1.0g later.

NathanFreeman avatar Sep 20 '22 15:09 NathanFreeman

@NathanFreeman Thanks for confirming.

razonyang avatar Sep 20 '22 16:09 razonyang