github-actions[bot] commented on code in PR #70491:
URL: https://github.com/apache/doris/pull/70491#discussion_r4546098414


##########
cloud/CMakeLists.txt:
##########
@@ -347,23 +352,27 @@ set(DORIS_DEPENDENCIES
 message(STATUS "DORIS_DEPENDENCIES is ${DORIS_DEPENDENCIES}")
 
 # Add all external dependencies. They should come after the project's libs.
-# static link gcc's lib
 set(DORIS_LINK_LIBS
     CommonCPP
     ${DORIS_DEPENDENCIES}
-    -static-libstdc++
-    -static-libgcc
     -lresolv
 )
 
+if (NOT OS_MACOSX)
+    list(APPEND DORIS_LINK_LIBS -static-libstdc++ -static-libgcc)
+    if (NOT (USE_LIBCPP AND COMPILER_CLANG))
+        list(APPEND DORIS_LINK_LIBS -lstdc++fs)
+    endif()
+endif()
+
 if (ENABLE_HDFS_STORAGE_VAULT)
     set(DORIS_LINK_LIBS ${DORIS_LINK_LIBS}
         -L${DORIS_JAVA_HOME}/lib/server
         -ljvm)
-endif()
-
-if (NOT (USE_LIBCPP AND COMPILER_CLANG))
-    set(DORIS_LINK_LIBS ${DORIS_LINK_LIBS} -lstdc++fs)
+    if (OS_MACOSX)
+        list(APPEND CMAKE_BUILD_RPATH "${DORIS_JAVA_HOME}/lib/server")
+        list(APPEND CMAKE_INSTALL_RPATH "${DORIS_JAVA_HOME}/lib/server")

Review Comment:
   [P2] Resolve the JVM from the runtime JAVA_HOME on macOS
   
   With the default `ENABLE_HDFS_STORAGE_VAULT=ON`, the installed executable 
links `libjvm.dylib`, but its runpaths contain only `@loader_path` and the 
build machine's JDK directory. If `output/ms` is deployed where that JDK path 
is absent (or that JDK is moved), a valid runtime `JAVA_HOME` cannot rescue 
startup: `start.sh` adds it only to `LD_LIBRARY_PATH`. OpenJDK supplies an 
[`@rpath` install 
name](https://github.com/openjdk/jdk17u/blob/master/make/autoconf/flags-cflags.m4#L45-L50),
 and [dyld uses 
`DYLD_LIBRARY_PATH`](https://github.com/apple-oss-distributions/dyld/blob/main/dyld/DyldProcessConfig.cpp#L1965-L2012)
 for this override. The service consequently fails before `main` with a missing 
`@rpath/libjvm.dylib`. Keep the build runpath, but make the packaged launcher 
supply the runtime JVM directory to dyld, including through the daemon launch 
path, or provide an equivalent relocatable JVM dependency. A same-host smoke 
test with the original JDK still present misses this case.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to