diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d986c660..4a50ca4f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,6 +40,11 @@ jobs: librdkafka: 'v1.9.2' memcheck: '1' + # X32 + - php: '8.3.0' + librdkafka: 'v2.6.0' + arch: 'X32' + # Latest librdkafka 2.x - php: '8.3.0' librdkafka: 'v2.3.0' @@ -172,6 +177,7 @@ jobs: SKIP_OAUTH: ${{ matrix.skipoauth }} TEST_KAFKA_BROKERS: kafka:9092 TEST_KAFKA_BROKER_VERSION: 2.6 + ARCH: ${{ matrix.arch }} steps: - name: 'Check out repository' uses: 'actions/checkout@v2' @@ -181,12 +187,15 @@ jobs: - uses: actions/cache@v2 with: path: ~/build-cache/php - key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.memcheck }} + key: ${{ runner.os }}-${{ matrix.arch }}-${{ matrix.php }}-${{ matrix.memcheck }} - uses: actions/cache@v2 with: path: ~/build-cache/librdkafka - key: ${{ runner.os }}-${{ matrix.librdkafka }} + key: ${{ runner.os }}-${{ matrix.arch }}-${{ matrix.librdkafka }} + + - name: 'Install dependencies' + run: './php-rdkafka/.github/workflows/test/install-dependencies.sh' - name: 'Build librdkafka' run: './php-rdkafka/.github/workflows/test/build-librdkafka.sh' diff --git a/.github/workflows/test/build-librdkafka.sh b/.github/workflows/test/build-librdkafka.sh index 7674b7d6..adbcb870 100755 --- a/.github/workflows/test/build-librdkafka.sh +++ b/.github/workflows/test/build-librdkafka.sh @@ -7,9 +7,19 @@ if ! [ -f ~/build-cache/librdkafka/usr/local/include/librdkafka/rdkafka.h ] || ! git clone --depth 1 --branch "${LIBRDKAFKA_VERSION:-v2.3.0}" "${LIBRDKAFKA_REPOSITORY_URL:-https://github.com/edenhill/librdkafka.git}" + LIBRDKAFKA_BUILD_FLAGS= + + if [ "$ARCH" = "X32" ]; then + export CC="${CC:-gcc} -m32" + export CFLAGS="$CFLAGS -m32" + export CXXFLAGS="$CXXFLAGS -m32" + export LDFLAGS="$LDFLAGS -m32" + LIBRDKAFKA_BUILD_FLAGS="$LIBRDKAFKA_BUILD_FLAGS --build=i686-pc-linux-gnu" + fi + cd librdkafka - ./configure - make + ./configure $LIBRDKAFKA_BUILD_FLAGS + make -j $(nproc) mkdir -p ~/build-cache/librdkafka sudo make install DESTDIR=$HOME/build-cache/librdkafka test -f ~/build-cache/librdkafka/usr/local/include/librdkafka/rdkafka.h || echo "librdkafka build failed" @@ -22,7 +32,7 @@ if ! [ -f ~/build-cache/librdkafka/usr/local/include/librdkafka/rdkafka.h ] || ! cd kafkacat ./configure - make + make -j $(nproc) sudo make install DESTDIR=$HOME/build-cache/librdkafka else diff --git a/.github/workflows/test/build-php-rdkafka.sh b/.github/workflows/test/build-php-rdkafka.sh index acf09a6d..0245c8ca 100755 --- a/.github/workflows/test/build-php-rdkafka.sh +++ b/.github/workflows/test/build-php-rdkafka.sh @@ -11,10 +11,17 @@ PACKAGE_VERSION="$(grep -m 1 '' package.xml|cut -d'>' -f2|cut -d'<' -f1 pecl package -if [ $MEMORY_CHECK -eq 1 ]; then - PHP_RDKAFKA_CFLAGS="-Wall -Werror -Wno-deprecated-declarations" +if [ $MEMORY_CHECK -eq 1 ] || [ "$ARCH" = "X32" ]; then + export CFLAGS="$CFLAGS -Wall -Werror -Wno-deprecated-declarations" fi -sudo CFLAGS="$PHP_RDKAFKA_CFLAGS" pecl install "./rdkafka-$PACKAGE_VERSION.tgz" +if [ "$ARCH" = "X32" ]; then + export CC="${CC:-gcc} -m32" + export CFLAGS="$CFLAGS -m32" + export CXXFLAGS="$CXXFLAGS -m32" + export LDFLAGS="$LDFLAGS -m32" +fi + +sudo -E pecl install "./rdkafka-$PACKAGE_VERSION.tgz" echo "extension=rdkafka.so"|sudo tee /usr/local/etc/php/rdkafka.ini >/dev/null diff --git a/.github/workflows/test/build-php.sh b/.github/workflows/test/build-php.sh index e8d4cecc..76f008f6 100755 --- a/.github/workflows/test/build-php.sh +++ b/.github/workflows/test/build-php.sh @@ -2,10 +2,6 @@ set -ex -if [ $MEMORY_CHECK -eq 1 ]; then - sudo apt-get -y install valgrind -fi - if ! [ -f ~/build-cache/php/usr/local/bin/php ]; then echo "PHP build is not cached" @@ -29,6 +25,14 @@ if ! [ -f ~/build-cache/php/usr/local/bin/php ]; then esac fi + if [ "$ARCH" = "X32" ]; then + export CC="${CC:-gcc} -m32" + export CFLAGS="$CFLAGS -m32" + export CXXFLAGS="$CXXFLAGS -m32" + export LDFLAGS="$LDFLAGS -m32" + PHP_BUILD_FLAGS="$PHP_BUILD_FLAGS --build=i686-pc-linux-gnu" + fi + ./configure $PHP_BUILD_FLAGS $PHP_BUILD_EXTRA_FLAGS make -j $(nproc) mkdir -p ~/build-cache/php diff --git a/.github/workflows/test/install-dependencies.sh b/.github/workflows/test/install-dependencies.sh new file mode 100755 index 00000000..45f4d638 --- /dev/null +++ b/.github/workflows/test/install-dependencies.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +set -ex + +export DEBIAN_FRONTEND=noninteractive + +DEPS="zlib1g-dev libssl-dev" + +if [ "$ARCH" = "X32" ]; then + sudo dpkg --add-architecture i386 + sudo apt-get update + DEPS="$DEPS gcc-multilib g++-multilib zlib1g-dev:i386 libssl-dev:i386" +fi + +if [ "$MEMORY_CHECK" = "1" ]; then + DEPS="$DEPS valgrind" +fi + +if [ -n "$DEPS" ]; then + sudo apt-get -y install $DEPS +fi diff --git a/conf.c b/conf.c index 9aa8132f..6330e62e 100644 --- a/conf.c +++ b/conf.c @@ -340,6 +340,7 @@ static void kafka_conf_log_cb(const rd_kafka_t *rk, int level, const char *facil zval_ptr_dtor(&args[3]); } +#ifdef HAS_RD_KAFKA_OAUTHBEARER /* void rd_kafka_conf_set_oauthbearer_token_refresh_cb( rd_kafka_conf_t *conf, @@ -371,8 +372,7 @@ static void kafka_conf_set_oauthbearer_token_refresh_cb(rd_kafka_t *rk, const ch zval_ptr_dtor(&args[0]); zval_ptr_dtor(&args[1]); } - - +#endif /* {{{ proto RdKafka\Conf::__construct() */ PHP_METHOD(RdKafka_Conf, __construct)