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

PECL Windows Build Fails (Missing Dependencies on Build Server) #22

Open
P2T opened this issue Mar 13, 2021 · 32 comments
Open

PECL Windows Build Fails (Missing Dependencies on Build Server) #22

P2T opened this issue Mar 13, 2021 · 32 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@P2T
Copy link

P2T commented Mar 13, 2021

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/

@andrewdalpino andrewdalpino self-assigned this Mar 14, 2021
@andrewdalpino
Copy link
Member

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

@andrewdalpino andrewdalpino added the help wanted Extra attention is needed label Mar 23, 2021
@mlocati
Copy link
Contributor

mlocati commented Apr 12, 2021

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

@cmb69
Copy link
Contributor

cmb69 commented Apr 12, 2021

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.

@andrewdalpino
Copy link
Member

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

@andrewdalpino andrewdalpino changed the title Compilation fails on Windows PECL Windows Build Fails (Missing Dependencies on Build Server) Apr 26, 2021
@Kabingeran
Copy link

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

@mlocati
Copy link
Contributor

mlocati commented Oct 26, 2021

@Kabingeran
Copy link

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

@mlocati
Copy link
Contributor

mlocati commented Oct 27, 2021

What's the error you are having?

@Kabingeran
Copy link

Kabingeran commented Oct 27, 2021

Thank you. The problems was solved by installing the dependencies

@mlocati
Copy link
Contributor

mlocati commented Oct 27, 2021

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

@P2T
Copy link
Author

P2T commented Oct 28, 2021

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 ?

@cmb69
Copy link
Contributor

cmb69 commented Oct 28, 2021

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.

@mlocati
Copy link
Contributor

mlocati commented Oct 28, 2021

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

@cmb69
Copy link
Contributor

cmb69 commented Nov 4, 2021

@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 added a commit to cmb69/Tensor that referenced this issue Nov 5, 2021
Without a respective lib, linking would inevitably fail.  We also add
a check for cblas.h, and if either is not found, disable ext/tensor
with a respective warning.

See also <RubixML#22>.
@cmb69
Copy link
Contributor

cmb69 commented Nov 5, 2021

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!

@P2T
Copy link
Author

P2T commented Nov 6, 2021

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

andrewdalpino pushed a commit that referenced this issue Dec 12, 2021
Without a respective lib, linking would inevitably fail.  We also add
a check for cblas.h, and if either is not found, disable ext/tensor
with a respective warning.

See also <#22>.
@cmb69
Copy link
Contributor

cmb69 commented Dec 12, 2021

Replying to #24 (comment) 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

Tensor/ext/config.m4

Lines 7 to 9 in ebef514

if ! test "x-lopenblas -llapacke -lgfortran" = "x"; then
PHP_EVAL_LIBLINE(-lopenblas -llapacke -lgfortran, TENSOR_SHARED_LIBADD)
fi

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.

@andrewdalpino
Copy link
Member

andrewdalpino commented Dec 12, 2021

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.

@ncavare
Copy link

ncavare commented May 23, 2022

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

@federicoemartinez
Copy link

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

@federicoemartinez
Copy link

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.

@takielias
Copy link

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

@federicoemartinez
Copy link

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.

@takielias
Copy link

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
Copy link

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

@takielias
Copy link

@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?

@federicoemartinez
Copy link

@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.

@takielias
Copy link

@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
Copy link

@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
Copy link

@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?

jb-lopez added a commit to jb-lopez/php-extensions-windows that referenced this issue Dec 25, 2022
In the investigation of the build failures I came across this issue. RubixML/Tensor#22

In that issue user federicoemartinez was able to get the build to work with this workflow file. https://github.com/federicoemartinez/Tensor/blob/master/.github/workflows/php7.4-windows

I'm testing that out as a possibility for building with PHP 8.2. If that succeeds then I will try more versions of PHP.
jb-lopez added a commit to jb-lopez/php-extensions-windows that referenced this issue Dec 25, 2022
In the investigation of the build failures I came across this issue. RubixML/Tensor#22

In that issue user federicoemartinez was able to get the build to work with this workflow file. https://github.com/federicoemartinez/Tensor/blob/master/.github/workflows/php7.4-windows

I'm testing that out as a possibility for building with PHP 8.2. If that succeeds then I will try more versions of PHP.
@jb-lopez
Copy link

Hey @takielias I'm not sure if you ever got it to build. It took me many tries and a few days, but I did get it to work.

https://github.com/jb-lopez/php-extensions-windows/releases/tag/Tensor

@takielias
Copy link

Hey @takielias I'm not sure if you ever got it to build. It took me many tries and a few days, but I did get it to work.

https://github.com/jb-lopez/php-extensions-windows/releases/tag/Tensor

@jb-lopez

That's a great help. Thanks a lot. Great contribution. I really appreciate your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

9 participants