Skip to content

Commit

Permalink
Fixes MacOS CI for UDFs by correcting the library path using install_…
Browse files Browse the repository at this point in the history
…name_tool (#3045)

See also: matthew-brett/delocate#150

Fixes https://github.com/alibaba/GraphScope/actions/runs/5632258389/job/15261490129

Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com>
  • Loading branch information
sighingnow committed Jul 23, 2023
1 parent 185790e commit d8f6e2c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions coordinator/gscoordinator/template/CMakeLists.template
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ endif()
# address the "illegal thread local variable reference to regular symbol" error
# in recent version of brew installed protobuf on MacOS
set(BUNDLED_Protobuf_LIBRARIES)
set(BUNDLED_Protobuf_LIBRARIES_DLC) # generated by delocate-wheel, see also: https://github.com/matthew-brett/delocate/issues/150
if (APPLE)
# find bundled protobuf library
if (EXISTS "${ANALYTICAL_ENGINE_HOME}/lib/libprotobuf.dylib")
Expand All @@ -303,13 +304,15 @@ if (APPLE)
file(GLOB PROTOBUF_LIBS "${ANALYTICAL_ENGINE_HOME}/../graphscope.dylibs/libprotobuf.*.dylib")
if (PROTOBUF_LIBS)
list(GET PROTOBUF_LIBS 0 BUNDLED_Protobuf_LIBRARIES)
string(REPLACE "${ANALYTICAL_ENGINE_HOME}/../" "/DLC/" BUNDLED_Protobuf_LIBRARIES_DLC ${BUNDLED_Protobuf_LIBRARIES})
endif()
endif()
if (NOT BUNDLED_Protobuf_LIBRARIES)
# search libprotobuf.xx.xxx.dylib in graphscope_runtime/.dylibs
file(GLOB PROTOBUF_LIBS "${ANALYTICAL_ENGINE_HOME}/../graphscope_runtime/.dylibs/libprotobuf.*.dylib")
if (PROTOBUF_LIBS)
list(GET PROTOBUF_LIBS 0 BUNDLED_Protobuf_LIBRARIES)
string(REPLACE "${ANALYTICAL_ENGINE_HOME}/../" "/DLC/" BUNDLED_Protobuf_LIBRARIES_DLC ${BUNDLED_Protobuf_LIBRARIES})
endif()
endif()
if (NOT BUNDLED_Protobuf_LIBRARIES)
Expand All @@ -323,6 +326,7 @@ if (APPLE)
endif()
endif()
message(STATUS "Using BUNDLED_Protobuf_LIBRARIES: ${BUNDLED_Protobuf_LIBRARIES}")
message(STATUS "Using BUNDLED_Protobuf_LIBRARIES_DLC: ${BUNDLED_Protobuf_LIBRARIES_DLC}")
endif()

set(GRAPH_TYPE "$_graph_type")
Expand Down Expand Up @@ -459,6 +463,14 @@ endif ()

if (APPLE AND BUNDLED_Protobuf_LIBRARIES)
target_link_libraries(${FRAME_NAME} ${BUNDLED_Protobuf_LIBRARIES})

if (BUNDLED_Protobuf_LIBRARIES_DLC)
add_custom_command(TARGET ${FRAME_NAME}
POST_BUILD COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change
"${BUNDLED_Protobuf_LIBRARIES_DLC}" "${BUNDLED_Protobuf_LIBRARIES}"
$<TARGET_FILE:${FRAME_NAME}>
)
endif ()
endif ()

# include the inplace cmake config at the end, to avoid affecting the CMake search path
Expand Down
7 changes: 7 additions & 0 deletions coordinator/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[tool.black]
line-length = 88
exclude = '.*\/(forward|node_modules|\.eggs|build|_pb2\.py)\/.*'

0 comments on commit d8f6e2c

Please sign in to comment.