Skip to content

error: implicit declaration of function ‘LLVMOrcThreadSafeContextGetContext’ #4979

Description

@Dialga

Describe the bug
Unable to build this package.

Version
2.4.5

To Reproduce
Steps to reproduce the behavior:

  1. Compile with flags like:
	configure_arguments=" \
		-GNinja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DLLVM_DIR=/usr/lib/cmake/llvm \
		-DWAMR_BUILD_PLATFORM=linux \
		-DWAMR_BUILD_TARGET=X86_64 \
		-DWAMR_BUILD_INTERP=1 \
		-DWAMR_BUILD_FAST_INTERP=1 \
		-DWAMR_BUILD_AOT=1 \
		-DWAMR_BUILD_JIT=1 \
		-DWAMR_BUILD_FAST_JIT=1 \
		-DWAMR_BUILD_LIBC_BUILTIN=1 \
		-DWAMR_BUILD_LIBC_WASI=1 \
		-DWAMR_BUILD_MULTI_MODULE=1 \
		-DWAMR_BUILD_SHARED_MEMORY=1 \
		-DWAMR_BUILD_BULK_MEMORY=1 \
		-DWAMR_BUILD_THREAD_MGR=1 \
		-DWAMR_BUILD_LIB_PTHREAD=1 \
		-DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
		-DWAMR_BUILD_LIB_WASI_THREADS=1 \
		-DWAMR_BUILD_TAIL_CALL=1 \
		-DWAMR_BUILD_SIMD=1 \
		-DWAMR_BUILD_REF_TYPES=1 \
		-DWAMR_BUILD_STATIC_PGO=1 \
		-DWAMR_BUILD_MODULE_INST_CONTEXT=1 \
		-DWAMR_BUILD_QUICK_AOT_ENTRY=1 \
	"

	cmake \
		-B build \
		-S "$pkgname-WAMR-$pkgver/product-mini/platforms/linux" \
		$configure_arguments

	cmake \
		-B build-lib \
		-S "$pkgname-WAMR-$pkgver" \
		$configure_arguments

	cmake \
		-B build-compiler \
		-S "$pkgname-WAMR-$pkgver/wamr-compiler" \
		-GNinja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DWAMR_BUILD_WITH_CUSTOM_LLVM=1

	cmake --build build
	cmake --build build-lib
	cmake --build build-compiler
  1. See error
    Expected behavior
    successful build

Actual Result
build failure

/home/me/wasm-micro-runtime/src/wasm-micro-runtime-WAMR-2.4.5/core/iwasm/compilation/aot_llvm.c: In function ‘aot_create_comp_context’:
/home/me/wasm-micro-runtime/src/wasm-micro-runtime-WAMR-2.4.5/core/iwasm/compilation/aot_llvm.c:2661:31: error: implicit declaration of function ‘LLVMOrcThreadSafeContextGetContext’ [-Wimplicit-function-declaration]
 2661 |     if (!(comp_ctx->context = LLVMOrcThreadSafeContextGetContext(
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/me/wasm-micro-runtime/src/wasm-micro-runtime-WAMR-2.4.5/core/iwasm/compilation/aot_llvm.c:2661:29: error: assignment to ‘LLVMContextRef’ {aka ‘struct LLVMOpaqueContext *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
 2661 |     if (!(comp_ctx->context = LLVMOrcThreadSafeContextGetContext(
      |                             ^
[78/160] Building C object CMakeFiles/vmlib.dir/home/me/wasm-micro-r...src/wasm-micro-runtime-WAMR-2.4.5/core/iwasm/interpreter/wasm_loader.c.o
/home/me/wasm-micro-runtime/src/wasm-micro-runtime-WAMR-2.4.5/core/iwasm/interpreter/wasm_loader.c: In function ‘wasm_loader_prepare_bytecode’:
/home/me/wasm-micro-runtime/src/wasm-micro-runtime-WAMR-2.4.5/core/iwasm/interpreter/wasm_loader.c:11989:32: warning: unused variable ‘frame_ref_before_pop’ [-Wunused-variable]
11989 |                         uint8 *frame_ref_before_pop = loader_ctx->frame_ref;
...
/home/me/wasm-micro-runtime/src/wasm-micro-runtime-WAMR-2.4.5/core/iwasm/compilation/aot_llvm_extra2.cpp:160:54: error: cannot convert ‘const char*’ to ‘const llvm::Triple&’
  160 |     auto targetmachine = target->createTargetMachine(triple, cpu, features,
      |                                                      ^~~~~~
      |                                                      |
      |                                                      const char*
In file included from /home/me/wasm-micro-runtime/src/wasm-micro-runtime-WAMR-2.4.5/core/iwasm/compilation/aot_llvm_extra2.cpp:13:
/usr/include/llvm/MC/TargetRegistry.h:492:21: note: initializing argument 1 of ‘llvm::TargetMachine* llvm::Target::createTargetMachine(const llvm::Triple&, llvm::StringRef, llvm::StringRef, const llvm::TargetOptions&, std::optional<llvm::Reloc::Model>, std::optional<llvm::CodeModel::Model>, llvm::CodeGenOptLevel, bool) const’
  492 |       const Triple &TT, StringRef CPU, StringRef Features,
      |       ~~~~~~~~~~~~~~^~

Desktop (please complete the following information):

  • Arch x64
  • Board -
  • OS Linux
  • Version

Additional context
Any advice is appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions