Skip to content

Commit 18130db

Browse files
committed
Alternative visibility fix
1 parent 8d456b3 commit 18130db

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

cpp/cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,6 +2448,12 @@ macro(build_substrait)
24482448

24492449
add_library(substrait STATIC ${SUBSTRAIT_SOURCES})
24502450
set_target_properties(substrait PROPERTIES POSITION_INDEPENDENT_CODE ON)
2451+
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
2452+
# Match Protobuf's visibility so duplicate inline definitions can't be
2453+
# selected with different visibility when linking a side module (GH-50774)
2454+
set_target_properties(substrait PROPERTIES CXX_VISIBILITY_PRESET hidden
2455+
VISIBILITY_INLINES_HIDDEN ON)
2456+
endif()
24512457
target_compile_options(substrait PRIVATE "${SUBSTRAIT_SUPPRESSED_FLAGS}")
24522458
target_include_directories(substrait PUBLIC ${SUBSTRAIT_INCLUDES})
24532459
target_link_libraries(substrait PUBLIC ${ARROW_PROTOBUF_LIBPROTOBUF})
@@ -3888,6 +3894,12 @@ function(build_orc)
38883894

38893895
fetchcontent_makeavailable(orc)
38903896

3897+
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
3898+
# ORC compiles generated Protobuf code into its static library
3899+
set_target_properties(orc PROPERTIES CXX_VISIBILITY_PRESET hidden
3900+
VISIBILITY_INLINES_HIDDEN ON)
3901+
endif()
3902+
38913903
# ORC 2.2.1 unconditionally adds /std:c++17 on MSVC via
38923904
# add_compile_options, which overrides CMAKE_CXX_STANDARD and causes
38933905
# ABI mismatches with protobuf (GlobalEmptyStringConstexpr vs
@@ -3980,6 +3992,10 @@ function(build_orc)
39803992
"-DZLIB_HOME=${ORC_ZLIB_ROOT}"
39813993
"-DZLIB_INCLUDE_DIR=$<TARGET_PROPERTY:ZLIB::ZLIB,INTERFACE_INCLUDE_DIRECTORIES>"
39823994
"-DZLIB_LIBRARY=$<TARGET_FILE:ZLIB::ZLIB>")
3995+
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
3996+
list(APPEND ORC_CMAKE_ARGS -DCMAKE_CXX_VISIBILITY_PRESET=hidden
3997+
-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON)
3998+
endif()
39833999

39844000
# Work around CMake bug
39854001
file(MAKE_DIRECTORY ${ORC_INCLUDE_DIR})

cpp/src/arrow/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,11 +1106,6 @@ else()
11061106
endif()
11071107

11081108
if(ARROW_BUILD_BUNDLED_DEPENDENCIES)
1109-
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
1110-
# Restore the archive order (pre-GH-50650). Otherwise, wasm-ld may select
1111-
# duplicate vague-linkage symbols from a different member (GH-50774).
1112-
list(REVERSE ARROW_BUNDLED_STATIC_LIBS)
1113-
endif()
11141109
arrow_car(_FIRST_LIB ${ARROW_BUNDLED_STATIC_LIBS})
11151110
arrow_cdr(_OTHER_LIBS ${ARROW_BUNDLED_STATIC_LIBS})
11161111
arrow_create_merged_static_lib(arrow_bundled_dependencies

0 commit comments

Comments
 (0)