Skip to content

use patch to fix finding libraries when linking ImageMagick#21640

Merged
akesandgren merged 5 commits intoeasybuilders:developfrom
Flamefire:20241014145036_new_pr_ImageMagick6948
Jun 11, 2025
Merged

use patch to fix finding libraries when linking ImageMagick#21640
akesandgren merged 5 commits intoeasybuilders:developfrom
Flamefire:20241014145036_new_pr_ImageMagick6948

Conversation

@Flamefire
Copy link
Copy Markdown
Contributor

(created using eb --new-pr)

@Flamefire
Copy link
Copy Markdown
Contributor Author

Test report by @Flamefire
SUCCESS
Build succeeded for 5 out of 5 (5 easyconfigs in total)
n1604 - Linux RHEL 8.9 (Ootpa), x86_64, Intel(R) Xeon(R) Platinum 8470 (icelake), Python 3.8.17
See https://gist.github.com/Flamefire/b80a57757b21f0b21a8b13e53b803e0f for a full test report.

@Flamefire
Copy link
Copy Markdown
Contributor Author

Test report by @Flamefire
SUCCESS
Build succeeded for 5 out of 5 (5 easyconfigs in total)
i7016 - Linux Rocky Linux 8.9 (Green Obsidian), x86_64, AMD EPYC 7702 64-Core Processor (zen2), Python 3.8.17
See https://gist.github.com/Flamefire/682d3d7a391520cfd4beab5a6f6c2ed7 for a full test report.

@Flamefire
Copy link
Copy Markdown
Contributor Author

Test report by @Flamefire
SUCCESS
Build succeeded for 5 out of 5 (5 easyconfigs in total)
i7002 - Linux Rocky Linux 8.9 (Green Obsidian), x86_64, AMD EPYC 7702 64-Core Processor (zen2), Python 3.8.17
See https://gist.github.com/Flamefire/c5133cffecd99c263f740c115dec53d2 for a full test report.

@Flamefire
Copy link
Copy Markdown
Contributor Author

Test report by @Flamefire
SUCCESS
Build succeeded for 5 out of 5 (5 easyconfigs in total)
n1543 - Linux RHEL 8.9 (Ootpa), x86_64, Intel(R) Xeon(R) Platinum 8470 (icelake), Python 3.8.17
See https://gist.github.com/Flamefire/2ad05a5753869ac889caee4d55f25569 for a full test report.

@akesandgren
Copy link
Copy Markdown
Contributor

Test report by @akesandgren
SUCCESS
Build succeeded for 5 out of 5 (5 easyconfigs in total)
b-cn1611.hpc2n.umu.se - Linux Ubuntu 22.04, x86_64, AMD EPYC 7313 16-Core Processor, 1 x NVIDIA NVIDIA A100 80GB PCIe, 555.58.02, Python 3.10.12
See https://gist.github.com/akesandgren/64e0035d0dae1f87bf5ad171d0e0da43 for a full test report.

@akesandgren
Copy link
Copy Markdown
Contributor

This can also be solved by explicitly adding libheif as a dependency (which it really should be anyway since it is directly used, see configure step)
At least it solves the failing linking for me.

Only tested with ImageMagick-7.1.1-15-GCCcore-12.3.0.eb though

@Flamefire
Copy link
Copy Markdown
Contributor Author

Flamefire commented Jun 11, 2025

@akesandgren Can you post the relevant part of the configure step for reference please? I'm also not sure if libheif changes anything for this issue, it seems unrelated. But if it is used we should either add it (we don't yet, do we? So where does it come from or is it optional?) independent of this.

IIRC the issue is not (only?) building ImageMagick but e.g. linking it to HarfBuzz. Did you test that with the libheif dependency instead of this patch?

@akesandgren
Copy link
Copy Markdown
Contributor

akesandgren commented Jun 11, 2025

This is from 7.1.1-15:

checking if Ghostscript package is complete... yes, using library.
-------------------------------------------------------------
checking for libgvc >= 2.9.0... no

-------------------------------------------------------------
checking for MagickCache >= 0.9.3... no

-------------------------------------------------------------
checking for libheif >= 1.4.0... yes

It's being brought in by JasPer, and the problem I'm seeing without this patch and without it listed explicitly is:

/hpc2n/eb/software/binutils/2.40-GCCcore-12.3.0/bin/ld: cannot find -lheif: No such file or directory

With an explicit libheif in dependencies everything works.

@Flamefire
Copy link
Copy Markdown
Contributor Author

With an explicit libheif in dependencies everything works.

How is that possible? IIRC there is no difference by LMod or EasyBuild whether a module is a direct or indirect dependency, unless of course it is only a build-dep of a dependency which here it isn't. And it seemingly hasn't been an issue before/for others, has it?
I feel like there is an underlying, potentially bigger issue here.

Could you compare the environments for the 2 cases?

@akesandgren
Copy link
Copy Markdown
Contributor

The difference is that without libheif being explicit there is no -L/..../libheif/version/lib in LDFLAGS
but with it explicit there is.
This is according to the output from configure at the end.

@Flamefire
Copy link
Copy Markdown
Contributor Author

The difference is that without libheif being explicit there is no -L/..../libheif/version/lib in LDFLAGS but with it explicit there is. This is according to the output from configure at the end.

That explains why it works (LIBRARYPATH gets cleaned by ImageMagick without the patch).

And we set LDFLAGS in framework: https://github.com/easybuilders/easybuild-framework/blob/87b3d9d959b5f3ec739f3db4a350982b531c58fb/easybuild/tools/toolchain/toolchain.py#L1157 so that is the difference.

Copy link
Copy Markdown
Contributor

@akesandgren akesandgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@akesandgren akesandgren added this to the next release (5.1.1?) milestone Jun 11, 2025
@akesandgren
Copy link
Copy Markdown
Contributor

Going in, thanks @Flamefire!

@akesandgren akesandgren merged commit e6973e1 into easybuilders:develop Jun 11, 2025
8 checks passed
@Flamefire
Copy link
Copy Markdown
Contributor Author

This is from 7.1.1-15:

-------------------------------------------------------------
checking for libheif >= 1.4.0... yes

It's being brought in by JasPer, and the problem I'm seeing without this patch and without it listed explicitly is:

/hpc2n/eb/software/binutils/2.40-GCCcore-12.3.0/bin/ld: cannot find -lheif: No such file or directory

With an explicit libheif in dependencies everything works.

libheif is a new addition to JasPer. So this wasn't an issue before.

Harfbuzz should would be an issue though without this patch: In GCC/13.3 toolchains we use MesonNinja for HarfBuzz so without it being an explicit dependency for ImageMagick it would fail in the same way as libheif.
So this patch makes it more reliable in any case.

@Flamefire Flamefire deleted the 20241014145036_new_pr_ImageMagick6948 branch June 11, 2025 13:22
@boegel boegel changed the title Fix finding libraries when linking ImageMagick use patch to fix finding libraries when linking ImageMagick Jul 5, 2025
@boegel boegel added bug fix and removed change labels Jul 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants