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

Add extension rdkafka support #256

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add extension rdkafka support #256

wants to merge 4 commits into from

Conversation

crazywhalecc
Copy link
Owner

@crazywhalecc crazywhalecc commented Nov 5, 2023

Linux support is not available yet: confluentinc/librdkafka#4495

@crazywhalecc crazywhalecc added enhancement New feature or request wip Work In Process kind/extension Issues related to extensions labels Nov 5, 2023
@crazywhalecc crazywhalecc marked this pull request as draft November 5, 2023 09:12
@crazywhalecc crazywhalecc mentioned this pull request Nov 5, 2023
36 tasks
@mihaileu
Copy link

mihaileu commented Jan 3, 2024

how can we move further here, we need this extension for our setup ?!

@crazywhalecc
Copy link
Owner Author

@mihaileu I can't do anything yet, unless someone can provide a patch for the librdkafka library, or the discussion started above is answered.

@daddeffe
Copy link

@crazywhalecc Hi, there has been the latest 2.4.0 release of libkafka with a fix for static builds. I don't know if the fix is whole or related but there is. Sorry for not testing myself but I never worked on c projects at all.. (my lack).

@crazywhalecc
Copy link
Owner Author

@crazywhalecc Hi, there has been the latest 2.4.0 release of libkafka with a fix for static builds. I don't know if the fix is whole or related but there is. Sorry for not testing myself but I never worked on c projects at all.. (my lack).

@daddeffe Unfortunately it still failed to build statically on Linux. I think I need to open an issue about it (discussion may not be noticed)

@daddeffe
Copy link

Hi, I dont want to create entropy, but I managed to install it on my machine statically
Hoping that help here the diff from the configure from static-php and my native build
image

@crazywhalecc
Copy link
Owner Author

@daddeffe Thanks for your work! It would be even better if it can be verified to work on Alpine Linux (for testing compatibility with musl-libc).

@daddeffe
Copy link

daddeffe commented Sep 17, 2024

./bin/spc-alpine-docker build "rdkafka" --build-cli  --build-micro
     _        _   _                 _
 ___| |_ __ _| |_(_) ___      _ __ | |__  _ __
/ __| __/ _` | __| |/ __|____| '_ \| '_ \| '_ \
\__ \ || (_| | |_| | (_|_____| |_) | | | | |_) |
|___/\__\__,_|\__|_|\___|    | .__/|_| |_| .__/   v2.3.4
                             |_|         |_|
[16:22:45] [INFO] Build OS:       Linux (x86_64)
[16:22:45] [INFO] Build SAPI:     cli, micro
[16:22:45] [INFO] Extensions (1): rdkafka
[16:22:45] [INFO] Libraries (3):  zlib,openssl,librdkafka
[16:22:45] [INFO] Strip Binaries: yes
[16:22:45] [INFO] Enable ZTS:     no
[16:22:45] [INFO] PHP Version:    8.2.23
[16:22:45] [NOTI] Build will start after 2s ...
[16:22:47] [NOTI] lib [pkg-config] already built
[16:22:47] [NOTI] lib [zlib] already built
[16:22:47] [NOTI] lib [openssl] already built
[16:22:47] [NOTI] lib [librdkafka] already built
[16:22:47] [INFO] Entering dir: /app/source/php-src
[16:22:47] [INFO] [EXEC] ./buildconf --force
[16:22:51] [INFO] Entering dir: /app/source/php-src
[16:22:51] [INFO] [EXEC] pkg-config --libs --static rdkafka
[16:22:51] [INFO] rdkafka is using --with-rdkafka=/app/buildroot LIBS="-L/app/buildroot/lib/pkgconfig/../../lib -lrdkafka -lm -ldl -lpthread -lrt -lpthread -lrt"
[16:22:51] [INFO] [EXEC] pkg-config --libs --static rdkafka
[16:22:51] [INFO] [EXEC] LD_LIBRARY_PATH=/usr/local/musl/x86_64-linux-musl/lib ./configure --prefix= --with-valgrind=no --enable-shared=no --enable-static=yes --disable-all --disable-cgi --disable-phpdbg --enable-cli --disable-fpm --disable-embed --enable-micro=all-static --with-rdkafka=/app/buildroot LIBS="-L/app/buildroot/lib/pkgconfig/../../lib -lrdkafka -lm -ldl -lpthread -lrt -lpthread -lrt" CFLAGS='' CPPFLAGS='-I/app/buildroot/include' LDFLAGS='-L/app/buildroot/lib' LIBS='-ldl -lpthread -lm'
[16:23:01] [INFO] Extension [rdkafka] patched before make
[16:23:01] [INFO] cleaning up
[16:23:01] [INFO] Entering dir: /app/source/php-src
[16:23:01] [INFO] [EXEC] make clean
[16:23:02] [INFO] building cli
[16:23:02] [INFO] Entering dir: /app/source/php-src
[16:23:02] [INFO] [EXEC] sed -i "s|//lib|/lib|g" Makefile
[16:23:02] [INFO] [EXEC] $SPC_CMD_PREFIX_PHP_MAKE EXTRA_CFLAGS='-g -Os -fno-ident -fPIE' EXTRA_LIBS='/app/buildroot/lib/librdkafka.a /app/buildroot/lib/librdkafka++.a /app/buildroot/lib/librdkafka-static.a /app/buildroot/lib/libssl.a /app/buildroot/lib/libcrypto.a /app/buildroot/lib/libz.a -lstdc++  ' EXTRA_LDFLAGS_PROGRAM='-all-static' cli
[16:23:40] [INFO] Entering dir: /app/source/php-src/sapi/cli
[16:23:40] [INFO] [EXEC] strip --strip-all php
[16:23:40] [INFO] Deploying cli file
[16:23:40] [INFO] [EXEC] cp '/app/source/php-src/sapi/cli/php' '/app/buildroot/bin/'
[16:23:40] [INFO] building micro
[16:23:40] [INFO] Entering dir: /app/source/php-src
[16:23:40] [INFO] [EXEC] sed -i "s|//lib|/lib|g" Makefile
[16:23:40] [INFO] [EXEC] $SPC_CMD_PREFIX_PHP_MAKE EXTRA_CFLAGS='-g -Os -fno-ident -fPIE' EXTRA_LIBS='/app/buildroot/lib/librdkafka.a /app/buildroot/lib/librdkafka++.a /app/buildroot/lib/librdkafka-static.a /app/buildroot/lib/libssl.a /app/buildroot/lib/libcrypto.a /app/buildroot/lib/libz.a -lstdc++  ' EXTRA_LDFLAGS_PROGRAM='-all-static' micro
[16:23:41] [INFO] [EXEC] strip --strip-all /app/source/php-src/sapi/micro/micro.sfx
[16:23:41] [INFO] Deploying micro file
[16:23:41] [INFO] [EXEC] cp '/app/source/php-src/sapi/micro/micro.sfx' '/app/buildroot/bin/'
[16:23:41] [INFO] running cli sanity check
[16:23:41] [INFO] [EXEC] /app/buildroot/bin/php -r "echo \"hello\";"
[16:23:41] [INFO] [EXEC] /app/source/micro_ext_test.exe
[16:23:41] [INFO] [EXEC] /app/source/micro_zend_bug_test.exe
[16:23:41] [INFO] Build complete, used 56.35 s !
[16:23:41] [INFO] Static php binary path (host system): /home/df/work/static-php-cli/app/buildroot/bin/php
[16:23:41] [INFO] phpmicro binary path (host system): /home/df/work/static-php-cli/app/buildroot/bin/micro.sfx
[16:23:41] [INFO] License path (host system): /home/df/work/static-php-cli/app/buildroot/license/

@crazywhalecc Is this a success?? Built on alpine, merged main, added just --disable-ssl --disable-gssapi --disable-zlib to the src/SPC/builder/unix/library/librdkafka.php file.
I will try to test it asap but I'm a little overwhelmed this days

@crazywhalecc
Copy link
Owner Author

@daddeffe --disable-ssl --disable-gssapi --disable-zlib: Can't we choose to enable zlib and openssl?

@crazywhalecc crazywhalecc marked this pull request as ready for review September 23, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request kind/extension Issues related to extensions wip Work In Process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants