Tensor icon indicating copy to clipboard operation
Tensor copied to clipboard

PECL Windows Build Fails (Missing Dependencies on Build Server)

Open P2T opened this issue 4 years ago • 32 comments

All versions fail to compile

fatal error C1083: Cannot open include file: 'cblas.h': No such file or directory

See https://windows.php.net/downloads/pecl/releases/tensor/

P2T avatar Mar 13 '21 12:03 P2T

Thank you very much @P2T we'll try to figure this out

andrewdalpino avatar Mar 15 '21 08:03 andrewdalpino

I think that the cause is a missing dependency, but I know absolutely nothing about how the pecl website builds Windows binaries, and how additional dependencies can be configured. My first thought is asking @cmb69

mlocati avatar Apr 12 '21 03:04 mlocati

It seems this extension requires several libraries, but these dependencies are not checked during configuration on Windows (in config.w32). These checks would fail for PECL builds, though, since these libs are not available at https://windows.php.net/downloads/pecl/deps/. I'll see what I can do.

cmb69 avatar Apr 12 '21 09:04 cmb69

Thank you @cmb69! We appreciate the help - let us know what we can do on our end!

andrewdalpino avatar Apr 13 '21 18:04 andrewdalpino

Not installed on Docker php:8.0.12-fpm-alpine3.14 Has anyone had this problem?

Kabingeran avatar Oct 26 '21 18:10 Kabingeran

@Kabingeran try with https://github.com/mlocati/docker-php-extension-installer

mlocati avatar Oct 26 '21 18:10 mlocati

The instructions say what should be installed like this pecl install tensor https://github.com/RubixML/Tensor#readme

Kabingeran avatar Oct 27 '21 03:10 Kabingeran

What's the error you are having?

mlocati avatar Oct 27 '21 04:10 mlocati

Thank you. The problems was solved by installing the dependencies

Kabingeran avatar Oct 27 '21 21:10 Kabingeran

You need to install a couple of system libraries (for example like this), but it's much easier to use https://github.com/mlocati/docker-php-extension-installer

mlocati avatar Oct 27 '21 21:10 mlocati

It seems this extension requires several libraries, but these dependencies are not checked during configuration on Windows (in config.w32). These checks would fail for PECL builds, though, since these libs are not available at https://windows.php.net/downloads/pecl/deps/. I'll see what I can do.

Can this problem be also solved ?

P2T avatar Oct 28 '21 12:10 P2T

Can this problem be also solved ?

I tried to build OpenBLAS on Windows a while ago, but failed miserably. I have not been able to find usable prebuilt binaries either. Any pointer would be appreciated.

cmb69 avatar Oct 28 '21 12:10 cmb69

@cmb69 can't we use the lib/dll/.h files that come from assets attached to https://github.com/xianyi/OpenBLAS/releases ?

mlocati avatar Oct 28 '21 21:10 mlocati

@mlocati, thanks for the hint! That seems to work for the vs16 builds, but apparently hangs for the vc15 builds (likely it is because they used VS 2019 for compiling/linking, but maybe I screwed something up). I need to check out the details tomorrow, and will then do a snapshot build of the latest PECL package, so that it can be tested before I do a release build.

cmb69 avatar Nov 04 '21 22:11 cmb69

This is super ugly! There's no way to link a v142 built lib with v141, so we can't use these binaries for PHP < 8.0.0. Furthermore, PECL builds won't work even for PHP ≥ 8.0.0, because we're using the 16.9 toolset, but those binaries have been built with the 16.8 toolset, and PECL builds do a full in-tree build. So without other OpenBLAS binaries, we can only have phpize builds of tensor for PHP ≥ 8.0.0 on Windows.

Oh, and this only works, if we patch lapack.h, because MSVC doesn't support the _Complex keyword, and defining respective macros as explained in the header would skip the inclusion of complex.h.

Anyhow, I've made the modified packages available as pecl/deps, and submitted PR #24, which allows for phpize builds. You can get prebuilt Windows packages; please test these, but do not use them in production!

cmb69 avatar Nov 05 '21 15:11 cmb69

I've tried them on Windows 10, PHP 8.0.10, it seems to be OK. Thank you.

P2T avatar Nov 06 '21 10:11 P2T

Replying to https://github.com/RubixML/Tensor/pull/24#issuecomment-991824993 here, because that PR discussion has been locked by the bot.

I'm afraid there is no documentation regarding the configuration on Windows. It is basically a partial port of GNU autoconf to JScript running on the Windows scripting host. Most of the GNU autoconf macro replacements are defined in confutils.js; the main script to build the configuration is buildconf.js.

Anyhow, the patch in PR #24 is about checking for the OpenBLAS library actually being available, and to let the build fail otherwise. More importantly, though, CHECK_LIB also adds the library to the libraries to link against, and CHECK_HEADER_ADD_INCLUDE adds the headers to the include path. If this is not done (especially the CHECK_LIB), the build inevitably fails due to missing symbols from libopenblas.lib. All that is basically the Windows counterpart of

https://github.com/RubixML/Tensor/blob/ebef5142e03e8d7d2806c7dcb786c00bfd2793e7/ext/config.m4#L7-L9

Note that the PHP Windows buildsystem does not use pkg-config.

BTW, I think this ticket can be closed after PR #24 has been merged.

cmb69 avatar Dec 12 '21 12:12 cmb69

Oh sorry about that, I'll have to find a way to allow comments on merged PRs. Thanks for the explanation, it really helps alot! We still need to figure a way to patch the config.w32 file after Zephir compiles it. It shoudn't be too hard now that I have a better idea as to what's going on.

andrewdalpino avatar Dec 12 '21 19:12 andrewdalpino

Hello has anyone been able to compile the extension for windows?

ncavare avatar May 23 '22 15:05 ncavare

Hi! What is the status of this issue? Is it possible to get the extension compiled for windows? Thanks!

federicoemartinez avatar Jun 06 '22 14:06 federicoemartinez

I've managed to build it for php 7.4 nts x64 for windows: https://github.com/federicoemartinez/Tensor/releases/tag/3.0.1 I don't know if I can help you somehow so you can build it again.

federicoemartinez avatar Jun 16 '22 21:06 federicoemartinez

I've managed to build it for php 7.4 nts x64 for windows: https://github.com/federicoemartinez/Tensor/releases/tag/3.0.1 I don't know if I can help you somehow so you can build it again.

This does not work for me.

image

takielias avatar Aug 31 '22 00:08 takielias

I've managed to build it for php 7.4 nts x64 for windows: https://github.com/federicoemartinez/Tensor/releases/tag/3.0.1 I don't know if I can help you somehow so you can build it again.

This does not work for me.

image

Where did you put libopenblas.dll? Try placing it in the same directory as php.exe if you put it in the ext directory.

federicoemartinez avatar Aug 31 '22 00:08 federicoemartinez

I've managed to build it for php 7.4 nts x64 for windows: https://github.com/federicoemartinez/Tensor/releases/tag/3.0.1 I don't know if I can help you somehow so you can build it again.

This does not work for me. image

Where did you put libopenblas.dll? Try placing it in the same directory as php.exe if you put it in the ext directory.

image I did but facing same issue.

takielias avatar Aug 31 '22 01:08 takielias

I'm using ts version of php 7.4. Is it an issue?

takielias avatar Aug 31 '22 01:08 takielias

@federicoemartinez Thanks a lot. solved the issue by using nts version of PHP 7.4. Could you please make a ts version of the tensor build for windows please?

takielias avatar Aug 31 '22 01:08 takielias

@federicoemartinez Thanks a lot. solved the issue by using nts version of PHP 7.4. Could you please make a ts version of the tensor build for windows please?

I'll try, but I'm going on vacations right now so it will have to wait.

federicoemartinez avatar Aug 31 '22 19:08 federicoemartinez

@federicoemartinez Thanks a lot. solved the issue by using nts version of PHP 7.4. Could you please make a ts version of the tensor build for windows please?

I'll try, but I'm going on vacations right now so it will have to wait.

That's great. Waiting for your ts release.

takielias avatar Sep 01 '22 05:09 takielias

@federicoemartinez I have tried several time but could not use the .dll of PHP 8.1 (nts). It does not show any error. Is it not ready? image

takielias avatar Sep 04 '22 06:09 takielias

@federicoemartinez Thanks a lot. solved the issue by using nts version of PHP 7.4. Could you please make a ts version of the tensor build for windows please?

I'll try, but I'm going on vacations right now so it will have to wait.

Hello @federicoemartinez Could you please make a ts version?

takielias avatar Nov 06 '22 13:11 takielias