[Bug] Build failed with `undefined references to 'std::__throw_bad_array_new_length()' follow`
- Dominant language
- Python
- Stars
- 13.7k
- Forks
- 4k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 111
Description
### Expected behavior
Build tvm-0.18.0 from source.
### Actual behavior
Hi, I follow this document (https://tvm.apache.org/docs/install/from_source.html) to install tvm 0.18.0 from source.
Everything was fine until I ran the command:
`cmake .. && cmake --build . --parallel $(nproc)`.
Here is the error I encountered:
```Bash
/usr/bin/ld: /root/miniconda3/envs/tvm-build-venv/lib/libLLVMipo.a(SampleContextTracker.cpp.o):SampleContextTracker.cpp:(.text._ZN4llvm20SampleContextTracker17getBaseSamplesForENS_10sampleprof10FunctionIdEb+0x3c5): more undefined references to `std::__throw_bad_array_new_length()' follow
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/tvm.dir/build.make:2035: libtvm.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:205: CMakeFiles/tvm.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[100%] Built target tvm_allvisible
make: *** [Makefile:136: all] Error 2
```
Then, I searched for solutions on Github. This solution (https://github.com/mlc-ai/mlc-llm/issues/1683) worked.
The solution required me to execute `conda deactivate tvm-build-venv` to exit the conda environment with the build dependency.
In the base environment, I was able to successfully build tvm without encountering the same error.
I do not understand the role of the created build environment in this, at least during the installation of tvm-0.18.0.
Does the document (https://tvm.apache.org/docs/install/from_source.html) need to be updated again? Or if there are some issues that need fixing.
Thank you for your time and reply.
### Environment
```bash
Ubuntu 20.04
cmake version 3.24.2
clang version 15.0.4
make version 4.2.1
gcc version 9.4.0
g++ version 9.4.0
```
### Triage
Please refer to the list of label tags [here](https://github.com/apache/tvm/wiki/Issue-Triage-Labels) to find the relevant tags and add them below in a bullet format (example below).
* backend: llvm
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the from_source.html installation guide and the reported cmake .. && cmake --build . --parallel $(nproc) command, comparing builds inside and outside the tvm-build-venv environment. Reproduce the undefined std::__throw_bad_array_new_length reference with the listed Ubuntu, compiler, and LLVM setup; done means the cause is documented or the build instructions are corrected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100