English 中文(简体)
缩略语
原标题:WASI: wasm-ld symbol not found

The following short c example used the standard c Library and caused the wasi sdk:

#include <stdio.h>

int main(void)
{
    puts("Hello");
    return 0;
}

在与部族直接编纂法典时,它毫无问题地发挥作用:

clang --target=wasm32-unknown-wasi -s -o example.wasm example.c

我对陆地边界安全机器工具链的理解是,我可以取得同样的结果,要么可以实现同样的结果。

  1. clang -> LLVM IR (.ll) -> LLVM native object files (.o) -> convert to wasm
  2. clang -> LLVM native object files (.o) -> convert to wasm

我能够采用第二种办法,采用简单的C方案,不使用标准校准电话,在尝试上述例子时,我收到了一个未界定的符号错误:

clang --target=wasm32-unknown-wasi -c  example.c
wasm-ld example.o -o example.wasm  --no-entry --export-all
   wasm-ld: error: example.o: undefined symbol: puts

I do not know if my problem is that I use the wrong clang parameters and therefore not export enough information or that the error is in the wasm-ld command.

如果有人能让我更深入地了解工具链,那将是高兴的。

问题回答

You need to link the standard C library like this:

wasm-ld example.o -o example.wasm  --no-entry --export-all 
  -lc -L${WASI_SYSROOT}/lib/wasm32-wasi/ 

${WASI_SYSROOT} with You own wasi-sysroot path.

您的第一项做法是,请添加<代码>-v,以了解实际情况。 可查阅wasm-ld xxx -lc -L${WASI_SYSROOT}/lib/wasm32-wasi/。 以及同样的情况。





相关问题
Compiling Ruby and Python interpreters with Clang?

I m just curious; are there any benchmarks about how compiling interpreters for dynamic languages with Clang affects the performance of these languages? Do those interpreters even compile?

compiling linux kernel with non-gcc

Linux kernel is written for compiling with gcc and uses a lot of small and ugly gcc-hacks. Which compilers can compile linux kernel except gcc? The one, which can, is the Intel Compiler. What minimal ...

llvm-clang: incremental or online parser?

Is there anyway to use the llvm-clang parser in an incremental/online manner? Say I m writing an editor and I want to be able to parse the C++ code I have in front of me. I don t want to write my ...

Clang static analyzer on Windows

Does anybody have any success running clang static analyzer on Windows? I have successfully built llvm and clang (using VS 2008). Running scan-build results in the following error: The getpwuid ...