Skip to content

Commit

Permalink
[build] Enforce compatibility with manylinux2014 when TI_WITH_VULKAN=…
Browse files Browse the repository at this point in the history
…OFF (#4406)

* [build] Enforce compatibility with manylinux2014 when TI_WITH_VULKAN=OFF

* Auto Format

Co-authored-by: Taichi Gardener <[email protected]>
  • Loading branch information
strongoier and taichi-gardener committed Feb 28, 2022
1 parent 01917b1 commit 8373b83
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 18 deletions.
7 changes: 6 additions & 1 deletion cmake/TaichiCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,12 @@ if (NOT WIN32)
target_link_libraries(${CORE_LIBRARY_NAME} -Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/misc/linker.map)
endif ()
# Avoid glibc dependencies
target_link_libraries(${CORE_LIBRARY_NAME} -Wl,--wrap=log2f)
if (TI_WITH_VULKAN)
target_link_libraries(${CORE_LIBRARY_NAME} -Wl,--wrap=log2f)
else()
# Enforce compatibility with manylinux2014
target_link_libraries(${CORE_LIBRARY_NAME} -Wl,--wrap=log2f -Wl,--wrap=exp2 -Wl,--wrap=log2 -Wl,--wrap=logf -Wl,--wrap=powf -Wl,--wrap=exp -Wl,--wrap=log -Wl,--wrap=pow)
endif()
endif()
else()
# windows
Expand Down
46 changes: 29 additions & 17 deletions taichi/common/symbol_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,35 @@ float __wrap_log2f(float x) {
return log2f(x);
}
// The following are offending symbols using higher GLIBC versions
// TODO currently commented out due to failing Vulkan tests
//__asm__(".symver log2,log2@GLIBC_2.2.5");
// float __wrap_log2(float x) {
// return log2(x);
//}
//__asm__(".symver exp,exp@GLIBC_2.2.5");
// float __wrap_exp(float x) {
// return exp(x);
//}
//__asm__(".symver log,log@GLIBC_2.2.5");
// float __wrap_log(float x) {
// return log(x);
//}
//__asm__(".symver pow,pow@GLIBC_2.2.5");
// float __wrap_pow(float x, float y) {
// return pow(x, y);
//}
// They will fail Vulkan tests if wrapping is enabled
__asm__(".symver exp2,exp2@GLIBC_2.2.5");
float __wrap_exp2(float x) {
return exp2(x);
}
__asm__(".symver log2,log2@GLIBC_2.2.5");
float __wrap_log2(float x) {
return log2(x);
}
__asm__(".symver logf,logf@GLIBC_2.2.5");
float __wrap_logf(float x) {
return logf(x);
}
__asm__(".symver powf,powf@GLIBC_2.2.5");
float __wrap_powf(float x, float y) {
return powf(x, y);
}
__asm__(".symver exp,exp@GLIBC_2.2.5");
float __wrap_exp(float x) {
return exp(x);
}
__asm__(".symver log,log@GLIBC_2.2.5");
float __wrap_log(float x) {
return log(x);
}
__asm__(".symver pow,pow@GLIBC_2.2.5");
float __wrap_pow(float x, float y) {
return pow(x, y);
}
#endif
}

Expand Down

0 comments on commit 8373b83

Please sign in to comment.