首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Xcode 10框架依赖周期

Xcode 10框架依赖周期
EN

Stack Overflow用户
提问于 2018-10-09 15:24:40
回答 3查看 6.1K关注 0票数 13

在Xcode 10上,当我执行增量构建(清理构建工作)时,我的框架之一出现了这个构建错误:

代码语言:javascript
运行
复制
Showing All Messages
:-1: Cycle inside LoggingSharedFramework; building could produce unreliable results.
Cycle details:
→ Target 'LoggingSharedFramework' has a command with output 'blablabla/Build/Products/Debug-iphonesimulator/LoggingSharedFramework.framework/LoggingSharedFramework'
○ Target 'LoggingSharedFramework' has link command with output 'blablabla/Build/Intermediates.noindex/blablablah/Debug-iphonesimulator/LoggingSharedFramework.build/Objects-normal/x86_64/LoggingSharedFramework'
  • 该框架没有目标依赖项。
  • 头阶段在编译源代码之前。
  • 我已经检查了每个文件,并确保在LoggingSharedFramework之外没有任何导入抓取文件( Cocoa以外的东西除外)。
  • 我没有使用任何依赖关系管理系统(例如迦太基),因为没有外部依赖关系。这个框架是在项目中维护的。

这个错误对我来说毫无意义。真正的原因是什么?我怎样才能弄清楚是什么引入了循环?我怎么才能修好这个循环?

下面是我获得的调试构建日志:

代码语言:javascript
运行
复制
Build system information
error: target:  ->

node: <all> ->

command: <all> ->

node: .../DerivedData/MyApp/Build/Products/Debug-iphoneos/LoggingSharedFramework.framework/LoggingSharedFramework ->

command: 60cc809630:Debug:CreateUniversalBinary .../DerivedData/MyApp/Build/Products/Debug-iphoneos/LoggingSharedFramework.framework/LoggingSharedFramework normal armv7 arm64 ->

node: .../DerivedData/MyApp/Build/Intermediates.noindex/MyApp.build/Debug-iphoneos/LoggingSharedFramework.build/Objects-normal/armv7/LoggingSharedFramework ->

command: 60cc809630:Debug:Ld .../DerivedData/MyApp/Build/Intermediates.noindex/MyApp.build/Debug-iphoneos/LoggingSharedFramework.build/Objects-normal/armv7/LoggingSharedFramework normal armv7 ->

node: .../DerivedData/MyApp/Build/Products/Debug-iphoneos/LoggingSharedFramework.framework/LoggingSharedFramework

** BUILD FAILED **

我想那里有一个循环,但我不明白它为什么存在,也不明白如何修复它。它看起来像是某个中间对象上的Ld依赖于编译的框架?这对我来说毫无意义。

我以前认为我已经通过移动我的标题构建阶段,修复雨伞标题警告,清理我的构建来修复这个问题。但事实证明,这只是暂时的解决办法。这个问题似乎是随机出现的,一旦Xcode检测到一个循环,它就不会消失,直到我再次清理。然后它就会消失一段时间,进入某个未知的原因,把它带回来。

EN

回答 3

Stack Overflow用户

发布于 2018-10-12 14:18:00

在这种情况下,我将采取以下步骤:

如果在更大的项目中维护LoggingSharedFramework目标:

  1. 将其分离为单独的项目
  2. 从包含项目中删除所有LoggingSharedFramework文件和导入
  3. 构建框架并将其作为嵌入式框架添加到项目中
  4. 检查错误是否仍然存在

如果LoggingSharedFramework已经是一个单独的项目:

  1. 检查每个文件并删除所有不必要的导入(包括Cocoa内容)
  2. 检查linking阶段和相关的构建脚本,并删除所有不必要的内容

这也是值得尝试的启用/禁用并行生成

我想,你已经经历过这一切了,祝你好运!

票数 0
EN

Stack Overflow用户

发布于 2019-03-16 16:40:11

我已经遇到过几次这个错误,但这才是对我有用的。

1)我转到Xcode -> Preferences ->位置,清除所有派生数据并关闭Xcode。

2)如果使用可可荚,则删除工作区即(.xcworkspace)文件和Podile/目录

3)导航到您的项目并运行吊舱安装。

4)通过Xcode、清理和构建打开您的项目。

5)运行项目,一切都应该正常工作。

票数 0
EN

Stack Overflow用户

发布于 2019-03-18 13:20:33

我的猜测是,LoggingSharedFramework并不是作为一个包含所有可用架构的fat框架正确构建的。在构建框架时尝试这个post。

代码语言:javascript
运行
复制
exec > /tmp/${PROJECT_NAME}_archive.log 2>&1

UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal

if [ "true" == ${ALREADYINVOKED:-false} ]
then
echo "RECURSION: Detected, stopping"
else
export ALREADYINVOKED="true"

# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
#mkdir -p "${UNIVERSAL_OUTPUTFOLDER}/${TARGET_NAME}.framework" 

echo "Building for iPhoneSimulator"
xcodebuild -workspace "${WORKSPACE_PATH}" -scheme "${TARGET_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone XS' ONLY_ACTIVE_ARCH=NO ARCHS='i386 x86_64' BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" ENABLE_BITCODE=YES OTHER_CFLAGS="-fembed-bitcode" BITCODE_GENERATION_MODE=bitcode clean build

# Step 1. Copy the framework structure (from iphoneos build) to the universal folder
echo "Copying to output folder"
cp -R "${ARCHIVE_PRODUCTS_PATH}${INSTALL_PATH}/" "${UNIVERSAL_OUTPUTFOLDER}"

# Step 2. Copy Swift modules from iphonesimulator build (if it exists) to the copied framework directory
SIMULATOR_SWIFT_MODULES_DIR="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${TARGET_NAME}.framework/Modules/${TARGET_NAME}.swiftmodule/."
if [ -d "${SIMULATOR_SWIFT_MODULES_DIR}" ]; then
cp -R "${SIMULATOR_SWIFT_MODULES_DIR}" "${UNIVERSAL_OUTPUTFOLDER}/${TARGET_NAME}.framework/Modules/${TARGET_NAME}.swiftmodule"
fi

# Step 3. Create universal binary file using lipo and place the combined executable in the copied framework directory
echo "Combining executables"
lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${EXECUTABLE_PATH}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${EXECUTABLE_PATH}" "${ARCHIVE_PRODUCTS_PATH}${INSTALL_PATH}/${EXECUTABLE_PATH}"

echo "Combining executables end"

# Step 4. Create universal binaries for embedded frameworks
for SUB_FRAMEWORK in $( ls "${UNIVERSAL_OUTPUTFOLDER}/${TARGET_NAME}.framework/Frameworks" ); do
BINARY_NAME="${SUB_FRAMEWORK%.*}"
echo "${ARCHIVE_PRODUCTS_PATH}${INSTALL_PATH}/${TARGET_NAME}.framework/Frameworks/${SUB_FRAMEWORK}/${BINARY_NAME}"
lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${TARGET_NAME}.framework/Frameworks/${SUB_FRAMEWORK}/${BINARY_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${SUB_FRAMEWORK}/${BINARY_NAME}" "${ARCHIVE_PRODUCTS_PATH}${INSTALL_PATH}/${TARGET_NAME}.framework/Frameworks/${SUB_FRAMEWORK}/${BINARY_NAME}"
done

# Step 5. Convenience step to copy the framework to the project's directory
echo "Copying to project dir"
yes | cp -Rf "${UNIVERSAL_OUTPUTFOLDER}/${FULL_PRODUCT_NAME}" "${PROJECT_DIR}"

open "${PROJECT_DIR}"

fi
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52724480

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档