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

LLVM-19 rc2: clang-19 is not supporting webassembly. #103692

Open
subhakr opened this issue Aug 14, 2024 · 3 comments
Open

LLVM-19 rc2: clang-19 is not supporting webassembly. #103692

subhakr opened this issue Aug 14, 2024 · 3 comments
Labels
backend:WebAssembly build-problem question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

Comments

@subhakr
Copy link

subhakr commented Aug 14, 2024

Hi,
I trying to install LLVM-19.1.0-rc2 (https://github.com/llvm/llvm-project/releases/tag/llvmorg-19.1.0-rc2)

OS: ubuntu22.04LTS
CPU architectiure: x86_64
RAM and intrenal space: 8GB and 256GB

and the commands i have used to compile

admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/llvm-project-llvmorg-19.1.0-rc2/build$ ninja 
[36/1177] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o
FAILED: tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o 
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/admin1/llvm-project-llvmorg-19.1.0-rc2/build/tools/clang/lib/Sema -I/home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema -I/home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include -I/home/admin1/llvm-project-llvmorg-19.1.0-rc2/build/tools/clang/include -I/home/admin1/llvm-project-llvmorg-19.1.0-rc2/build/include -I/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -MD -MT tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o -MF tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o.d -o tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o -c /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema/SemaOpenMP.cpp
In file included from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/APFloat.h:18,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/AST/APNumericStorage.h:12,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/AST/Decl.h:16,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/AST/Attr.h:18,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/Sema/SemaOpenMP.h:17,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema/SemaOpenMP.cpp:14:
In destructor ‘llvm::APInt::~APInt()’,
    inlined from ‘llvm::APSInt::~APSInt()’ at /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/APSInt.h:23:21,
    inlined from ‘bool checkOMPArraySectionConstantForReduction(clang::ASTContext&, const clang::ArraySectionExpr*, bool&, llvm::SmallVectorImpl<llvm::APSInt>&)’ at /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema/SemaOpenMP.cpp:18185:45,
    inlined from ‘bool actOnOMPReductionKindClause(clang::Sema&, {anonymous}::DSAStackTy*, clang::OpenMPClauseKind, llvm::ArrayRef<clang::Expr*>, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::CXXScopeSpec&, const clang::DeclarationNameInfo&, llvm::ArrayRef<clang::Expr*>, {anonymous}::ReductionData&)’ at /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema/SemaOpenMP.cpp:18543:68:
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/APInt.h:172:18: warning: ‘void operator delete [](void*)’ called on a pointer to an unallocated object ‘1’ [-Wfree-nonheap-object]
  172 |       delete[] U.pVal;
      |                  ^~~~
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[41/1177] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaTemplate.cpp.o
ninja: build stopped: subcommand failed.
admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/llvm-project-llvmorg-19.1.0-rc2/build$ ninja 
[22/1137] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o
In file included from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/APFloat.h:18,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/AST/APNumericStorage.h:12,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/AST/Decl.h:16,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/AST/Attr.h:18,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/Sema/SemaOpenMP.h:17,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema/SemaOpenMP.cpp:14:
In destructor ‘llvm::APInt::~APInt()’,
    inlined from ‘llvm::APSInt::~APSInt()’ at /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/APSInt.h:23:21,
    inlined from ‘bool checkOMPArraySectionConstantForReduction(clang::ASTContext&, const clang::ArraySectionExpr*, bool&, llvm::SmallVectorImpl<llvm::APSInt>&)’ at /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema/SemaOpenMP.cpp:18185:45,
    inlined from ‘bool actOnOMPReductionKindClause(clang::Sema&, {anonymous}::DSAStackTy*, clang::OpenMPClauseKind, llvm::ArrayRef<clang::Expr*>, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::CXXScopeSpec&, const clang::DeclarationNameInfo&, llvm::ArrayRef<clang::Expr*>, {anonymous}::ReductionData&)’ at /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema/SemaOpenMP.cpp:18543:68:
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/APInt.h:172:18: warning: ‘void operator delete [](void*)’ called on a pointer to an unallocated object ‘1’ [-Wfree-nonheap-object]
  172 |       delete[] U.pVal;
      |                  ^~~~
[648/1137] Building C object tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.o
In file included from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/tools/c-index-test/c-index-test.c:11:
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/Support/AutoConvert.h:1:1: warning: C++ style comments are not allowed in ISO C90
    1 | //===- AutoConvert.h - Auto conversion between ASCII/EBCDIC -----*- C++ -*-===//
      | ^
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/Support/AutoConvert.h:1:1: note: (this will be reported only once per input file)
[816/1137] Building CXX object tools/llvm-isel-fuzzer/CMakeFiles/llvm-isel-fuzzer.dir/llvm-isel-fuzzer.cpp.o
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp: In function ‘int LLVMFuzzerInitialize(int*, char***)’:
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp:141:43: warning: ISO C++ forbids zero-size array ‘argv’ [-Wpedantic]
  141 |   ExitOnError ExitOnErr(std::string(*argv[0]) + ": error:");
      |                                           ^
[905/1137] Building CXX object tools/llvm-opt-fuzzer/CMakeFiles/llvm-opt-fuzzer.dir/llvm-opt-fuzzer.cpp.o
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp: In function ‘int LLVMFuzzerInitialize(int*, char***)’:
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp:201:43: warning: ISO C++ forbids zero-size array ‘argv’ [-Wpedantic]
  201 |   ExitOnError ExitOnErr(std::string(*argv[0]) + ": error:");
      |                                           ^
[916/1137] Building CXX object tools/llvm-pdbutil/CMakeFiles/llvm-pdbutil.dir/DumpOutputStyle.cpp.o
In file included from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/DebugInfo/PDB/Native/HashTable.h:12,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/DebugInfo/PDB/Native/NamedStreamMap.h:14,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/DebugInfo/PDB/Native/InfoStream.h:14,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp:43:
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/SparseBitVector.h: In member function ‘llvm::Error llvm::pdb::DumpOutputStyle::dumpTpiStream(uint32_t)’:
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/SparseBitVector.h:130:15: warning: array subscript 2 is above array bounds of ‘const BitWord [2]’ {aka ‘const long unsigned int [2]’} [-Warray-bounds]
  130 |       if (Bits[i] != 0)
      |           ~~~~^
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/SparseBitVector.h:55:11: note: while referencing ‘llvm::SparseBitVectorElement<128>::Bits’
   55 |   BitWord Bits[BITWORDS_PER_ELEMENT];
      |           ^~~~
[1137/1137] Linking CXX static library lib/libbenchmark_main.a

after this i have tried $sudo ninja install

then i have used this clang-19 to build sysbench benchmarking tool(i am trying to integrate wasm with sysbench)
when i am compiling i am getting error like

libtool: link: /home/admin1/llvm-project-llvmorg-19.1.0-rc2/build/bin/clang-19 --target=wasm32-wasi-threads -Wall -Wextra -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wnested-externs -Wno-format-zero-length -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wcast-align -Wvla -O3 -funroll-loops --sysroot=/home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot -pthread -fexceptions -D_WASI_EMULATED_PROCESS_CLOCKS -matomics -mbulk-memory --sysroot=/home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot -pthread -fexceptions -Wl,--shared-memory -g -Wl,--export-all -Wl,--no-entry -Wl,--export=__heap_base -Wl,--export=__data_end -pthread -Wl,--initial-memory=16777216 -Wl,--max-memory=16777216 -o sysbench sysbench.o db_driver.o sb_timer.o sb_options.o sb_logger.o sb_histogram.o sb_rand.o sb_thread.o sb_barrier.o sb_lua.o sb_util.o sb_counter.o  -lwasi-emulated-mman -lwasi-emulated-process-clocks tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/mutex/libsbmutex.a /home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot/lib/liblua.a /home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot/lib/libck.a -lm -pthread
wasm-ld: error: cannot open /home/admin1/llvm-project-llvmorg-19.1.0-rc2/build/lib/clang/19/lib/wasm32-unknown-wasi-threads/libclang_rt.builtins.a: No such file or directory
clang-19: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Makefile:546: sysbench] Error 1
make[2]: Leaving directory '/home/admin1/sysbench_main/src'
make[1]: *** [Makefile:608: all-recursive] Error 1
make[1]: Leaving directory '/home/admin1/sysbench_main/src'
make: *** [Makefile:521: all-recursive] Error 1

in clang/19/lib/ there is no wasm32-unknown-wasi-threads directory.
will it create or not after compilation of clang.
to generate that missed Dir what i need to do.

my main moto of this building clang-19 is
from WAMR community they suggested to install clan-19 to resolve the below import linking issues related to jump functions
example

admin1@admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/sysbench_main$ /home/admin1/Documents/wasm-micro-runtime/product-mini/platforms/linux/build/iwasm src/sysbench_with_setjmp_errors 
[13:23:38:500 - 7A7431BB6740]: warning: failed to link import function (env, __wasm_longjmp)
[13:23:38:500 - 7A7431BB6740]: warning: failed to link import function (env, saveSetjmp)
[13:23:38:500 - 7A7431BB6740]: warning: failed to link import function (env, getTempRet0)
[13:23:38:500 - 7A7431BB6740]: warning: failed to link import function (env, testSetjmp)
Attempting to allocate 1064960 bytes of memory...
sysbench 1.1.0-2ca9e3f (using Lua Lua 5.3)

Exception: failed to call unlinked import function (env, saveSetjmp)

so conclusion is
if i install clang-19 properly i would able to solve those errors regarding jump functions .

You tell me am i in correct path to resolve this issues through clang-19
or do i have to rectify these errors in WAMR itself.

Thanks in advance.

@dtcxzyw dtcxzyw added question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead! backend:WebAssembly build-problem and removed new issue labels Aug 14, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Aug 14, 2024

@llvm/issue-subscribers-backend-webassembly

Author: None (subhakr)

Hi, I trying to install LLVM-19.1.0-rc2 (https://github.com/llvm/llvm-project/releases/tag/llvmorg-19.1.0-rc2)

OS: ubuntu22.04LTS
CPU architectiure: x86_64
RAM and intrenal space: 8GB and 256GB

and the commands i have used to compile

admin1@<!-- -->admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/llvm-project-llvmorg-19.1.0-rc2/build$ ninja 
[36/1177] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o
FAILED: tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o 
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/admin1/llvm-project-llvmorg-19.1.0-rc2/build/tools/clang/lib/Sema -I/home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema -I/home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include -I/home/admin1/llvm-project-llvmorg-19.1.0-rc2/build/tools/clang/include -I/home/admin1/llvm-project-llvmorg-19.1.0-rc2/build/include -I/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -MD -MT tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o -MF tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o.d -o tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o -c /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema/SemaOpenMP.cpp
In file included from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/APFloat.h:18,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/AST/APNumericStorage.h:12,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/AST/Decl.h:16,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/AST/Attr.h:18,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/Sema/SemaOpenMP.h:17,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema/SemaOpenMP.cpp:14:
In destructor ‘llvm::APInt::~APInt()’,
    inlined from ‘llvm::APSInt::~APSInt()’ at /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/APSInt.h:23:21,
    inlined from ‘bool checkOMPArraySectionConstantForReduction(clang::ASTContext&amp;, const clang::ArraySectionExpr*, bool&amp;, llvm::SmallVectorImpl&lt;llvm::APSInt&gt;&amp;)’ at /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema/SemaOpenMP.cpp:18185:45,
    inlined from ‘bool actOnOMPReductionKindClause(clang::Sema&amp;, {anonymous}::DSAStackTy*, clang::OpenMPClauseKind, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::CXXScopeSpec&amp;, const clang::DeclarationNameInfo&amp;, llvm::ArrayRef&lt;clang::Expr*&gt;, {anonymous}::ReductionData&amp;)’ at /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema/SemaOpenMP.cpp:18543:68:
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/APInt.h:172:18: warning: ‘void operator delete [](void*)’ called on a pointer to an unallocated object ‘1’ [-Wfree-nonheap-object]
  172 |       delete[] U.pVal;
      |                  ^~~~
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[41/1177] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaTemplate.cpp.o
ninja: build stopped: subcommand failed.
admin1@<!-- -->admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/llvm-project-llvmorg-19.1.0-rc2/build$ ninja 
[22/1137] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o
In file included from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/APFloat.h:18,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/AST/APNumericStorage.h:12,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/AST/Decl.h:16,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/AST/Attr.h:18,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/include/clang/Sema/SemaOpenMP.h:17,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema/SemaOpenMP.cpp:14:
In destructor ‘llvm::APInt::~APInt()’,
    inlined from ‘llvm::APSInt::~APSInt()’ at /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/APSInt.h:23:21,
    inlined from ‘bool checkOMPArraySectionConstantForReduction(clang::ASTContext&amp;, const clang::ArraySectionExpr*, bool&amp;, llvm::SmallVectorImpl&lt;llvm::APSInt&gt;&amp;)’ at /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema/SemaOpenMP.cpp:18185:45,
    inlined from ‘bool actOnOMPReductionKindClause(clang::Sema&amp;, {anonymous}::DSAStackTy*, clang::OpenMPClauseKind, llvm::ArrayRef&lt;clang::Expr*&gt;, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, clang::CXXScopeSpec&amp;, const clang::DeclarationNameInfo&amp;, llvm::ArrayRef&lt;clang::Expr*&gt;, {anonymous}::ReductionData&amp;)’ at /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/lib/Sema/SemaOpenMP.cpp:18543:68:
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/APInt.h:172:18: warning: ‘void operator delete [](void*)’ called on a pointer to an unallocated object ‘1’ [-Wfree-nonheap-object]
  172 |       delete[] U.pVal;
      |                  ^~~~
[648/1137] Building C object tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.o
In file included from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/clang/tools/c-index-test/c-index-test.c:11:
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/Support/AutoConvert.h:1:1: warning: C++ style comments are not allowed in ISO C90
    1 | //===- AutoConvert.h - Auto conversion between ASCII/EBCDIC -----*- C++ -*-===//
      | ^
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/Support/AutoConvert.h:1:1: note: (this will be reported only once per input file)
[816/1137] Building CXX object tools/llvm-isel-fuzzer/CMakeFiles/llvm-isel-fuzzer.dir/llvm-isel-fuzzer.cpp.o
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp: In function ‘int LLVMFuzzerInitialize(int*, char***)’:
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp:141:43: warning: ISO C++ forbids zero-size array ‘argv’ [-Wpedantic]
  141 |   ExitOnError ExitOnErr(std::string(*argv[0]) + ": error:");
      |                                           ^
[905/1137] Building CXX object tools/llvm-opt-fuzzer/CMakeFiles/llvm-opt-fuzzer.dir/llvm-opt-fuzzer.cpp.o
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp: In function ‘int LLVMFuzzerInitialize(int*, char***)’:
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp:201:43: warning: ISO C++ forbids zero-size array ‘argv’ [-Wpedantic]
  201 |   ExitOnError ExitOnErr(std::string(*argv[0]) + ": error:");
      |                                           ^
[916/1137] Building CXX object tools/llvm-pdbutil/CMakeFiles/llvm-pdbutil.dir/DumpOutputStyle.cpp.o
In file included from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/DebugInfo/PDB/Native/HashTable.h:12,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/DebugInfo/PDB/Native/NamedStreamMap.h:14,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/DebugInfo/PDB/Native/InfoStream.h:14,
                 from /home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp:43:
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/SparseBitVector.h: In member function ‘llvm::Error llvm::pdb::DumpOutputStyle::dumpTpiStream(uint32_t)’:
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/SparseBitVector.h:130:15: warning: array subscript 2 is above array bounds of ‘const BitWord [2]’ {aka ‘const long unsigned int [2]’} [-Warray-bounds]
  130 |       if (Bits[i] != 0)
      |           ~~~~^
/home/admin1/llvm-project-llvmorg-19.1.0-rc2/llvm/include/llvm/ADT/SparseBitVector.h:55:11: note: while referencing ‘llvm::SparseBitVectorElement&lt;128&gt;::Bits’
   55 |   BitWord Bits[BITWORDS_PER_ELEMENT];
      |           ^~~~
[1137/1137] Linking CXX static library lib/libbenchmark_main.a

after this i have tried $sudo ninja install

then i have used this clang-19 to build sysbench benchmarking tool(i am trying to integrate wasm with sysbench)
when i am compiling i am getting error like

libtool: link: /home/admin1/llvm-project-llvmorg-19.1.0-rc2/build/bin/clang-19 --target=wasm32-wasi-threads -Wall -Wextra -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wnested-externs -Wno-format-zero-length -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wcast-align -Wvla -O3 -funroll-loops --sysroot=/home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot -pthread -fexceptions -D_WASI_EMULATED_PROCESS_CLOCKS -matomics -mbulk-memory --sysroot=/home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot -pthread -fexceptions -Wl,--shared-memory -g -Wl,--export-all -Wl,--no-entry -Wl,--export=__heap_base -Wl,--export=__data_end -pthread -Wl,--initial-memory=16777216 -Wl,--max-memory=16777216 -o sysbench sysbench.o db_driver.o sb_timer.o sb_options.o sb_logger.o sb_histogram.o sb_rand.o sb_thread.o sb_barrier.o sb_lua.o sb_util.o sb_counter.o  -lwasi-emulated-mman -lwasi-emulated-process-clocks tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/mutex/libsbmutex.a /home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot/lib/liblua.a /home/admin1/Downloads/wasi-sdk-23.0-x86_64-linux/share/wasi-sysroot/lib/libck.a -lm -pthread
wasm-ld: error: cannot open /home/admin1/llvm-project-llvmorg-19.1.0-rc2/build/lib/clang/19/lib/wasm32-unknown-wasi-threads/libclang_rt.builtins.a: No such file or directory
clang-19: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Makefile:546: sysbench] Error 1
make[2]: Leaving directory '/home/admin1/sysbench_main/src'
make[1]: *** [Makefile:608: all-recursive] Error 1
make[1]: Leaving directory '/home/admin1/sysbench_main/src'
make: *** [Makefile:521: all-recursive] Error 1

in clang/19/lib/ there is no wasm32-unknown-wasi-threads directory.
will it create or not after compilation of clang.
to generate that missed Dir what i need to do.

my main moto of this building clang-19 is
from WAMR community they suggested to install clan-19 to resolve the below import linking issues related to jump functions
example

admin1@<!-- -->admin1-VivoBook-ASUSLaptop-X515EA-P1511CEA:~/sysbench_main$ /home/admin1/Documents/wasm-micro-runtime/product-mini/platforms/linux/build/iwasm src/sysbench_with_setjmp_errors 
[13:23:38:500 - 7A7431BB6740]: warning: failed to link import function (env, __wasm_longjmp)
[13:23:38:500 - 7A7431BB6740]: warning: failed to link import function (env, saveSetjmp)
[13:23:38:500 - 7A7431BB6740]: warning: failed to link import function (env, getTempRet0)
[13:23:38:500 - 7A7431BB6740]: warning: failed to link import function (env, testSetjmp)
Attempting to allocate 1064960 bytes of memory...
sysbench 1.1.0-2ca9e3f (using Lua Lua 5.3)

Exception: failed to call unlinked import function (env, saveSetjmp)

so conclusion is
if i install clang-19 properly i would able to solve those errors regarding jump functions .

You tell me am i in correct path to resolve this issues through clang-19
or do i have to rectify these errors in WAMR itself.

Thanks in advance.

@subhakr
Copy link
Author

subhakr commented Aug 14, 2024

@llvm/issue-subscribers-backend-webassembly

Author: None (subhakr)

means i did not get you..

@dschuff
Copy link
Member

dschuff commented Aug 15, 2024

I am not familiar with sysbench so it's not clear to me exactly what you are trying to do here (maybe you are trying to port sysbench to WASI?)
A toolchain is more than just a compiler (clang), it also includes libraries built for the target. The error you are seeing (specifically wasm-ld: error: cannot open /home/admin1/llvm-project-llvmorg-19.1.0-rc2/build/lib/clang/19/lib/wasm32-unknown-wasi-threads/libclang_rt.builtins.a: No such file or directory) means that the compiler-rt builtins library can't be found by the linker. This library is usually included in a toolchain SDK (which also includes the compiler, linker etc). If you were using e.g. wasi-sdk to build before, it was likely one that you downloaded as a package rather than one that used the clang installed into your distribution; and a clang installed into your distribution might or might not be configured properly for wasm. If it really is just the version of the compiler that caused your problem, then you will probably want to figure out how to more directly replace the compiler in the SDK you were using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:WebAssembly build-problem question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Projects
None yet
Development

No branches or pull requests

4 participants