-
Notifications
You must be signed in to change notification settings - Fork 7k
[libjxl] Remove libm dependency when building with MSVC #46177
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
Conversation
Is it possible to add a test for this? |
@microsoft-github-policy-service agree |
The build failures appear legitimate. Perhaps the |
5dccc42
to
5480647
Compare
5480647
to
43e8f0e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix!
-else() | ||
- set(JPEGXL_REQUIRES_TYPE "Requires") | ||
- set(JPEGXL_PUBLIC_LIBS "-lm ${PKGCONFIG_CXX_LIB}") | ||
+# MSVCRT bundles math functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you submit this patch to https://github.com/libjxl/libjxl/pulls ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the change is incorrect: JPEGXL_REQUIRES_TYPE should be set regardless of MSVC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the change is incorrect: JPEGXL_REQUIRES_TYPE should be set regardless of MSVC.
Sigh; you're right and I missed this :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, this also needs to patch up lib/jxl_cms.cmake and lib/threads/libjxl_threads.pc.in, or otherwise the linking against libm sneaks in via those routes. |
This patches MSVC builds to not link with
libm
. Otherwise, whenNOT BUILD_SHARED_LIBS
is true, targets that depend on the libjxl target try to link withm.lib
.The following was the previous workaround I had to do before this fix:
./vcpkg x-add-version --all
and committing the result.