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

Fix LLVM find package picking up system-wide libraries #1866

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

sergeyvfx
Copy link
Contributor

Description

This change fixes LLVM find package ignoring the library path provided by LLVM_CONFIG and picking up a system-wide library instead.

This happens when a custom LLVM is compiled statically, and there is a system-wide LLVM of the version which OSL expects.

The solution is to pass NO_DEFAULT_PATH to the find_library so that the function only considers paths explicitly coming from the LLVM's configuration executable.

It is a bit unclear what is the expected behavior of this module when LLVM_CONFIG is not available. It is possible to limit possible side effects of this change by only ignoring default paths if the LLVM CONFIG executable is found.

In practice this issue happened in Blender's build environment where HIP is used for OpenImageDenoiser: HIP toolchain pulls in LLVM system wide. While it is not an issue on itself (as it is only a compile time dependency for HIP support in OIDN) in conflicts with the logic in the OSL's find_package(LLVM).

Tests

The change has been tested in the build environment which is used for official Blender libraries builds. For the details of this environment one might read its documentation.

Running the official testsuite produces a fair amount of failures before this change. Could be due to the side effects of how that specific VM is setup, didn't have time yet to dig into exact details.

Checklist:

  • I have read the contribution guidelines.
  • I have updated the documentation, if applicable.
  • I have ensured that the change is tested somewhere in the testsuite (adding new test cases if necessary).
  • My code follows the prevailing code style of this project. If I haven't
    already run clang-format v17 before submitting, I definitely will look at
    the CI test that runs clang-format and fix anything that it highlights as
    being nonconforming.

Copy link

linux-foundation-easycla bot commented Sep 16, 2024

CLA Signed


The committers listed above are authorized under a signed CLA.

@lgritz
Copy link
Collaborator

lgritz commented Sep 16, 2024

LGTM, thanks! We will need the commit DCO-signed and a CLA on file before we can merge.

This change fixes LLVM find package ignoring the library path provided
by LLVM_CONFIG and picking up a system-wide library instead.

This happens when a custom LLVM is compiled statically, and there is a
system-wide LLVM of the version which OSL expects.

The solution is to pass NO_DEFAULT_PATH to the find_library so that
the function only considers paths explicitly coming from the LLVM's
configuration executable.

It is a bit unclear what is the expected behavior of this module when
LLVM_CONFIG is not available. It is possible to limit possible side
effects of this change by only ignoring default paths if the LLVM
CONFIG executable is found.

In practice this issue happened in Blender's build environment where
HIP is used for OpenImageDenoiser: HIP toolchain pulls in LLVM system
wide. While it is not an issue on itself (as it is only a compile time
dependency for HIP support in OIDN) in conflicts with the logic in the
OSL's find_package(LLVM).

Signed-off-by: Sergey Sharybin <[email protected]>
Copy link
Collaborator

@lgritz lgritz left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@lgritz lgritz merged commit 2fd6b38 into AcademySoftwareFoundation:main Sep 16, 2024
22 checks passed
lgritz pushed a commit to lgritz/OpenShadingLanguage that referenced this pull request Sep 24, 2024
…ySoftwareFoundation#1866)

This change fixes LLVM find package ignoring the library path provided
by LLVM_CONFIG and picking up a system-wide library instead.

This happens when a custom LLVM is compiled statically, and there is a
system-wide LLVM of the version which OSL expects.

The solution is to pass NO_DEFAULT_PATH to the find_library so that
the function only considers paths explicitly coming from the LLVM's
configuration executable.

It is a bit unclear what is the expected behavior of this module when
LLVM_CONFIG is not available. It is possible to limit possible side
effects of this change by only ignoring default paths if the LLVM
CONFIG executable is found.

In practice this issue happened in Blender's build environment where
HIP is used for OpenImageDenoiser: HIP toolchain pulls in LLVM system
wide. While it is not an issue on itself (as it is only a compile time
dependency for HIP support in OIDN) in conflicts with the logic in the
OSL's find_package(LLVM).

Signed-off-by: Sergey Sharybin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants