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 build failed for WebAssembly target #92279

Closed
spino17 opened this issue May 15, 2024 · 5 comments
Closed

LLVM build failed for WebAssembly target #92279

spino17 opened this issue May 15, 2024 · 5 comments

Comments

@spino17
Copy link

spino17 commented May 15, 2024

I used the following command to build the LLVM for WebAssembly target on my mac:
cmake -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ../llvm -DLLVM_TARGETS_TO_BUILD="WebAssembly"
The make command after running the above cmake failed by having the following error:

[ 76%] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/Targets/Sparc.cpp.o
/Users/bhavyabhatt/Desktop/bhavya/projects/wasm-llvm/llvm-project/clang/lib/CodeGen/Targets/Sparc.cpp:269:7: error: no matching function for call to 'max'
      std::max(CB.DL.getTypeSizeInBits(StrTy).getKnownMinValue(), 1UL), 64));
      ^~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__algorithm/max.h:40:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('llvm::details::FixedOrScalableQuantity<llvm::TypeSize, unsigned long long>::ScalarTy' (aka 'unsigned long long') vs. 'unsigned long')
max(const _Tp& __a, const _Tp& __b)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__algorithm/max.h:51:1: note: candidate template ignored: could not match 'initializer_list<_Tp>' against 'llvm::details::FixedOrScalableQuantity<llvm::TypeSize, unsigned long long>::ScalarTy' (aka 'unsigned long long')
max(initializer_list<_Tp> __t, _Compare __comp)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__algorithm/max.h:61:1: note: candidate function template not viable: requires single argument '__t', but 2 arguments were provided
max(initializer_list<_Tp> __t)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__algorithm/max.h:31:1: note: candidate function template not viable: requires 3 arguments, but 2 were provided
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
1 error generated.
make[2]: *** [tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/Targets/Sparc.cpp.o] Error 1
make[1]: *** [tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/all] Error 2
make: *** [all] Error 2

The output of command clang --version is

Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
@llvmbot
Copy link
Collaborator

llvmbot commented May 15, 2024

@llvm/issue-subscribers-clang-codegen

Author: Bhavya Bhatt (spino17)

I used the following command to build the LLVM for `WebAssembly` target on my mac: `cmake -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ../llvm -DLLVM_TARGETS_TO_BUILD="WebAssembly"` The `make` command after running the above `cmake` failed by having the following error: ``` [ 76%] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/Targets/Sparc.cpp.o /Users/bhavyabhatt/Desktop/bhavya/projects/wasm-llvm/llvm-project/clang/lib/CodeGen/Targets/Sparc.cpp:269:7: error: no matching function for call to 'max' std::max(CB.DL.getTypeSizeInBits(StrTy).getKnownMinValue(), 1UL), 64)); ^~~~~~~~ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__algorithm/max.h:40:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('llvm::details::FixedOrScalableQuantity<llvm::TypeSize, unsigned long long>::ScalarTy' (aka 'unsigned long long') vs. 'unsigned long') max(const _Tp& __a, const _Tp& __b) ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__algorithm/max.h:51:1: note: candidate template ignored: could not match 'initializer_list<_Tp>' against 'llvm::details::FixedOrScalableQuantity<llvm::TypeSize, unsigned long long>::ScalarTy' (aka 'unsigned long long') max(initializer_list<_Tp> __t, _Compare __comp) ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__algorithm/max.h:61:1: note: candidate function template not viable: requires single argument '__t', but 2 arguments were provided max(initializer_list<_Tp> __t) ^ /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__algorithm/max.h:31:1: note: candidate function template not viable: requires 3 arguments, but 2 were provided max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ 1 error generated. make[2]: *** [tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/Targets/Sparc.cpp.o] Error 1 make[1]: *** [tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/all] Error 2 make: *** [all] Error 2 ```

The output of command clang --version is

Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

@aheejin
Copy link
Member

aheejin commented May 15, 2024

This is not a WebAssembly problem; it seems to be caused by #90338. It looks fixes are being tried in da116bd and 8a4cbea. Given that they are fixing it now, I hope the build will clear soon, and I think we can close this.

@aheejin aheejin closed this as completed May 15, 2024
@spino17
Copy link
Author

spino17 commented May 16, 2024

Thanks a lot @aheejin for mentioning those. Just to make sure that I would change the line mentioned in https://github.com/llvm/llvm-project/commit/8a4cbeada930bf11fe740a2038bd5a3230712284 and rebuild it right ?

@aheejin
Copy link
Member

aheejin commented May 16, 2024

Yeah it looks that commit has fixed the issue.

@spino17
Copy link
Author

spino17 commented May 16, 2024

Yeah, checked out just now! Thanks a lot for the help @aheejin . I believe working with stable source is much more safer given I just want to build clang library for AST.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants