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
CMake and Makefiles build broken on Windows #249
Comments
It also means we need to restore the cmake/modules directory as currently CMake on Windows is a big mess from a deps point of view. Installing system wide builds files is an absolute no-go, especially when it comes to create clean and custom builds. I have to check if we can have it used only for windows and keep using system ones for other platforms, if that helps. |
+1 |
I think before we seriously consider supporting the Windows builds, we need to get the appveyor CI stuff working. I spent a little time on it, but I've never used it before, and it's been years since I built under Windows (majority of my work has been with mingw). along those lines, should we look at adding mingw to Travis? or would it not be that useful as we expect the majority of people to build under Windows using an MS toolchain? |
We do. And we used to run tests but things went off on my side after latest 2.1. But we do support windows.
All for it, back then it was not available/free to use for oss. So i am all for using it.
I think we can, it used to work.
Both actually :) |
To be more precised, for windows, the priorities are:
For both nnake and cmake I do want to keep supporting php pre built deps.as they are widely tested and supported. |
It's been years, so I'm not sure what changes you're talking about. There were a couple scenarios we (Imazen) were facing:
So having control over which git revision of every dependency turned out to be helpful. Thumbs.sh provided this, albeit in a less than perfect manner. I now use Conan.io instead of thumbs.sh for all of my projects, and can't reccomend it enough. It doesn't care about your build system; it just ensures all the dependencies are compiled and made available for your build target, whether you use makefiles, autotools, CMake, etc. Very convenient, especially for CI, where you may want to test using, say, a different libpng than is shipped with Travis default. Ofc, docker could also be used, if you're willing to maintain the container image. It's also slightly easier to test against multiple versions of dependencies that way. And, if your deps are already on Conan.io, the investment is minimal. Since Conan.io coexists with CMakeLists.txt and your makefile, there's no need to use it unless you want to control/fetch dependencies instead of using the system set. |
The main points are:
I will take a look (on my list) to conan.io. i was thinking about chocolaterey but the way it installs package is a bit aweful when it comes to dev files :) |
i'm not saying Windows isn't supported. i'm saying before we embark on trying to get things building/working again, we get the CI running for these. otherwise we'll spend time fixing things now only to have them break again and not notice. doing configure+mingw by itself isn't a problem. it's more how do we get the mingw toolchain in the Travis Ubuntu environment. i suspect it's not hard. |
what about CMake ExternalProject to get dependencies before building libgd? |
@vapier ah ok :) And yes, totally agree. CMake seems to need more love in the custom Find*, also some updates in them to support 3.x better. In the meantime, I went for the easiest way, updated the makefile.vc, at least it builds now with most features. Tests suite will follow. @rashadkm could be useful. I am not sure it is worth the extra work to maintain that. Given how easy it is to grab the deps, unzip in ..\deps, builds :) |
@pierrejoye , agreed that it won't be as easy compared to just downloading dependencies into deps. |
I started to port gdtest. Only missing is the temporary directory. I may simply go for the system temp directory for the time being. Alternatively I can port what I did in php for mkdtemp but :) |
Initial ports of @vapier helpers functions as well as fixing some tests to use these helpers are done now. I hope I did not break more than I fixed, but windows tests suite using makefile is back on track: library source: src
|
Test now generated dynamically. One note, please avoid using test wrapped in .sh but use C directly to deal with many files. Using very nice @vapier new API, it is very straightforward. |
I've just managed to have a look at building on Windows, and with VS 2015 x64 the instructions in windows/Makefile.vc worked fine for building the lib, but not building the tests. gd_test.c fails:
Any hints? If I get the Windows build working properly, I would improve the documentation (windows/Makefile.vc could clarify where to put the deps, where the default build dir is, and windows/readme.md needs an update, anyway). |
Ah I dod not notice it was not generated anynore. You can take src/config.h.cmake as a base. I will try to add the config.h generation to the makefile over the weekend. |
Thanks (could have thought of this myself as well). After additionally adding Anyhow, I've noticed a skipped test with message |
one step forward, two steps back ? or two steps forward ? :) |
:) |
I'm still not able to build the tests, because config.h doesn't get generated. After manually creating it, the tests build, but still all tests are failing, because libgd.dll isn't found. I don't know how to solve the former (short of creating a fixed config.h), but the latter might already be sufficiently solved by adding |
Either that or copy it over. It should be there already if i am not mistaken |
Ah, it is but not seems not to be called anymore.
I have to check why. |
@cmb69 The DLL issue should work now. I just tested with clean checkout and no existing gdbuild directory (or if you choose another one). |
Yes, thanks! |
config.h generations work too, basics one. Todos: add options to makefile to enable/disable features (png, webp etc) then we are good again. |
What do we do with regard to libtiff, which is not available on http://windows.php.net/downloads/php-sdk/deps/? Makefile.vc doesn't define |
all the checked in files should be in sync. so if we have a committed config header that disables tiff, then the gentest.bat script should skip them too. |
Actually, for Windows config.h is generated by the Makefile, but there's no way to enable TIFF, so I've disabled tests/tiff/ as well. |
There is no easy way to customize the building for Windows or mingw32? I dont want to add freetype2 and fontconfig, avif, heif, and some others PS: Why following windows tutorial the resulted include files was .objs and not .h? I was able to build this with vcpkg editing their portfile.cmake:
It worked fine but they use v2.2.5 |
I just did on VC with cmake and it seems to work fine to customize all
options.
The makefile I did it mainly for devs, when cmake made debugging a pain,
not too hard to customize it for your own need.
…On Fri, Jul 30, 2021, 2:38 AM Renato La Laina ***@***.***> wrote:
There is no easy way to customize the built for Windows or mingw32?
I dont want to add freetype2 and fontconfig, avif, heif, and some others
Im trying to build a minimal libgd to use as dependency for windows
nginx(it will only resize images)
PS: Why following windows tutorial my include files was .objs and not .h?
https://github.com/libgd/libgd/blob/master/windows/readme.md
I need the headers files to use for nginx
I was able to build this with vcpkg editing their portfile.cmake:
https://github.com/microsoft/vcpkg/tree/master/ports/libgd
this lines
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS -DENABLE_PNG=${ENABLE_PNG}
-DENABLE_JPEG=${ENABLE_JPEG}
-DENABLE_WEBP=${ENABLE_WEBP}
-DBUILD_STATIC_LIBS=${LIBGD_STATIC_LIBS}
)
It worked fine but they use v2.2.5
PS: Windows Makefile.vc file has some duplicated lines:
[image: image]
<https://user-images.githubusercontent.com/38674705/127554717-a5005a23-4726-4840-9edd-b8a91a3a73c1.png>
[image: image]
<https://user-images.githubusercontent.com/38674705/127554749-b3f98da6-3ada-4479-b9af-bd1f906b5a81.png>
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#249 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACE6KAFPWW4XDSFR6RU4Y3T2GU3RANCNFSM4CJCILKA>
.
|
@Christoph Becker ***@***.***>
what do you mean by "there is no way to enable it"?
…On Fri, Jan 20, 2017, 6:16 AM Christoph M. Becker ***@***.***> wrote:
so if we have a committed config header that disables tiff, […]
Actually, for Windows config.h is generated by the Makefile
<https://github.com/libgd/libgd/blob/gd-2.2.4/windows/Makefile.vc#L163-L192>,
but there's no way to enable TIFF, so I've disabled tests/tiff/
<971d1ff> as well.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#249 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AARPKEOtDrjjEtT4IwnsR-RgtVtlNrgcks5rT-7pgaJpZM4JIkLU>
.
|
I think that has been resolved in the meantime. :) |
can we just delete all Windows related files and tell people to use cmake ? we're supporting way too many build methods. |
Hi @vapier Yes, I will do it in Head this week. At the same time, I will update the windows/VC build doc to use vcpkg for all deps. It makes the whole thing a breath. Step 2 I will create a libgd registry so one can simply use vcpkg to add libgd to their project. I will also stop relying on PHP's windows builds, only libxpm and maybe the latest codecs are not in vcpkg, I will add them via our registry. |
Also please note that vcpkg works on Linux and MacOs as well. As it is less needed on linux, I think it can help a lot too on MacOS. Let see. |
CMake works smoothly now on Windows. Github Actions Windows is enabled. As of the Makefile, let drop them. They are handy but time consuming to maintain. |
@nathanaeljones any appealing reason to have changed the Makefile for something we do not actually control? I would rather stick to the struture we had for cmake and PHP, using binaries/prebuilt deps that are validated and widely used. Any comment to do something different welcome :)
CMake as of now is also broken,
Using a simple command like:
cmake -G "Visual Studio 14 2015" -DBUILD_TEST=1 -DENABLE_PNG=1 -DENABLE_JPEG=1 -DENABLE_FREETYPE=1 -DENABLE_WEBP=1 -DCMAKE_LIBRARY_PATH=c:\php-sdk\master\vc14\x64\deps\lib -DCMAKE_INCLUDE_PATH=c:\php-sdk\master\vc14\x64\deps\include
Which simply requires to copy the deps llibs in ..\deps generates a clean build using all libraries we support. Deps prebuilt can be fetched here:
http://windows.php.net/downloads/php-sdk/
or can be built easily using:
https://github.com/winlibs
This is something I am not keen to change to some other structure or pre built binaries.
Thoughts and comments more than welcome.
The text was updated successfully, but these errors were encountered: