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

Build is broken above llvm 10 #1

Open
arjunsuresh opened this issue May 9, 2023 · 5 comments
Open

Build is broken above llvm 10 #1

arjunsuresh opened this issue May 9, 2023 · 5 comments

Comments

@arjunsuresh
Copy link

I'm trying to do a build of the toolchain on Ubuntu20.04. With llvm-14.0.0. The below errors are coming due to this change. Can this be fixed please?

-- Build files have been written to: /home/cmuser/CM/repos/local/cache/a3f45f43bf5e4a62/repo/build/qaic-compute-release
[177/356] Building CXX object lib/support/CMakeFiles/Support.dir/StringList.cpp.o
FAILED: lib/support/CMakeFiles/Support.dir/StringList.cpp.o 
/home/cmuser/CM/repos/local/cache/60f4ea3ed72b4873/bin/clang++  -isystem /home/cmuser/CM/repos/local/cache/60f4ea3ed72b4873/include -O2 -fPIC -std=c++17 -MD -MT lib/support/CMakeFiles/Support.dir/StringList.cpp.o -MF lib/support/CMakeFiles/Support.dir/StringList.cpp.o.d -o lib/support/CMakeFiles/Support.dir/StringList.cpp.o -c /home/cmuser/CM/repos/local/cache/a3f45f43bf5e4a62/repo/lib/support/StringList.cpp
In file included from /home/cmuser/CM/repos/local/cache/a3f45f43bf5e4a62/repo/lib/support/StringList.cpp:4:
/home/cmuser/CM/repos/local/cache/a3f45f43bf5e4a62/repo/lib/support/StringList.h:25:50: error: no matching member function for call to 'push_back'
  void push_back(llvm::StringRef val) { strings_.push_back(val); }
                                        ~~~~~~~~~^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_vector.h:1184:7: note: candidate function not viable: no known conversion from 'llvm::StringRef' to 'const std::vector<std::basic_string<char>>::value_type' (aka 'const std::basic_string<char>') for 1st argument
      push_back(const value_type& __x)
      ^
/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_vector.h:1200:7: note: candidate function not viable: no known conversion from 'llvm::StringRef' to 'std::vector<std::basic_string<char>>::value_type' (aka 'std::basic_string<char>') for 1st argument
      push_back(value_type&& __x)
      ^
1 error generated.
[210/356] Building CXX object _deps/flatbuffers-build/CMakeFiles/flatc.dir/src/idl_parser.cpp.o
ninja: build stopped: subcommand failed.

Using llvm10.0.0 built from src fails for the below error but the package manager installation works fine on Ubuntu20.04.

/usr/bin/ld: tools/qaic-objcopy/CMakeFiles/qaic-objcopy.dir/qaic-objcopy.cpp.o:(.data.rel.ro._ZTIN4llvm2cl4listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEbNS0_6parserIS7_EEEE[_ZTIN4llvm2cl4listINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEbNS0_6parserIS7_EEEE]+0x18): undefined reference to `typeinfo for llvm::cl::Option'
/usr/bin/ld: tools/qaic-objcopy/CMakeFiles/qaic-objcopy.dir/qaic-objcopy.cpp.o:(.data.rel.ro._ZTIN4llvm2cl15OptionValueCopyIbEE[_ZTIN4llvm2cl15OptionValueCopyIbEE]+0x10): undefined reference to `typeinfo for llvm::cl::GenericOptionValue'

@quic-jhugo
Copy link
Contributor

Sorry, my notification settings were not correct and someone just brought this to my attention today. I will attempt to repro.

@quic-jhugo
Copy link
Contributor

The build mentioned in the Readme still works.
Looks like Ubuntu 20.04 has a "clang-12" package which generates errors similar to what you've reported.
I don't see a clang-14 package available though. How are you getting clang-14?

@quic-jhugo
Copy link
Contributor

Have some fixes for clang-12. Will be pushing today.
I found these instructions to get clang-14:
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 14
Looks like there are additional issues that appear with clang-14 which will result in additional fixes.

@arjunsuresh
Copy link
Author

arjunsuresh commented Feb 9, 2024

Thank you @quic-jhugo for looking into this. I just tested this again with different compiler versions as follows.

python3 -m pip install cmind
cm pull repo ctuning@mlcommons-ck
cm run script --tags=get,qaic,software,kit --adr.compiler.tags=gcc 

To try a different compiler

cm rm cache --tags=get,qaic,software,kit
cm run script --tags=get,qaic,software,kit --adr.compiler.tags=llvm --adr.compiler.version=16.0.0

For llvm most versions will work as the prebuilt compiler binaries are downloaded but for GCC only the ones installed on the system will work.

We have tested on llvm 12, 13, 14, 15, 16 and the compilation works for 13+ albeit by adding these compiler flags.

gcc-11 worked but gcc-12 (on Ubuntu 23.04) failed with the error as given in this issue. We can quickly test gcc-12 by using docker as follows:

cm docker script --tags=get,qaic,software,kit --adr.compiler.tags=gcc --adr.compiler.version_min=12 \
--docker_os=ubuntu --docker_os_version=23.04

@arjunsuresh
Copy link
Author

My apologies - the above commands are for the "software-kit-for-qualcomm-cloud-ai-100" repository. For this repository, llvm-12 now works fine but versions 13-17 have the below compilation failures.

https://github.com/arjunsuresh/software-kit-for-qualcomm-cloud-ai-100-cc/actions/runs/7856810857/job/21439981267

For example, the below command will fail but --adr.llvm.version=12.0.1 works fine.

cm run script --tags=get,qaic,compute,sdk --adr.llvm.version=15.0.6 --quiet

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

No branches or pull requests

3 participants
@arjunsuresh @quic-jhugo and others