Hi Team,
Currently I still cannot figure out how to make this project dependent on qe-compiler. qe-compiler is an excellent project, I believe many users would like to develop their own full compilers based on this framework. Thus it would be helpful if you could provide some instructions on how to achieve this. I am also very willing to contribute if it requires more effort to make this project a conan package that other projects can depend on.
Here are two ways I have tried but failed. Note that I can seamlessly build qe-compiler locally, but I just cannot build a conan package of it and then make my own project dependent on qe-compiler.
01 Manually
This is done by copying conandata.yml and conanfile.py to the path ./conan/qec and create a conan_deps.sh, which essentially calls conan export
Direclly use the original conanfile.py does not work because it sets exports_sources = "*", resulting in a non-empty directory ~/.conan/data/qss-compiler/0.1.0/qss-compiler/stable/export_source/. Then conan will copy conandata.yml, conanfile.py, conanmanifest.txt into ~/.conan/data/qss-compiler/0.1.0/qss-compiler/stable/source/. But conan cannot delete conandata.yml, resulting in a non-empty source dir, preventing cloning source file of qe-compiler.
Steps
Manually create a conan package and export it to local cache and then build it
Then install qe-compiler through conan
mkdir build && cd build
cd build
conan install .. --build=outdated -pr:h default -pr:b default
This method finally results in
CMake Error at /root/miniconda3/envs/quos-dev/lib/python3.10/site-packages/cmake/data/share/cmake-3.23/Modules/CMakeDetermineSystem.cmake:130 (message):
Could not find toolchain file: conan_toolchain.cmake
Call Stack (most recent call first):
CMakeLists.txt:46 (enable_language)
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_ASM_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
02 Conan
Then I tried using conan create to create a local conan package.
In the root directory of qe-compiler
cd build
conan create .. zhaoyilun/qe-compiler --build=outdated -pr:h default -pr:b default -e QSSC_VERSION=0.1.0
Initially, I met following error
fatal: not a git repository (or any of the parent directories): .git
-- Root CMake project Git directory (used for version):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/root/miniconda3/envs/quos-dev/lib/python3.10/site-packages/setuptools_scm/__init__.py", line 148, in get_version
_version_missing(config)
File "/root/miniconda3/envs/quos-dev/lib/python3.10/site-packages/setuptools_scm/__init__.py", line 108, in _version_missing
raise LookupError(
LookupError: setuptools-scm was unable to detect version for /root/.conan/data/qss-compiler/0.1.0/zhaoyilun/qe-compiler/build/d28c692a69e3ccd7dc8cd629cfb34b8fd367905b.
Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work.
The root cause is that conan will not copy .git directory into the local cache, resulting in the error of setuptools_scm. After checking the CMakeLists.txt, I found that I can explicitly set VERSION_STRING to avoid using setuptools_scm.
After fixing the above error, it results in a cyclic dependency error
CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle):
"QSSPythonSources.Dialects.quir" of type INTERFACE_LIBRARY
depends on "QSSPythonModules.sources.QSSPythonSources.Dialects.quir" (strong)
"QSSPythonModules.sources.QSSPythonSources.Dialects.quir" of type UTILITY
depends on "QSSPythonSources.Dialects.quir" (strong)
At least one of these targets is not a STATIC_LIBRARY. Cyclic dependencies are allowed only among static libraries.
CMake Generate step failed. Build files cannot be regenerated correctly.
System info
PRETTY_NAME="Ubuntu Jammy Jellyfish (development branch)"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04 (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
Hi Team,
Currently I still cannot figure out how to make this project dependent on qe-compiler.
qe-compileris an excellent project, I believe many users would like to develop their own full compilers based on this framework. Thus it would be helpful if you could provide some instructions on how to achieve this. I am also very willing to contribute if it requires more effort to make this project a conan package that other projects can depend on.Here are two ways I have tried but failed. Note that I can seamlessly build qe-compiler locally, but I just cannot build a conan package of it and then make my own project dependent on qe-compiler.
01 Manually
This is done by copying
conandata.ymlandconanfile.pyto the path./conan/qecand create aconan_deps.sh, which essentially callsconan exportSteps
Manually create a conan package and export it to local cache and then build it
Then install qe-compiler through conan
This method finally results in
02 Conan
Then I tried using
conan createto create a local conan package.In the root directory of qe-compiler
cd build conan create .. zhaoyilun/qe-compiler --build=outdated -pr:h default -pr:b default -e QSSC_VERSION=0.1.0Initially, I met following error
The root cause is that conan will not copy
.gitdirectory into the local cache, resulting in the error ofsetuptools_scm. After checking the CMakeLists.txt, I found that I can explicitly setVERSION_STRINGto avoid usingsetuptools_scm.After fixing the above error, it results in a cyclic dependency error
System info