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 initial intl-icu windows support #445

Closed
wants to merge 1 commit into from
Closed

Conversation

crazywhalecc
Copy link
Owner

What does this PR do?

Try to fix #435

Checklist before merging

If your PR involves the changes mentioned below and completed the action, please tick the corresponding option.
If a modification is not involved, please skip it directly.

  • If it's a extension or dependency update, make sure adding related extensions in src/global/test-extensions.php.
  • If you changed the behavior of static-php-cli, add docs in static-php/static-php-cli-docs .
  • If you updated config/xxxx.json content, run bin/spc dev:sort-config xxx.

@crazywhalecc crazywhalecc added enhancement New feature or request kind/extension Issues related to extensions os/windows Things only for Windows labels May 9, 2024
@crazywhalecc
Copy link
Owner Author

crazywhalecc commented May 9, 2024

@simonhamp

I traveled across almost entire internet, and found a lot of things that proved we cannot statically build icu with Visual Studio. If we want to compile statically on Windows, we may have to use Cygwin or MSYS2, but they are also not suitable for static linking.

The first evidence is the mail list from SourceForge: In short, it can't be done.

The second one is from icu official docs: the following configure options (including --enable-static) currently do not work on Windows with Microsoft’s compiler.

I also tried to patch icu code, such as adding /MT, replacing .dll with .lib, applying other static build patch, and all of my work just failed to achieve this.

Although I don't want to say it, it is almost impossible for me to solve this now, unless the icu official or others who are more familiar with VC++ can provide more details.

But don't have to worry about not being able to use the intl extension under static-php.exe. It is also possible to compile intl.dll and icu*.dll separately, enable extension and place them in the current directory.

@simonhamp
Copy link
Contributor

Thanks for your work! and thorough explanation. This is super helpful. I will explore your suggestion as an alternative on Windows to see where we can get to.

Do I need to anything special when building static-php.exe in order to enable the extension to be loaded dynamically in this way?

@crazywhalecc
Copy link
Owner Author

crazywhalecc commented May 9, 2024

Do I need to anything special when building static-php.exe in order to enable the extension to be loaded dynamically in this way?

I haven't tested more extensions, but what is certain is that the default compilation results in working directly with php.ini and extension=C:\path\to\ext.dll. The condition is the target of dll extension compilation needs to be consistent with PHP (VS main version, thread safety, PHP version).

Under normal circumstances, it is not difficult to match the three, but if possible, we can reuse the static-php build kit to build the extension dll.

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 os/windows Things only for Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extension request: intl on Windows
2 participants