@@ -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} )
0 commit comments