Skip to content

SourceKit-LSP doesn't work with swift-for-wasm-examples package #1475

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

Closed
turbolent opened this issue May 19, 2024 · 4 comments · Fixed by #1535
Closed

SourceKit-LSP doesn't work with swift-for-wasm-examples package #1475

turbolent opened this issue May 19, 2024 · 4 comments · Fixed by #1535

Comments

@turbolent
Copy link

turbolent commented May 19, 2024

Is there any way to configure the swift-for-wasm-examples package so that development with SourceKit-LSP works correctly?

When opening LadderFilter.swift, an error appears for import VultDSP:

Could not build C module 'VultDSP' SourceKit 

And in the errors I get

<wasi/api.h> only supports wasm32; doesn't yet support wasm64
...

In the output from SourceKit-LSP I can see:

sourcekit: [1:getCursorInfo:426.8573] error creating ASTInvocation: warning: option '-incremental' is only supported in swift-driver
<unknown>:0: warning: option '-incremental' is only supported in swift-driver
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/endian.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/endian.h:19:17: error: unknown type name 'uint16_t'
static __inline uint16_t __bswap16(uint16_t __x)
                ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/endian.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/endian.h:19:36: error: unknown type name 'uint16_t'
static __inline uint16_t __bswap16(uint16_t __x)
                                   ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/endian.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/endian.h:24:17: error: unknown type name 'uint32_t'
static __inline uint32_t __bswap32(uint32_t __x)
                ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/endian.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/endian.h:24:36: error: unknown type name 'uint32_t'
static __inline uint32_t __bswap32(uint32_t __x)
                                   ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/endian.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/endian.h:29:17: error: unknown type name 'uint64_t'
static __inline uint64_t __bswap64(uint64_t __x)
                ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/endian.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/endian.h:29:36: error: unknown type name 'uint64_t'
static __inline uint64_t __bswap64(uint64_t __x)
                                   ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:
#include <wasi_api.h>
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:27:2: error: <wasi/api.h> only supports wasm32; doesn't yet support wasm64
#error <wasi/api.h> only supports wasm32; doesn't yet support wasm64
 ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:
#include <wasi_api.h>
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:31:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:31:
#include <stdint.h>
         ^
/home/bastian/Downloads/swift-DEVELOPMENT-SNAPSHOT-2024-05-15-a-ubuntu22.04/usr/lib/swift/clang/include/stdint.h:52:16: note: in file included from /home/bastian/Downloads/swift-DEVELOPMENT-SNAPSHOT-2024-05-15-a-ubuntu22.04/usr/lib/swift/clang/include/stdint.h:52:
# include_next <stdint.h>
               ^
/usr/include/stdint.h:26:10: note: in file included from /usr/include/stdint.h:26:
#include <bits/libc-header-start.h>
         ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:74:5: error: function-like macro '__GLIBC_USE' is not defined
#if __GLIBC_USE (IEC_60559_BFP_EXT) || __GLIBC_USE (ISOC2X)
    ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:
#include <wasi_api.h>
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:31:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:31:
#include <stdint.h>
         ^
/home/bastian/Downloads/swift-DEVELOPMENT-SNAPSHOT-2024-05-15-a-ubuntu22.04/usr/lib/swift/clang/include/stdint.h:52:16: note: in file included from /home/bastian/Downloads/swift-DEVELOPMENT-SNAPSHOT-2024-05-15-a-ubuntu22.04/usr/lib/swift/clang/include/stdint.h:52:
# include_next <stdint.h>
               ^
/usr/include/stdint.h:26:10: note: in file included from /usr/include/stdint.h:26:
#include <bits/libc-header-start.h>
         ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:80:5: error: function-like macro '__GLIBC_USE' is not defined
#if __GLIBC_USE (IEC_60559_BFP_EXT) || defined __STDC_WANT_IEC_60559_EXT__
    ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:
#include <wasi_api.h>
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:31:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:31:
#include <stdint.h>
         ^
/home/bastian/Downloads/swift-DEVELOPMENT-SNAPSHOT-2024-05-15-a-ubuntu22.04/usr/lib/swift/clang/include/stdint.h:52:16: note: in file included from /home/bastian/Downloads/swift-DEVELOPMENT-SNAPSHOT-2024-05-15-a-ubuntu22.04/usr/lib/swift/clang/include/stdint.h:52:
# include_next <stdint.h>
               ^
/usr/include/stdint.h:26:10: note: in file included from /usr/include/stdint.h:26:
#include <bits/libc-header-start.h>
         ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:97:5: error: function-like macro '__GLIBC_USE' is not defined
#if __GLIBC_USE (IEC_60559_FUNCS_EXT) || __GLIBC_USE (ISOC2X)
    ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:
#include <wasi_api.h>
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:31:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:31:
#include <stdint.h>
         ^
/home/bastian/Downloads/swift-DEVELOPMENT-SNAPSHOT-2024-05-15-a-ubuntu22.04/usr/lib/swift/clang/include/stdint.h:52:16: note: in file included from /home/bastian/Downloads/swift-DEVELOPMENT-SNAPSHOT-2024-05-15-a-ubuntu22.04/usr/lib/swift/clang/include/stdint.h:52:
# include_next <stdint.h>
               ^
/usr/include/stdint.h:265:5: error: function-like macro '__GLIBC_USE' is not defined
#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
    ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:
#include <wasi_api.h>
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:41:16: error: static assertion failed due to requirement 'alignof(void *) == 4': non-wasi data layout
_Static_assert(_Alignof(void*) == 4, "non-wasi data layout");
               ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:41:32: note: expression evaluates to '8 == 4'
_Static_assert(_Alignof(void*) == 4, "non-wasi data layout");
                               ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:
#include <wasi_api.h>
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:51:16: error: static assertion failed due to requirement 'sizeof(unsigned long) == 4': witx calculated size
_Static_assert(sizeof(__wasi_size_t) == 4, "witx calculated size");
               ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:51:38: note: expression evaluates to '8 == 4'
_Static_assert(sizeof(__wasi_size_t) == 4, "witx calculated size");
                                     ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:
#include <wasi_api.h>
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:52:16: error: static assertion failed due to requirement 'alignof(unsigned long) == 4': witx calculated align
_Static_assert(_Alignof(__wasi_size_t) == 4, "witx calculated align");
               ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:52:40: note: expression evaluates to '8 == 4'
_Static_assert(_Alignof(__wasi_size_t) == 4, "witx calculated align");
                                       ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:
#include <wasi_api.h>
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:689:16: error: static assertion failed due to requirement 'sizeof(__wasi_iovec_t) == 8': witx calculated size
_Static_assert(sizeof(__wasi_iovec_t) == 8, "witx calculated size");
               ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:689:39: note: expression evaluates to '16 == 8'
_Static_assert(sizeof(__wasi_iovec_t) == 8, "witx calculated size");
                                      ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:
#include <wasi_api.h>
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:690:16: error: static assertion failed due to requirement 'alignof(__wasi_iovec_t) == 4': witx calculated align
_Static_assert(_Alignof(__wasi_iovec_t) == 4, "witx calculated align");
               ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:690:41: note: expression evaluates to '8 == 4'
_Static_assert(_Alignof(__wasi_iovec_t) == 4, "witx calculated align");
                                        ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:
#include <wasi_api.h>
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:692:16: error: static assertion failed due to requirement '__builtin_offsetof(__wasi_iovec_t, buf_len) == 4': witx calculated offset
_Static_assert(offsetof(__wasi_iovec_t, buf_len) == 4, "witx calculated offset");
               ^
/home/bastian/Downloads/swift-DEVELOPMENT-SNAPSHOT-2024-05-15-a-ubuntu22.04/usr/lib/swift/clang/include/__stddef_offsetof.h:16:24: note: expanded from macro 'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
                       ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:692:50: note: expression evaluates to '8 == 4'
_Static_assert(offsetof(__wasi_iovec_t, buf_len) == 4, "witx calculated offset");
                                                 ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:
#include <wasi_api.h>
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:710:16: error: static assertion failed due to requirement 'sizeof(__wasi_ciovec_t) == 8': witx calculated size
_Static_assert(sizeof(__wasi_ciovec_t) == 8, "witx calculated size");
               ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:710:40: note: expression evaluates to '16 == 8'
_Static_assert(sizeof(__wasi_ciovec_t) == 8, "witx calculated size");
                                       ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: note: while building module 'dlmalloc' imported from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:
#include <features.h>
         ^
<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/errno.h:6:
#include <wasi_api.h>
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:711:16: error: static assertion failed due to requirement 'alignof(__wasi_ciovec_t) == 4': witx calculated align
_Static_assert(_Alignof(__wasi_ciovec_t) == 4, "witx calculated align");
               ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/dlmalloc/include/wasi_api.h:711:42: note: expression evaluates to '8 == 4'
_Static_assert(_Alignof(__wasi_ciovec_t) == 4, "witx calculated align");
                                         ^
<unknown>:0: error: too many errors emitted, stopping now
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/VultDSP/include/waveforms.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/VultDSP/include/waveforms.h:1:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/VultDSP/include/waveforms.h:1:
#include "../out.h"
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/VultDSP/include/../out.h:5:10: note: in file included from /home/bastian/Downloads/swift-for-wasm-examples-main/Sources/VultDSP/include/../out.h:5:
#include <stdint.h>
         ^
/home/bastian/Downloads/swift-DEVELOPMENT-SNAPSHOT-2024-05-15-a-ubuntu22.04/usr/lib/swift/clang/include/stdint.h:52:16: note: in file included from /home/bastian/Downloads/swift-DEVELOPMENT-SNAPSHOT-2024-05-15-a-ubuntu22.04/usr/lib/swift/clang/include/stdint.h:52:
# include_next <stdint.h>
               ^
/usr/include/stdint.h:26:10: note: in file included from /usr/include/stdint.h:26:
#include <bits/libc-header-start.h>
         ^
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33:10: error: could not build module 'dlmalloc'
#include <features.h>
         ^
/home/bastian/Downloads/swift-for-wasm-examples-main/Sources/swift-audio/Effects/LadderFilter.swift:13:8: error: could not build C module 'VultDSP'
import VultDSP
       ^
[org.swift.sourcekit-lsp:request-77] default 2024-05-19 20:53:59.8890 +0000
Succeeded (took 41.36097431182861ms)

It looks like the C flags in Package.swift are not used when building.

I tried creating a compile_flags.txt with target and defines like in the Package.swift, but that doesn't seem to get respected.

@MaxDesiatov
Copy link
Contributor

MaxDesiatov commented Jun 12, 2024

I'm not sure the report for this issue belongs to the examples repository, moving accordingly.

@MaxDesiatov MaxDesiatov transferred this issue from apple/swift-for-wasm-examples Jun 12, 2024
@MaxDesiatov MaxDesiatov changed the title Development with SourceKit-LSP SourceKit-LSP doesn't support swift-for-wasm-examples Jun 12, 2024
@MaxDesiatov MaxDesiatov changed the title SourceKit-LSP doesn't support swift-for-wasm-examples SourceKit-LSP doesn't work with swift-for-wasm-examples package Jun 12, 2024
@ahoppen
Copy link
Member

ahoppen commented Jun 12, 2024

Synced to Apple’s issue tracker as rdar://129662080

ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this issue Jun 28, 2024
We previously always assumed that the project was being built for the host.

Fixes swiftlang#1475
rdar://129662080
@ahoppen
Copy link
Member

ahoppen commented Jun 28, 2024

#1535 adds support for configuration options of cross-compiled projects. Once there’s an open source toolchain with that change (ie. a main development snapshot after June 29), you should be able to use it by placing a .sourcekit-lsp/config.json file with the following contents in the root of your project.

{
  "swiftPM": {
    "triple": "wasm32-unknown-none-wasm"
  }
}

This file essentially communicates the arguments that you pass to a swift build invocation to SourceKit-LSP.

ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this issue Jun 28, 2024
We previously always assumed that the project was being built for the host.

Fixes swiftlang#786
Fixes swiftlang#1475
rdar://129662080
rdar://113099964
@turbolent
Copy link
Author

@ahoppen Great work, thank you!

lokesh-tr pushed a commit to lokesh-tr/sourcekit-lsp that referenced this issue Jul 4, 2024
We previously always assumed that the project was being built for the host.

Fixes swiftlang#786
Fixes swiftlang#1475
rdar://129662080
rdar://113099964
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

Successfully merging a pull request may close this issue.

3 participants