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

Support extensions written in Rust? #26

Open
cmb69 opened this issue Aug 4, 2024 · 10 comments
Open

Support extensions written in Rust? #26

cmb69 opened this issue Aug 4, 2024 · 10 comments
Labels
question Further information is requested

Comments

@cmb69
Copy link
Member

cmb69 commented Aug 4, 2024

There is some discussion about PECL extensions written in Rust on the PECL mailing list (https://news-web.php.net/php.pecl.dev/17600 ff), but so far without any consensus. Since @derickr said:

For the new PECL installer (PIE, https://github.com/php/pie) supporting this "style" hasn't been taken under consideration.

So maybe it's a good idea to consider this?

@asgrim
Copy link
Collaborator

asgrim commented Aug 4, 2024

If a Rust ext uses phpize && ./configure && make && make install, it will work with PIE. If not, it's something we can certainly consider! Do we have any examples of Rust exts?

@cmb69
Copy link
Member Author

cmb69 commented Aug 4, 2024

https://pecl.php.net/package/skywalking is already on PECL (and there may be more), and https://github.com/genkgo/php-ext-fs-notify has requested to be added to PECL. Note that both extensions use https://github.com/phper-framework/phper.

The problem is not necessarily that these extensions don't support phpize && ./configure && make && make install, but rather that they require to have a Rust/Cargo environment already available. If you do something like pecl install skywalking that likely fails on the usual servers (which have C build environment, but none for Rust).

If an extension written in Rust would support Windows (I'm not aware of any), that might also be an issue for https://github.com/php/php-windows-builder.

Anyway, I don't necessarily suggest that there needs to be full Rust build support in PIE, but rather that there is some information in the schema (maybe just rough, or maybe more thorough), and maybe that this is checked before even downloading and trying to install such extensions.

@johannes
Copy link
Member

johannes commented Aug 4, 2024

I don't know much about pie, but I would suggest to try being agnostic to the build system. Even for C (or C++) extensions there is some value in CMake or other build systems. (Better cross platform support, tooling support, some libraries one was TA to wrap might use CMake or other as their primary system etc )

@derickr
Copy link
Member

derickr commented Aug 5, 2024

I don't think pie currently first checks for a working C compilation set-up. At least, PECL never used to do that. So although "pie" doesn't take a working rust build system under consideration, it is no different than checking for a working C build system.

So I guess that that could be the real question here — whether it should check for a working build environment?

I don't think PIE should first check for a working build (C/Rust) environment, as there will be way too many permutations. config.m4 is the place for that — and I suppose there could be a new provided check for this — perhaps initially for Rust — so that not everybody will have to write these on their own, but this issue (or repository) is the place for that discussion.

@cmb69
Copy link
Member Author

cmb69 commented Aug 5, 2024

So I guess that that could be the real question here — whether it should check for a working build environment?

Not necessarily. In my opinion it would be sufficient to have some information in the schema. Not sure if https://github.com/ThePHPF/pie-design/blob/main/composer-json-php-ext-schema.json is up-to-date, but it could be added there (or whereever), so users (not necessarily PIE) could check that in advance. Maybe there could even be a PIE (sub-)command to list these requirements (perhaps something like pie build-info <package>).

@asgrim asgrim added the question Further information is requested label Aug 5, 2024
@asgrim
Copy link
Collaborator

asgrim commented Aug 5, 2024

It's certainly something that could be considered as an enhancement at some point, but for the initial iteration lets try and keep it simple 😁

@cmb69
Copy link
Member Author

cmb69 commented Aug 5, 2024

At the very least, it appears sensible to me to add some info to the schema right away; maybe similar to "support-zts" (which, by the way, does not really cater to extensions which require ZTS, like PECL/parallel).

@frederikbosch
Copy link

Later this month, I am going to publish the fs-notify extension, and I will test if it works with PIE too. If not, I'll try to come up with a PR.

@shivammathur
Copy link
Member

@cmb69
php-windows-builder supports this by reading the PATH_PROG calls in config.w32.

For example in dd-trace extension, cargo is required.
https://github.com/DataDog/dd-trace-php/blob/master/config.w32#L5
https://github.com/shivammathur/php-windows-builder/actions/runs/10751274987/job/29818375901

@cmb69
Copy link
Member Author

cmb69 commented Sep 17, 2024

php-windows-builder supports this by reading the PATH_PROG calls in config.w32.

Ah, nice! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants