Skip to content

Commit

Permalink
Try to address #1761 -- failures of makeotfexe in the manylinux wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
skef committed Nov 15, 2024
1 parent 0b58858 commit 7b1212b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
# CIBW_BEFORE_ALL_LINUX: "yum install -y libuuid-devel"
# CIBW_BEFORE_ALL_LINUX: "dnf -y install uuid-devel"
CIBW_ENVIRONMENT_MACOS: "CFLAGS='-I/usr/include/libxml2' MACOSX_DEPLOYMENT_TARGET='10.13'"
CIBW_ENVIRONMENT_LINUX: "FORCE_BUILD_LIBXML2=ON"
CIBW_ENVIRONMENT_LINUX: "FORCE_BUILD_LIBXML2=ON PTHREAD_STATIC_WORKAROUND=1"
CIBW_ENVIRONMENT_WINDOWS: "FORCE_BUILD_LIBXML2=ON"

- name: Build sdist (Ubuntu only)
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ set(ANTLR4_WITH_STATIC_CRT OFF)
set(ANTLR4_TAG tags/4.13.2)
include(ExternalAntlr4Cpp)

if (DEFINED ENV{PTHREAD_STATIC_WORKAROUND})
set(PTHREAD_STATIC_WORKAROUND TRUE)
endif()

if (DEFINED ENV{FORCE_BUILD_LIBXML2})
set(BUILD_STATIC_LIBXML2 TRUE)
Expand Down
5 changes: 5 additions & 0 deletions c/makeotf/source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ target_link_libraries(makeotfexe PUBLIC ${CHOSEN_LIBXML2_LIBRARY})

target_compile_definitions(makeotfexe PRIVATE MAKEOTFLIB_EXPORTS=1)

if (PTHREAD_STATIC_WORKAROUND)
target_compile_definitions(makeotfexe PRIVATE PTHREAD_STATIC_WORKAROUND=1)
endif ()


# set_target_properties(makeotfexe PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

install(TARGETS makeotfexe DESTINATION bin)
8 changes: 8 additions & 0 deletions c/makeotf/source/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
extern "C" int c_main(int argc, char *argv[]);

#ifdef PTHREAD_STATIC_WORKAROUND
#include <pthread.h>
#endif

int main(int argc, char *argv[]) {
#ifdef PTHREAD_STATIC_WORKAROUND
static_cast<void>(pthread_create);
static_cast<void>(pthread_cancel);
#endif
c_main(argc, argv);
}

0 comments on commit 7b1212b

Please sign in to comment.