Open Renkai opened 2 years ago
Thanks! I wonder what's your clang version? E.g. clang --version
(taichi-dev) ➜ taichi git:(master) clang --version
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I believe it's the builtin clang of macOS if my memory is not wrong.
Yeah, this is possibly a compatibility issue between LLVM-10 (kind of old) and clang-13. Will look into it
Seems clang-13 with llvm-10 on ubuntu has a different error
/usr/bin/ld: CMakeFiles/spirv-cross.dir/main.cpp.o: in function `main':
main.cpp:(.text+0xc): undefined reference to `__cxa_begin_catch'
/usr/bin/ld: main.cpp:(.text+0x38): undefined reference to `__cxa_end_catch'
/usr/bin/ld: CMakeFiles/spirv-cross.dir/main.cpp.o: in function `main_inner(int, char**)':
main.cpp:(.text+0x2bba): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: main.cpp:(.text+0x2c90): undefined reference to `operator delete(void*)'
/usr/bin/ld: main.cpp:(.text+0x2d63): undefined reference to `operator delete(void*)'
/usr/bin/ld: main.cpp:(.text+0x2ff7): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: main.cpp:(.text+0x314a): undefined reference to `operator delete(void*)'
/usr/bin/ld: main.cpp:(.text+0x315c): undefined reference to `operator delete(void*)'
/usr/bin/ld: main.cpp:(.text+0x3309): undefined reference to `operator delete(void*)'
/usr/bin/ld: main.cpp:(.text+0x331b): undefined reference to `operator delete(void*)'
/usr/bin/ld: main.cpp:(.text+0x337c): undefined reference to `operator delete(void*)'
/usr/bin/ld: CMakeFiles/spirv-cross.dir/main.cpp.o:main.cpp:(.text+0x3393): more undefined references to `operator delete(void*)' follow
/usr/bin/ld: CMakeFiles/spirv-cross.dir/main.cpp.o: in function `main_inner(int, char**)':
main.cpp:(.text+0x3431): undefined reference to `std::__throw_bad_alloc()'
/usr/bin/ld: main.cpp:(.text+0x343d): undefined reference to `std::__throw_length_error(char const*)'
/usr/bin/ld: main.cpp:(.text+0x34c3): undefined reference to `operator delete(void*)'
/usr/bin/ld: main.cpp:(.text+0x34e1): undefined reference to `operator delete(void*)'
/usr/bin/ld: main.cpp:(.text+0x4b25): undefined reference to `operator delete(void*)'
/usr/bin/ld: CMakeFiles/spirv-cross.dir/main.cpp.o: in function `compile_iteration[abi:cxx11](CLIArguments const&, std::vector<unsigned int, std::allocator<unsigned int> >)':
main.cpp:(.text+0x4c94): undefined reference to `operator delete(void*)'
/usr/bin/ld: main.cpp:(.text+0x4cbe): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: main.cpp:(.text+0x4dbe): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)'
/usr/bin/ld: main.cpp:(.text+0x4e0c): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: main.cpp:(.text+0x5163): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: main.cpp:(.text+0x53c9): undefined reference to `operator delete(void*)'
/usr/bin/ld: main.cpp:(.text+0x5592): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)'
/usr/bin/ld: main.cpp:(.text+0x5787): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: main.cpp:(.text+0x5c54): undefined reference to `operator delete(void*)'
/usr/bin/ld: main.cpp:(.text+0x5c90): undefined reference to `operator delete(void*)'
/usr/bin/ld: main.cpp:(.text+0x5cb4): undefined reference to `operator delete(void*)'
/usr/bin/ld: main.cpp:(.text+0x5ce7): undefined reference to `operator delete(void*)'
/usr/bin/ld: main.cpp:(.text+0x5e59): undefined reference to `operator delete(void*)'
/usr/bin/ld: CMakeFiles/spirv-cross.dir/main.cpp.o:main.cpp:(.text+0x5e81): more undefined references to `operator delete(void*)' follow
/usr/bin/ld: CMakeFiles/spirv-cross.dir/main.cpp.o: in function `compile_iteration[abi:cxx11](CLIArguments const&, std::vector<unsigned int, std::allocator<unsigned int> >)':
main.cpp:(.text+0x6d66): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: main.cpp:(.text+0x6df5): undefined reference to `std::terminate()'
/usr/bin/ld: main.cpp:(.text+0x6e92): undefined reference to `operator delete(void*, unsigned long)'
This is probably because LLVM IR is not guaranteed to be forward compatible. So old llvm-as
may not be able to parse the IR generated by new clang
. Seems llvm 12 break the compatibility. Since clang
on MacOS strongly relies on the system tool-chain, we may not be able to provide a single binary now (the binary from the LLVM official site may not work too). Also found a similar issue here.
The current recommended solution is to downgrade clang to a version no greater than 11 (10 is better) using brew/MacPorts or maintain multiple xcode tool-chain.
Will update doc and add version checks in cmake.
have the same problem with clang10 and llvm10
ubuntu@ubuntu:~/taichi$ clang --version
clang version 10.0.0-4ubuntu1
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
have the same problem with clang10 and llvm10
ubuntu@ubuntu:~/taichi$ clang --version clang version 10.0.0-4ubuntu1 Target: aarch64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/bin
Could you provide the complete commands and errors in your building?
When I follow this doc to build Taichi https://docs.taichi.graphics/lang/articles/contribution/dev_install#installing-dependencies under macOS 11.6 and pre-prebuilt llvm 10.0.0