-
Notifications
You must be signed in to change notification settings - Fork 49
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
Build Image::Magick from MSYS2 using Strawberry Perl gcc and perl #139
Comments
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
It would seem the perl path is only needed to compile the perl bindings at the same time as the main ImageMagick system. Compiling the bindings separately might be a simpler approach. From https://imagemagick.org/script/advanced-linux-installation.php (with added linebreaks for readability):
|
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
@sisyphus It did not work for me on Linux, added bug report here: ImageMagick/ImageMagick#6763 |
This comment was marked as outdated.
This comment was marked as outdated.
@sisyphus Interesting. I also found this site for building ImageMagick using Visual Studio on Windows: https://github.com/ImageMagick/ImageMagick-Windows It could be interesting to test, but not sure if it will help with building the Perl module |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Added a discussion for how to pass the updated PATH to the libtool shell here: |
This comment was marked as outdated.
This comment was marked as outdated.
Turned out to be fairly simple. Here's the procedure I followed from start to finish. In MSYS2's (or Cygwin's) bash shell, clone the current github ImageMagick into D:\s\ImageMagick: $ git clone https://github.com/ImageMagick/ImageMagick /cygdrive/d/s/ImageMagick3 In MSYS2 shell, build this source using the same compiler that StrawberryPerl uses. In C:\sp_64\sp-5.38.0-PDL\c\lib, create a copy of the newly installed Then, open up a new cmd.exe shell running StrawberryPerl. Because I've built in the MSYS shell, there are some dlls in D:\msys64\mingw64\bin that need to be found for the Image-Magick-7.1.1 (perl module) build to succeed. To make sure this perl build I'm about to do doesn't reference any ImageMagick dlls in D:\msys64\mingw64\bin (placed there earlier by pacman), I rename the extension of those 3 dlls from ".dll" to ".dll_hide". The following patch to C://sp/_64/sp-5.38.0-PDL/c/include/ImageMagick-7/MagickCore/magick-config.h provides a fairly simple hack that enables the perl module to build.
Then run Cheers, |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
@sisyphus It would be interesting to know more details on why this hack is needed.. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Added possible fix here: ImageMagick/ImageMagick#6770 |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Refer to: #139 (comment) :
@sisyphus Maybe we should investigate this more? It would be better if we could use the one that ships with StrawberryPerl, right? |
It would be good to know which libraries aren't working. It could be clashes where SP provides DLLs that are also provided by Winlibs, e.g. there is libbz.dll (Winlibs) and libbz2-1__.dll (SP). Previous discussion starts here: #57 (comment) |
This comment was marked as outdated.
This comment was marked as outdated.
@shawnlaffan, I re-tried building with StrawberryPerl's compiler and struck no significant issues this time. (Dunno what happened last time, when it all went to shit.) So ... for the msys2 build of ImageMagick, I appended my Strawberry c/bin to the PATH, set CPPFLAGS to the location of Strawberry c/include, set LDFLAGS to the location of Strawberry c/lib and set --prefix to the location of Strawberry c folder. However, I think the build used the stuff in the MSYS2 installation - and probably no stuff (except for the compiler) from Strawberry Perl. When building Image-Magick-7.1.1 (which is done in the cmd.exe shell that my portableshell.bat opens up), I had to append D:\msys64\mingw32\bin to the PATH to get 'gmake test' to succeed. There's at least 50 dlls from my MSYS2 installation that are needed at Inage-Magick-7.1.1 runtime. (I got sick of trying to track them all down.) Cheers, |
This thread has now become so long that I think it will be difficult to follow it in the future. Would it be an idea to create separate documentation for how to install Perl XS modules under Strawberry Perl? For example a main document "Installing-XS-modules.md" with links to sub documents for specific modules, like "Image-Magick.md" ? Then we could condense (make more readable) the findings that we have done in this thread (#139) into that documentation file (the steps needed to install the module) for the future. What do you think @shawnlaffan and @sisyphus ? |
This comment was marked as outdated.
This comment was marked as outdated.
@hakonhagland Start using the Wiki to make said .md and once ironed out sufficiently there, we can either put it in the main repo or just link to it. |
Refer to #139 (comment)
@sisyphus We should investigate this further, we do not want any dependencies back to msys2 after the perl module has been installed, right? Then, for example if you later choose to delete MSYS2 from your machine the perl module will stop to work. |
The list of DLL dependencies can be obtained using App::PP::AutoLink. Use that to pack a perl file that uses Image::Magick. The list of detected DLLs is printed to the console and can then be edited to copy the needed files to a new location. I should really extract the DLL search logic into something cleaner but it will work well enough if it's a one-off process. I've already used it to package the Gtk2 files as an Alien module (there are also PPMs for 5.38 if anyone is interested - look under the releases). https://github.com/shawnlaffan/perl-alien-gtkstack-windows/ |
Personally, that doesn't bother me too much. Is the solution just proposed by @shawnlaffan acceptable ? You could look at building against the standalone MSVC ImageMagick library that ImageMagick-7.1.1-19-Q16-HDRI-x64-dll.exe installs.
----------------------------------------------
Welcome to Strawberry Perl Portable Edition!
* URL - http://www.strawberryperl.com/
* see README.TXT for more info
----------------------------------------------
Perl executable: C:\sp\_64\sp-5.38.0\perl\bin\perl.exe
Perl version : 5.38.0 / MSWin32-x64-multi-thread
Of course, you still need ImageMagick-7.1.1-Q16-HDRI in Strawberry Perl's PATH. I now don't know where I got this ImageMagick-7.1.1-19-Q16-HDRI-x64-dll.exe from. You need to tell the installer (when prompted) to install the extra (essential) stuff, and remember that magick-baseconfig.h needs that simple fix mentioned earlier in this post. Cheers, |
The advantage of the Alien approach is that it saves the files under The limitation is that each calling script needs a |
@shawnlaffan Does this mean that the needed libraries can be packed together with the Alien? So there will be no need to install Image::Magick from source (or download the binary release) before installing the perl module? That would be great! A quick search on metacpan shows that a alien module already exists: https://metacpan.org/pod/Alien::ImageMagick |
Referring to #139 (comment) and #139 (comment) :
Going back to my initial attempt at building, it would be interesting to know more about this linker error so I created a separate issue for this here: ImageMagick/ImageMagick#6777 |
Yes, that is the general principle. For the Gtk2 case all the relevant files from the bin, lib and share dirs have been packed.
Alien::ImageMagick uses an older style approach that also does not work on Windows since it uses Unix syntax. It should be possible to update it to use Alien::Build but there would still be the need to get all the dependencies in place. That is perhaps best done using a second Alien, or it could be done as a build step on Windows. |
@shawnlaffan Created a new issue to track this idea, see #142 |
I think this is closable now? As with #140 (comment), Image::Magick is not distributed with Strawberry Perl, and seems there is now a process for downstream users to build it from source. |
Refer to #138 for background. I would like to try to build Image::Magick with Strawberry Perl. On Linux I can build the module using:
In #138 ït was suggested to use MSYS2, quote from @sysiphus:
Also @sysiphus reported later in that issue:
@sisyphus As a first step, I tried to reproduce the error you got. However, I got a different error:
Here are the complete log files from configure and make: configure_log.txt and make_log.txt.
The text was updated successfully, but these errors were encountered: