Conan-center-index: [package] 7zip/19.00: Circular dependency when building from source

Created on 3 Feb 2020  路  9Comments  路  Source: conan-io/conan-center-index

Package and Environment Details (include every applicable attribute)

  • Package Name/Version: 7zip/19.00
  • Operating System+version: Windows 10
  • Compiler+version: Visual Studio 2017 15.9.14
  • Docker image: N/A
  • Conan version: conan 1.21.2
  • Python version: Python 3.7.0

Conan profile (output of conan profile show default or conan profile show <profile> if custom profile is in use)

[settings]
arch=x86
arch_build=x86
build_type=RelWithDebInfo
compiler=Visual Studio
compiler.runtime=MD
compiler.version=15
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

Steps to reproduce (Include if Applicable)

  1. Launch Visual Studio dev prompt (x86 Native Tools Command Prompt for VS2017)
  2. conan install 7zip/19.00 -s arch_build=x86 -s arch=x86 --build missing
  3. Receive the following error:
    ERROR: Loop detected: 'msys2/20161025' requires '7zip/19.00' which is an ancestor too

Logs (Include/Attach if Applicable)

Click to expand log

C:\projects\conan-qt>conan install 7zip/19.00@ -s arch_build=x86 -s arch=x86 --build missing
Configuration:
[settings]
arch=x86
arch_build=x86
build_type=RelWithDebInfo
compiler=Visual Studio
compiler.runtime=MD
compiler.version=15
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

ERROR: Loop detected: 'msys2/20161025' requires '7zip/19.00' which is an ancestor too

C:\projects\conan-qt>conan install msys2/20161025@ -s arch_build=x86 -s arch=x86 --build missing
Configuration:
[settings]
arch=x86
arch_build=x86
build_type=RelWithDebInfo
compiler=Visual Studio
compiler.runtime=MD
compiler.version=15
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

ERROR: Loop detected: 'lzma_sdk/9.20' requires 'msys2/20161025' which is an ancestor too

C:\projects\conan-qt>conan install lzma_sdk/9.20@ -s arch_build=x86 -s arch=x86 --build missing
Configuration:
[settings]
arch=x86
arch_build=x86
build_type=RelWithDebInfo
compiler=Visual Studio
compiler.runtime=MD
compiler.version=15
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

ERROR: Loop detected: '7zip/19.00' requires 'lzma_sdk/9.20' which is an ancestor too

bug

Most helpful comment

Hmm. Well, the build_requires is apparently already has behavior conditional on having 7zr in PATH. Would it make sense to also/instead make the msys2 build_requires conditional on python version, and use tools.untgz if python is >= 3.3 and has xz support? That would at least limit the scope of the issue to those using python 2 (who would get status quo)

All 9 comments

Trying to workaround cross-compiling issues with libiconv (#332) by using -s arch_build=x86 and discovered I couldn't build 7zip from source.

Looks like 7zip wants to have 7zr.exe from the LZMA SDK.
https://github.com/conan-io/conan-center-index/blob/94ded94f61a5be585b074b8a816b96217b0e5228/recipes/7zip/19.00/conanfile.py#L32-L34
If it can't find 7zr.exe in path, it tries to build the LZMA SDK, which fails (also due to circular reference).

I think I can break the circular dependency chain by adding 7zr.exe manually by downloading the LZMA SDK and adding it to PATH prior to running conan install.

Ironically, the main idea of using lzma_sdk within 7zip was to break circular dependencies.

Maybe we can make msys2 not relying on 7zip (are there other source downloads available?) or lzma_sdk not on msys2

It's looks like msys2 is downloading .xz files, not .7z files.

https://github.com/conan-io/conan-center-index/blob/25f0751b56e7c95bd0e8b23326c88adaf825f945/recipes/msys2/all/conanfile.py#L49-L51

Python has supported lzma and xz in the standard library since 3.3 (https://docs.python.org/3/library/lzma.html). I think conan now requires >= 3.5, so perhaps the recipe could just use that and not a build_requires tool at all?

In fact, I believe tools.untargz() (and hence tools.get() are actually implemented in terms of python's tarfile module (https://docs.python.org/3.3/library/tarfile.html), which understand .tar.bz2 and .tar.xz already (also since 3.3). So you probably don't need an outside tool and could just use tools.get(), though that already-existing support should be documented if a foundational package of conan-center-index like msys2 is going to depend on it.

Conan still supports Python 2.7, so we can not rely yet on Python's lzma/xz support unfortunatly

Hmm. Well, the build_requires is apparently already has behavior conditional on having 7zr in PATH. Would it make sense to also/instead make the msys2 build_requires conditional on python version, and use tools.untgz if python is >= 3.3 and has xz support? That would at least limit the scope of the issue to those using python 2 (who would get status quo)

any update on this? i am still seeing error like below on windows.

ERROR: Loop detected: 'lzma_sdk/9.20' requires 'msys2/20190524' which is an ancestor too

I have run into this issue. Is there a work-around?

I just found out that my build was broken because of this issue.

1373 removed the option to find 7zr on the system using the path environment variable and therefore we now always have the circular dependency:

msys2/20190524 > 7zip/19.00 > lzma_sdk/9.20 > msys2/20190524

I came up with the following workarounds.

Workaround 1

Specify the CONAN_BASH_PATH environment variable with the path to the Bash shell.

Git with Bash:

set CONAN_BASH_PATH=C:\Program Files\Git\bin\bash.exe

WSL:

set CONAN_BASH_PATH=C:\Windows\System32\bash.exe

I haven't checked whether this has to be a valid path.

Workaround 2

Override the revision of the 7zip/19.00 requirement in your conanfile to the last working revision, e.g. 7zip/19.00#dc40ec665fdf7b259bd9fa22c26368ac.

Note that package revisions is an experimental feature that must be enabled (see "How to activate the revisions").

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ericriff picture ericriff  路  3Comments

joxoby picture joxoby  路  3Comments

Croydon picture Croydon  路  3Comments

IceflowRE picture IceflowRE  路  3Comments

prince-chrismc picture prince-chrismc  路  3Comments