Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: cyclic dependency in module 'SwiftWASILibc': SwiftWASILibc -> std_inttypes_h -> SwiftWASILibc #5597

Open
kateinoigakukun opened this issue Nov 25, 2024 · 1 comment

Comments

@kateinoigakukun
Copy link
Member

$ swift build --swift-sdk DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads --target Example
/private/var/folders/k2/q6yzck31253_q1j4kxkzq5jh0000gn/T/tmp.6igJC9tBhY/Sources/CxxTarget/include/check.h:1:10: note: while building module 'std_string' imported from /private/var/folders/k2/q6yzck31253_q1j4kxkzq5jh0000gn/T/tmp.6igJC9tBhY/Sources/CxxTarget/include/check.h:1:
1 | #include <string>
  |          `- note: while building module 'std_string' imported from /private/var/folders/k2/q6yzck31253_q1j4kxkzq5jh0000gn/T/tmp.6igJC9tBhY/Sources/CxxTarget/include/check.h:1:
2 | 

/Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/string:591:10: note: while building module 'std_private_algorithm_remove' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/string:591:
 589 | #include <__algorithm/max.h>
 590 | #include <__algorithm/min.h>
 591 | #include <__algorithm/remove.h>
     |          `- note: while building module 'std_private_algorithm_remove' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/string:591:
 592 | #include <__algorithm/remove_if.h>
 593 | #include <__assert>

/Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/__algorithm/remove.h:12:10: note: while building module 'std_private_algorithm_find' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/__algorithm/remove.h:12:
10 | #define _LIBCPP___ALGORITHM_REMOVE_H
11 | 
12 | #include <__algorithm/find.h>
   |          `- note: while building module 'std_private_algorithm_find' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/__algorithm/remove.h:12:
13 | #include <__algorithm/find_if.h>
14 | #include <__config>

/Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/__algorithm/find.h:23:10: note: while building module 'std_private_string_constexpr_c_functions' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/__algorithm/find.h:23:
 21 | #include <__fwd/bit_reference.h>
 22 | #include <__iterator/segmented_iterator.h>
 23 | #include <__string/constexpr_c_functions.h>
    |          `- note: while building module 'std_private_string_constexpr_c_functions' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/__algorithm/find.h:23:
 24 | #include <__type_traits/is_integral.h>
 25 | #include <__type_traits/is_same.h>

/Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/__string/constexpr_c_functions.h:14:10: note: while building module 'std_private_memory_construct_at' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/__string/constexpr_c_functions.h:14:
 12 | #include <__config>
 13 | #include <__memory/addressof.h>
 14 | #include <__memory/construct_at.h>
    |          `- note: while building module 'std_private_memory_construct_at' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/__string/constexpr_c_functions.h:14:
 15 | #include <__type_traits/datasizeof.h>
 16 | #include <__type_traits/is_always_bitcastable.h>

/Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/__memory/construct_at.h:23:10: note: while building module 'std_new' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/__memory/construct_at.h:23:
 21 | #include <__utility/forward.h>
 22 | #include <__utility/move.h>
 23 | #include <new>
    |          `- note: while building module 'std_new' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/__memory/construct_at.h:23:
 24 | 
 25 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

/Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/new:358:12: note: while building module 'std_cstdlib' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/new:358:
356 | 
357 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
358 | #  include <cstdlib>
    |            `- note: while building module 'std_cstdlib' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/new:358:
359 | #  include <type_traits>
360 | #endif

/Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/stdlib.h:94:19: note: while building module 'SwiftWASILibc' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/stdlib.h:94:
 92 | 
 93 | #  if __has_include_next(<stdlib.h>)
 94 | #    include_next <stdlib.h>
    |                   `- note: while building module 'SwiftWASILibc' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/stdlib.h:94:
 95 | #  endif
 96 | 

/Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/wasm32-wasip1-threads/netinet/in.h:10:10: note: while building module 'std_inttypes_h' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/wasm32-wasip1-threads/netinet/in.h:10:
  8 | #include <features.h>
  9 | // #include <__header_inttypes.h>
 10 | #include <inttypes.h>
    |          `- note: while building module 'std_inttypes_h' imported from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/wasm32-wasip1-threads/netinet/in.h:10:
 11 | #include <sys/socket.h>
 12 | #ifdef __wasilibc_unmodified_upstream /* Use alternate WASI libc headers */

<module-includes>:1:10: note: in file included from <module-includes>:1:
1 | #include "inttypes.h"
  |          `- note: in file included from <module-includes>:1:
2 | 

/Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/inttypes.h:252:17: note: in file included from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/inttypes.h:252:
250 | 
251 | #if __has_include_next(<inttypes.h>)
252 | #  include_next <inttypes.h>
    |                 `- note: in file included from /Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/WASI.sdk/include/c++/v1/inttypes.h:252:
253 | #endif
254 | 

/Users/katei/Library/org.swift.swiftpm/swift-sdks/swift-wasm-DEVELOPMENT-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle/DEVELOPMENT-SNAPSHOT-2024-11-24-a-wasm32-unknown-wasip1-threads/wasm32-unknown-wasip1-threads/swift.xctoolchain/usr/lib/swift_static/clang/include/inttypes.h:24:15: error: cyclic dependency in module 'SwiftWASILibc': SwiftWASILibc -> std_inttypes_h -> SwiftWASILibc
 22 | #endif
 23 | 
 24 | #include_next <inttypes.h>
    |               `- error: cyclic dependency in module 'SwiftWASILibc': SwiftWASILibc -> std_inttypes_h -> SwiftWASILibc
 25 | 
 26 | #if defined(_MSC_VER) && _MSC_VER < 1900
@kateinoigakukun
Copy link
Member Author

The cycle can be resolved by defining Clang modules in granular units
e.g. in.h -> inttypes.h (libcxx) -> inttypes.h (libc)

I think we can do something like swiftlang#71840

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant