930727fre opened a new issue, #17696:
URL: https://github.com/apache/tvm/issues/17696
### Expected behavior
TVM should successfully compile and link `libtvm.so` without missing
`-lxml2`.
### Actual behavior
The build fails with a linker error stating that `-lxml2` cannot be found:
```bash
[100%] Building CXX object
CMakeFiles/tvm_objs.dir/src/target/llvm/llvm_instance.cc.o
[100%] Building CXX object
CMakeFiles/tvm_objs.dir/src/target/llvm/llvm_module.cc.o
/home/fre930727/tvm/src/target/tag.cc: In function ‘void
__static_initialization_and_destruction_0(int, int)’:
/home/fre930727/tvm/src/target/tag.cc:462:1: note: variable tracking size
limit exceeded with ‘-fvar-tracking-assignments’, retrying without
462 | } // namespace tvm
| ^
[100%] Built target tvm_objs
[100%] Linking CXX shared library libtvm.so
[100%] Linking CXX shared library libtvm_allvisible.so
/usr/bin/ld: cannot find -lxml2: /usr/bin/ld: cannot find -lxml2: No such
file or directory
No such file or directory
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/tvm.dir/build.make:1408: libtvm.so] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:208: CMakeFiles/tvm.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake[2]: *** [CMakeFiles/tvm_allvisible.dir/build.make:1408:
libtvm_allvisible.so] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:309: CMakeFiles/tvm_allvisible.dir/all]
Error 2
gmake: *** [Makefile:136: all] Error 2
```
### Environment
- **OS:** Ubuntu 22.04 (WSL2)
- **CPU:** Intel i5-12400
- **TVM Version:** 12e72c29e877bced07f4d0cb5a0861e92cddb38c
### Steps to reproduce
1. Follow the instructions in the [[TVM installation
guide](https://tvm.apache.org/docs/install/from_source.html)](https://tvm.apache.org/docs/install/from_source.html).
2. Execute the following shell script:
```bash
# make sure to start with a fresh environment
conda env remove -n tvm-build-venv
# create the conda environment with build dependency
conda create -n tvm-build-venv -c conda-forge \
"llvmdev>=15" \
"cmake>=3.24" \
git \
python=3.11
# enter the build environment
conda activate tvm-build-venv
```
```bash
git clone --recursive https://github.com/apache/tvm tvm
```
```bash
cd tvm
rm -rf build && mkdir build && cd build
# Specify the build configuration via CMake options
cp ../cmake/config.cmake .
```
```bash
# controls default compilation flags (Candidates: Release, Debug,
RelWithDebInfo)
echo "set(CMAKE_BUILD_TYPE RelWithDebInfo)" >> config.cmake
# LLVM is a must dependency for compiler end
echo "set(USE_LLVM \"llvm-config --ignore-libllvm --link-static\")" >>
config.cmake
echo "set(HIDE_PRIVATE_SYMBOLS ON)" >> config.cmake
# GPU SDKs, turn on if needed
echo "set(USE_CUDA OFF)" >> config.cmake
echo "set(USE_METAL OFF)" >> config.cmake
echo "set(USE_VULKAN OFF)" >> config.cmake
echo "set(USE_OPENCL OFF)" >> config.cmake
# cuBLAS, cuDNN, cutlass support, turn on if needed
echo "set(USE_CUBLAS OFF)" >> config.cmake
echo "set(USE_CUDNN OFF)" >> config.cmake
echo "set(USE_CUTLASS OFF)" >> config.cmake
```
```bash
cmake .. && cmake --build . --parallel $(nproc)
```
3. The build fails with the above linker error.
### Troubleshooting Attempts
- Added debugging options:
```bash
echo "set(CMAKE_BUILD_TYPE Debug)" >> config.cmake
echo "set(USE_ALTERNATIVE_LINKER OFF)" >> config.cmake
echo "set(USE_LIBBACKTRACE On)" >> config.cmake
```
- Installed `libxml2` via Conda:
```bash
conda install -c conda-forge libxml2
```
### Questions
- Is `libxml2` required to be installed via `apt` rather than Conda for TVM
to find it?
- Are there specific CMake flags I should set to properly link against
`libxml2`?
- Any recommendations for debugging linker issues in this context?
### Triage
- needs-triage
Any help would be greatly appreciated. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]