[bug] ERROR: Loop detected in context host: mypackage requires mypackage which is an ancestor too
See original GitHub issueHi,
(This ticket is a follow-up on the following question).
I am trying to compile a package (smc) which has two dependencies (RSARef2 and log4c), the three packages live in the same project and their source code is provided (Note: I cannot share the source code files for intellectual property reasons, but it mainly consists of C code).
So far I’ve been able to compile for MacOS and Windows, but when trying to compile for Android targets (Armv7 for example), the process fails with the following error (see full log below):
ERROR: Loop detected in context host: 'log4c/3.00.09@fsv/android_armeabi-v7a' requires 'log4c/3.00.09@fsv/android_armeabi-v7a' which is an ancestor too
Environment Details (include every applicable attribute)
- Operating System+version: MacOS Big Sur 11.4 (Darwin 20.5.0)
- Compiler+version: Clang (armv7a-linux-androideabi22-) 12.0.5
- Conan version: 1.36.0
- Python version: 3.9.6
Steps to reproduce (Include if Applicable)
For this example I am cross-compiling for Android armv7 targets, using the following profiles and command.
- android_armeabi-v7a profile
target_host=armv7a-linux-androideabi
android_ndk=/Users/nabilelqatib/Library/Android/sdk/ndk/23.0.7599858
api_level=22
[settings]
arch=armv7
build_type=Release
compiler=clang
compiler.libcxx=libc++
compiler.version=12
os=Android
os.api_level=$api_level
[build_requires]
[options]
[env]
PATH=[$android_ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin]
CHOST=$target_host
AR=/Users/nabilelqatib/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar
AS=/Users/nabilelqatib/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-as
RANLIB=/Users/nabilelqatib/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ranlib
CC=/Users/nabilelqatib/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi22-clang
CXX=/Users/nabilelqatib/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi22-clang++
LD=$target_host-ld
STRIP=/Users/nabilelqatib/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-strip
CONAN_CMAKE_TOOLCHAIN_FILE=$android_ndk/build/cmake/android.toolchain.cmake
- Default profile
[settings]
os=Macos
os_build=Macos
arch=x86_64
arch_build=x86_64
compiler=apple-clang
compiler.version=11.0
compiler.libcxx=libc++
build_type=Release
[options]
[build_requires]
[env]
conan create . fsv/android_armeabi-v7a -s build_type=Release -o shared=False -o smc:shared=False -pr:h android_armeabi-v7a -pr:b default -tf None -j /Users/n-eq/Dev/smc/__liv/pkg_info/pkg_info_3.00.02_android_armeabi-v7a_Release_static.json --build missing
Below is the conanfile:
def get_dependencies(cross_build_settings=None, file_path:str='CMakeLists.txt') -> List[str]:
if cross_build_settings is None:
dependencies = get_cmake_properties("FCC_DEPENDENCIES", (), file_path)
if os_is_linux():
os_dependencies = get_cmake_properties("FCC_LINUX_DEPENDENCIES", (), file_path)
elif os_is_Macos():
os_dependencies = get_cmake_properties("FCC_MAC_OS_DEPENDENCIES", (), file_path)
else:
os_dependencies = get_cmake_properties("FCC_WINDOWS_DEPENDENCIES", (), file_path)
deps = [complete_dependency(d) for d in dependencies + os_dependencies]
return deps
else:
macro_name = "FCC_%s_%s_DEPENDENCIES" % (cross_build_settings[2], cross_build_settings[3])
ret = get_cmake_properties(macro_name.upper(), (), file_path)
print("get_dependencies %s: " % macro_name, ret)
return ret
class FccFile(ConanFile):
license = get_target_license()
settings = "os", "compiler", "arch", "build_type"
generators = "cmake"
name = svfcc.get_target_name()
version = svfcc.get_target_version()
url = svfcc.get_target_url()
homepage = svfcc.get_target_homepage()
description = "<Description here>"
options = {"shared": [True, False]}
default_options = {"shared": False}
exports = "CMakeLists.txt", "*.cmake", "*.py"
exports_sources = "src*", "!*~"
cross_build_settings = None
fcc_target_libraries = get_target_libraries()
def package_id(self):
version_digits = (str(self.settings.compiler.version) + "...").split('.')
major = version_digits[0]
if self.settings.compiler == "clang" or self.settings.compiler == "apple-clang":
self.info.settings.compiler.version = major
def requirements(self):
# get_dependencies greps in CMakeLists.txt the needed dependencies
for dep in get_dependencies(tools.get_cross_building_settings(self)):
self.requires(dep)
def build(self):
cmake_build(self, CMake(self, set_cmake_flags=True), tools.cross_building(self))
def package(self):
copy_package_files(self, tools.cross_building(self))
def package_info(self):
if is_mac_os_framework():
self.cpp_info.frameworkdirs.append("%s/lib" % (self.package_folder))
self.cpp_info.frameworks.append(self.name)
else:
self.cpp_info.libs = self.fcc_target_libraries if self.fcc_target_libraries else [self.name]
Logs (Executed commands with output) (Include/Attach if Applicable)
DEBUG :conan_api.py [176]: INIT: Using config '/Users/n-eq/.conan/conan.conf' [2021-09-13 15:29:09,472]
DEBUG :tracer.py [156]: CONAN_API: create(test_build_folder=None,lockfile=None,lockfile_out=None,ignore_dirty=False,profile_build=ProfileData(profiles=['default'], settings=None, options=None, env=None)) [2021-09-13 15:29:09,474]
get graph info: wrapper
DEBUG :profile_loader.py[117]: PROFILE LOAD: /Users/n-eq/.conan/profiles/default [2021-09-13 15:29:09,544]
DEBUG :profile_loader.py[117]: PROFILE LOAD: /Users/n-eq/.conan/profiles/android_armeabi-v7a [2021-09-13 15:29:09,544]
DEBUG :profile_loader.py[117]: PROFILE LOAD: /Users/n-eq/.conan/profiles/default [2021-09-13 15:29:09,576]
DEBUG :profile_loader.py[117]: PROFILE LOAD: /Users/n-eq/.conan/profiles/default [2021-09-13 15:29:09,577]
DEBUG :export.py [114]: EXPORT: /Users/n-eq/Dev/smc/conanfile.py [2021-09-13 15:29:09,626]
Exporting package recipe
Level 5:process_lock.py[146]: Acquired file lock `b'/Users/n-eq/.conan/data/smc/3.00.02/fsv/android_armeabi-v7a.count.lock'` after waiting 0.000s [1 attempts were required] [2021-09-13 15:29:09,626]
Level 5:process_lock.py[184]: Unlocked and closed file lock open on `b'/Users/n-eq/.conan/data/smc/3.00.02/fsv/android_armeabi-v7a.count.lock'` [2021-09-13 15:29:09,627]
smc/3.00.02@fsv/android_armeabi-v7a exports: Copied 1 '.txt' file: CMakeLists.txt
smc/3.00.02@fsv/android_armeabi-v7a exports: Copied 32 '.cmake' files
smc/3.00.02@fsv/android_armeabi-v7a exports: Copied 14 '.py' files
smc/3.00.02@fsv/android_armeabi-v7a exports_sources: Copied 82 '.h' files
smc/3.00.02@fsv/android_armeabi-v7a exports_sources: Copied 53 '.c' files
smc/3.00.02@fsv/android_armeabi-v7a exports_sources: Copied 1 '.cpp' file: smc.cpp
smc/3.00.02@fsv/android_armeabi-v7a exports_sources: Copied 2 '.def' files: smc64.def, smc32.def
smc/3.00.02@fsv/android_armeabi-v7a exports_sources: Copied 1 '.rc' file: smc.rc
smc/3.00.02@fsv/android_armeabi-v7a exports_sources: Copied 1 '.plist' file: Info.plist
smc/3.00.02@fsv/android_armeabi-v7a exports_sources: Copied 1 file: smc_export_script
smc/3.00.02@fsv/android_armeabi-v7a: A new conanfile.py version was exported
smc/3.00.02@fsv/android_armeabi-v7a: Folder: /Users/n-eq/.conan/data/smc/3.00.02/fsv/android_armeabi-v7a/export
Level 5:process_lock.py[146]: Acquired file lock `b'/Users/n-eq/.conan/data/smc/3.00.02/fsv/android_armeabi-v7a.count.lock'` after waiting 0.000s [1 attempts were required] [2021-09-13 15:29:09,836]
Level 5:process_lock.py[184]: Unlocked and closed file lock open on `b'/Users/n-eq/.conan/data/smc/3.00.02/fsv/android_armeabi-v7a.count.lock'` [2021-09-13 15:29:09,837]
Level 5:process_lock.py[146]: Acquired file lock `b'/Users/n-eq/.conan/data/smc/3.00.02/fsv/android_armeabi-v7a/metadata.json.lock'` after waiting 0.000s [1 attempts were required] [2021-09-13 15:29:09,837]
Level 5:process_lock.py[184]: Unlocked and closed file lock open on `b'/Users/n-eq/.conan/data/smc/3.00.02/fsv/android_armeabi-v7a/metadata.json.lock'` [2021-09-13 15:29:09,838]
smc/3.00.02@fsv/android_armeabi-v7a: Exported revision: 4a9a21f647b222d5630d23aeaa6db655
Configuration (profile_host):
[settings]
arch=armv7
build_type=Release
compiler=clang
compiler.libcxx=libc++
compiler.version=12
os=Android
os.api_level=22
[options]
shared=False
smc:shared=False
[build_requires]
[env]
AR=/Users/n-eq/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar
AS=/Users/n-eq/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-as
CC=/Users/n-eq/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi22-clang
CHOST=armv7a-linux-androideabi
CONAN_CMAKE_TOOLCHAIN_FILE=/Users/n-eq/Library/Android/sdk/ndk/23.0.7599858/build/cmake/android.toolchain.cmake
CXX=/Users/n-eq/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi22-clang++
LD=armv7a-linux-androideabi-ld
PATH=[/Users/n-eq/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin]
RANLIB=/Users/n-eq/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ranlib
STRIP=/Users/n-eq/Library/Android/sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-strip
Configuration (profile_build):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=11.0
os=Macos
os_build=Macos
[options]
[build_requires]
[env]
Level 5:process_lock.py[146]: Acquired file lock `b'/Users/n-eq/.conan/data/smc/3.00.02/fsv/android_armeabi-v7a.count.lock'` after waiting 0.000s [1 attempts were required] [2021-09-13 15:29:09,841]
Level 5:process_lock.py[184]: Unlocked and closed file lock open on `b'/Users/n-eq/.conan/data/smc/3.00.02/fsv/android_armeabi-v7a.count.lock'` [2021-09-13 15:29:09,841]
smc/3.00.02@fsv/android_armeabi-v7a: ===== Searching in /Users/n-eq/.conan/data/smc/3.00.02/fsv/android_armeabi-v7a/export/conanfile.py
Level 5:process_lock.py[146]: Acquired file lock `b'/Users/n-eq/.conan/data/smc/3.00.02/fsv/android_armeabi-v7a.count.lock'` after waiting 0.000s [1 attempts were required] [2021-09-13 15:29:09,842]
Level 5:process_lock.py[184]: Unlocked and closed file lock open on `b'/Users/n-eq/.conan/data/smc/3.00.02/fsv/android_armeabi-v7a.count.lock'` [2021-09-13 15:29:09,842]
DEBUG :graph_builder.py[417]: GRAPH: new_node: smc/3.00.02@fsv/android_armeabi-v7a [2021-09-13 15:29:09,844]
Level 5:process_lock.py[146]: Acquired file lock `b'/Users/n-eq/.conan/data/log4c/3.00.09/fsv/android_armeabi-v7a.count.lock'` after waiting 0.000s [1 attempts were required] [2021-09-13 15:29:09,847]
Level 5:process_lock.py[184]: Unlocked and closed file lock open on `b'/Users/n-eq/.conan/data/log4c/3.00.09/fsv/android_armeabi-v7a.count.lock'` [2021-09-13 15:29:09,847]
log4c/3.00.09@fsv/android_armeabi-v7a: ===== Searching in /Users/n-eq/.conan/data/log4c/3.00.09/fsv/android_armeabi-v7a/export/conanfile.py
Level 5:process_lock.py[146]: Acquired file lock `b'/Users/n-eq/.conan/data/log4c/3.00.09/fsv/android_armeabi-v7a.count.lock'` after waiting 0.000s [1 attempts were required] [2021-09-13 15:29:09,847]
Level 5:process_lock.py[184]: Unlocked and closed file lock open on `b'/Users/n-eq/.conan/data/log4c/3.00.09/fsv/android_armeabi-v7a.count.lock'` [2021-09-13 15:29:09,847]
DEBUG :graph_builder.py[417]: GRAPH: new_node: log4c/3.00.09@fsv/android_armeabi-v7a [2021-09-13 15:29:09,849]
JSON file created at '/Users/n-eq/Dev/smc/__liv/pkg_info/pkg_info_3.00.02_android_armeabi-v7a_Release_static.json'
ERROR: Loop detected in context host: 'log4c/3.00.09@fsv/android_armeabi-v7a' requires 'log4c/3.00.09@fsv/android_armeabi-v7a' which is an ancestor too
I appreciate your help. (cc @memsharded)
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (5 by maintainers)
Closing the issue now. Thanks @memsharded, I appreciate your time and kindness.
Great! I think the reason is that Conan uses the current directory if not specified for some operations, and it is necessary to explicitly use the
self.recipe_folder
. If you applied it and it worked, then I think we can close the issue, feel free to close it, and if you need further help in the future for the other comments, you can always open a new ticket. Thanks!