WasmEdge / WasmEdge

WasmEdge is a lightweight, high-performance, and extensible WebAssembly runtime for cloud native, edge, and decentralized applications. It powers serverless apps, embedded functions, microservices, smart contracts, and IoT devices.

Home Page:https://WasmEdge.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: failed to link libwasmedgeAOT.dylib, undefined symbols when rerun `ninja`

dannypsnl opened this issue · comments

Summary

There are undefined symbols let linker fails.

Current State

[29/297] Linking CXX shared library lib/aot/libwasmedgeAOT.dylib
FAILED: lib/aot/libwasmedgeAOT.dylib 
: && /Library/Developer/CommandLineTools/usr/bin/c++ -g -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk -dynamiclib -Wl,-headerpad_max_install_names  -o lib/aot/libwasmedgeAOT.dylib -install_name @rpath/libwasmedgeAOT.dylib lib/aot/CMakeFiles/wasmedgeAOT.dir/blake3.cpp.o lib/aot/CMakeFiles/wasmedgeAOT.dir/cache.cpp.o  -Wl,-rpath,/Users/dannypsnl/secondstate/WasmEdge/build/lib/system -Wl,-rpath,/Users/dannypsnl/secondstate/WasmEdge/build/thirdparty/blake3 -Wl,-rpath,/Users/dannypsnl/secondstate/WasmEdge/build/lib/common -Wl,-rpath,/Users/dannypsnl/secondstate/WasmEdge/build/_deps/spdlog-build  lib/system/libwasmedgeSystem.tbd  thirdparty/blake3/libutilBlake3.tbd  lib/common/libwasmedgeCommon.tbd  _deps/spdlog-build/libspdlogd.1.11.0.tbd && :
ld: Undefined symbols:
  WasmEdge::convertBytesToHexStr(cxx20::span<unsigned char const, 18446744073709551615ul>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>&, unsigned int, bool), referenced from:
      WasmEdge::AOT::Cache::getPath(cxx20::span<unsigned char const, 18446744073709551615ul>, WasmEdge::AOT::Cache::StorageScope, std::__1::basic_string_view<char, std::__1::char_traits<char>>) in cache.cpp.o
  WasmEdge::Path::home(), referenced from:
      WasmEdge::AOT::(anonymous namespace)::getRoot(WasmEdge::AOT::Cache::StorageScope) in cache.cpp.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[42/297] Building CXX object lib/plugin/CMakeFiles/wasmedgePlugin.dir/plugin.cpp.o
ninja: build stopped: subcommand failed.

Expected State

Should not have this issue, since when I first invoke ninja, the build process can complete.

Reproduction steps

  1. Run cmake -DCMAKE_BUILD_TYPE=Debug -DWASMEDGE_PLUGIN_WASI_HTTP=ON -DWASMEDGE_BUILD_TOOLS=ON -GNinja ..
  2. Run ninja twice
  3. Get error

Screenshots

image

Any logs you want to share for showing the specific issue

No response

Components

Others

WasmEdge Version or Commit you used

commit: 0c1460e

Operating system information

macOS 14.2.1 (23C71)

Hardware Architecture

aarch64

Compiler flags and options

  • clang: 15.0.7
  • cmake: 3.28.3

Cannot reproduce this issue:

CleanShot 2024-03-12 at 13 45 41

I am on 14.3.1(23D60), Homebrew clang version 16.0.6, cmake version 3.28.3

Let me update my system and retry.

Not occurred in macOS 14.4, close as now our program issue.