Skip to content

Commit 7e3c708

Browse files
[Build] Repair the build for non-static-only static stdlib builds
When SWIFT_BUILD_STATIC_STDLIB=ON, SWIFT_BUILD_DYNAMIC_STDLIB=OFF, and the sdk being built is not a static-only (e.g. WASI), the build fails due to duplicate custom command rules against the same output path. In the case of WASI, the static archive should be copied into lib/swift by the first lipo target, and then the second lipo target should copy it into lib/swift_static. ``` CMake Error at cmake/modules/SwiftAddCustomCommandTarget.cmake:144 (add_custom_command): Attempt to add a custom rule to output /home/build-user/build/buildbot_linux/wasmstdlib-linux-x86_64/lib/swift_static/wasi/libswiftCore.a.rule which already has a custom rule. Call Stack (most recent call first): stdlib/cmake/modules/AddSwiftStdlib.cmake:673 (add_custom_command_target) stdlib/cmake/modules/AddSwiftStdlib.cmake:2657 (_add_swift_lipo_target) stdlib/public/core/CMakeLists.txt:401 (add_swift_target_library) ```
1 parent ade04a7 commit 7e3c708

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,10 +2492,10 @@ function(add_swift_target_library name)
24922492
"${SWIFTLIB_DIR}/${library_subdir}/${CMAKE_SHARED_LIBRARY_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX}")
24932493
endif()
24942494
else()
2495-
if(SWIFTLIB_INSTALL_WITH_SHARED)
2496-
set(lib_dir "${SWIFTLIB_DIR}")
2497-
else()
2495+
if(SWIFT_SDK_${sdk}_STATIC_ONLY)
24982496
set(lib_dir "${SWIFTSTATICLIB_DIR}")
2497+
else()
2498+
set(lib_dir "${SWIFTLIB_DIR}")
24992499
endif()
25002500

25012501
if("${sdk}" STREQUAL "WINDOWS")

0 commit comments

Comments
 (0)