microsoft / php-sdk-binary-tools

Tool kit for building PHP under Windows
BSD 2-Clause "Simplified" License
270 stars 79 forks source link

Compiling php 64 bits PGO enabled #50

Closed ghost closed 5 years ago

ghost commented 5 years ago

How to make builds with pgo enabled for x64? I've compiled php7.3.1 x86 TS with success with pgo enabled, but for x64 builds do'nt have luck! Have 3 errors: libssl1_1-x64.dll, libcrypto1_1-x64.dll and image below: screenshot_24

How to proceed?

weltling commented 5 years ago

Please post the configure options and the SDK version you use. In general, it might be that some thing is messed in the build environment. All the scripts are in PHP, so you can debug them.

Thanks.

ghost commented 5 years ago

This is my configure options for TS builds. For NTS, change --enable-apache2-4handler with --disabe-zts! configure --with-mp=15 --disable-embed --enable-apache2-4handler --disable-phpdbgs --disable-phpdbg --disable-debug --disable-debug-pack --disable-phpdbg-webhelper --disable-crt-debug --disable-security-flags --disable-snapshot-build --without-enchant --without-imap --without-snmp --without-xmlrpc --without-xsl --without-gmp --without-wddx --without-libwebp --without-interbase --without-ldap --without-oci8 --without-pgsql --without-uncritical-warn-choke --enable-sockets --enable-mbstring --enable-exif --enable-pdo --enable-opcache --enable-soap --enable-fileinfo --enable-com-dotnet --enable-fd-setsize=2048 --enable-sanitizer --enable-intl --enable-phar-native-ssl --without-analyzer --with-config-file-scan-dir="C:\php\conf" --with-curl --with-openssl=static --with-mysqli --with-pdo-mysql --with-bz2 --with-sqlite3 --with-pdo-sqlite --with-extra-includes="C:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\Include\um";"C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um" --with-extra-libs="C:\Program Files (x86)\Windows Kits\NETFXSDK\4.7.2\Lib\um%PHP_SDK_ARCH%";"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um%PHP_SDK_ARCH%" --enable-native-intrinsics=sse,sse2,sse3,ssse3,sse4.1,sse4.2 --enable-apcu --enable-pgi --enable-cli

SDK is 2.1.11-dev and PHP is 7.3.1

Makefile make some changes: On CFLAGS, add: /GL /GS- /Oy- On LDFLAGS, add: /LTCG /NODEFAULTLIB:libcmt.lib /OPT:ICF

weltling commented 5 years ago

Hmm, that's quite customized options. I suspect there's some issue with the resulting binary. Does the resulting binary run, when you call it on console? Like x64\release\php.exe -v. Probably it would first make sense to check what happens with a very simple build without customizations and a lot of extensions.

I'll be able to try building with your options later this week. But you could indeed check what happens at https://github.com/Microsoft/php-sdk-binary-tools/blob/master/lib/php/libsdk/SDK/Build/PGO/Abstracts/PHP.php#L114, as seems either it doesn't find php.exe, or `php.exe fails, or it delivers some version string that SDK can't parse. Maybe one can then improve the error message.

Thanks.

ghost commented 5 years ago

i'll try without changes in Makefile ! nmake don't generate the dll need for pgo training

weltling commented 5 years ago

Which DLL do you mean?

Thanks.

ghost commented 5 years ago

For phpsdk_pgo --init and --train

This 3 dlls must be in directory Release/Release_TS, but nmake don't compile then. Only nmake snap compile dll's and make directory php with final build for use!

libcrypto-1_1.dll nghttp2.dll libssl-1_1.dll

Em ter, 15 de jan de 2019 às 15:36, Anatol Belski notifications@github.com escreveu:

Which DLL do you mean?

Thanks.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Microsoft/php-sdk-binary-tools/issues/50#issuecomment-454481380, or mute the thread https://github.com/notifications/unsubscribe-auth/AIq1-ybdrKQPLo6O2tCbEbHh-aKL-RYQks5vDhGZgaJpZM4Z9i52 .

ghost commented 5 years ago

For phpsdk_pgo --init/train:

Noticed that this 3 dlls must be in directory Release/Release_TS for x86/x64, but nmake don't compile then. Only nmake snap compile dll's and make directory php with final build for use!!! This is the DLL's:

libcrypto-1_1.dll nghttp2.dll libssl-1_1.dll

Make normal compilation with no --enable-pgi and nmake snap, copy/paste DLL's for directory Release; after this nmake clean && buildconf --force && configure options with --enable-pgi!

Hope it works out that way.

weltling commented 5 years ago

None of those need to be in the release dir. They're made available automatically on the PATH from the deps\bin if name run is used. Otherwise that dir needs to be put on the path manually. The phpsdk_pgo command should puts any dependencies on the path, too. If the produced php.exe binary doesn't run, there has to be another reason.

Also, none of the dependency DLLs are relevant for PGO.

Where you able to figure out, why exactly that exception in the SDK is thrown?

Thanks.

weltling commented 5 years ago

Ups, nmake run should it be :) In general, the commands that used like nmake test and others like phpsdk_* do put any dependencies on the path, so that should not be an issue.

Thanks.

ghost commented 5 years ago

Otherwise that dir needs to be put on the path manually: i've added deps/bin x86/x64 in path! lets'go see the results!

weltling commented 5 years ago

That is only needed, if you run some compiled files on your own, not through the commands.

Thanks.

ghost commented 5 years ago

OK Thanks for help!!

ghost commented 5 years ago

I'll close the issue! Thansk for help and assistance! Now, working after add deps/bin to path; sucess on compilation for x86/x64 builds TS and NTS versions of php

NTS x64 build with pgo make with success!! screenshot_40

weltling commented 5 years ago

Many thanks for the checks! Regarding the training failures as from the screenshot, you could investigate by starting the environment manually with phpsdk_pgo --up and inspecting what is wrong. If you're intended to add custom scenarios, you might even want to deactivate the bundled training cases.

Thanks.

ghost commented 5 years ago

don't intented to add custom scenarios! only default scenarios is good for me

ghost commented 5 years ago

many thanks for your help!

weltling commented 5 years ago

You're welcome. Any reason you reopen the issue?

Thanks.

ghost commented 5 years ago

nothing!!