gpt4 book ai didi

ios - React Native 与 Google VR SDK 不兼容

转载 作者:可可西里 更新时间:2023-11-01 05:49:25 24 4
gpt4 key购买 nike

当我尝试添加 Google VR SDK 时,我遇到了 React Native 的问题('GVRSDK') 作为 Podfile 依赖项,并且很容易复制。

步骤:

  1. 创建一个新的空白 React Native 项目。使用 react-native run-ios 运行它以确保它有效。
  2. cd ios
  3. pod 初始化
  4. 添加pod 'GVRSDK'到Podfile,执行pod update
  5. cd ..
  6. react-native run-ios

项目因以下错误而崩溃:

duplicate symbol __ZN3fLI9FLAGS_novE in:
/foo/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(vlog_is_on.o)
/foo/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(vlog_is_on.o)
duplicate symbol __ZN3fLI7FLAGS_vE in:
/foo/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(vlog_is_on.o)
/foo/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(vlog_is_on.o)
duplicate symbol __ZN6google13RemoveLogSinkEPNS_7LogSinkE in:
/foo/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(logging.o)
/foo/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(logging.o)
duplicate symbol __ZN6google10AddLogSinkEPNS_7LogSinkE in:
/foo/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(logging.o)
/foo/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(logging.o)
ld: 4 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)



** BUILD FAILED **


The following build commands failed:

Ld build/Build/Products/Debug-iphonesimulator/foo.app/foo normal x86_64
(1 failure)

最佳答案

您可以通过删除 libGVRSDK.a 中的重复符号来解决它。lipoar 命令用于将多个架构中的库文件反汇编并重新归档到另一个文件中。

我制作的shell脚本如下:

pod_post_install.sh

#!/bin/bash

cd ./Pods/GVRSDK/Libraries/
lipo -info libGVRSDK.a

# Divide to each platform
lipo -thin armv7 libGVRSDK.a -output libGVRSDK_armv7
lipo -thin i386 libGVRSDK.a -output libGVRSDK_i386
lipo -thin x86_64 libGVRSDK.a -output libGVRSDK_x86_64
lipo -thin arm64 libGVRSDK.a -output libGVRSDK_arm64

# Delete duplicate file
chmod 777 libGVRSDK_armv7
chmod 777 libGVRSDK_i386
chmod 777 libGVRSDK_x86_64
chmod 777 libGVRSDK_arm64

ar -dv libGVRSDK_armv7 vlog_is_on.o
ar -dv libGVRSDK_i386 vlog_is_on.o
ar -dv libGVRSDK_x86_64 vlog_is_on.o
ar -dv libGVRSDK_arm64 vlog_is_on.o

# rm libGVRSDK.a
lipo -create libGVRSDK_armv7 libGVRSDK_i386 libGVRSDK_x86_64 libGVRSDK_arm64 -output libGVRSDK.a

# Delete media
rm libGVRSDK_armv7
rm libGVRSDK_i386
rm libGVRSDK_x86_64
rm libGVRSDK_arm64

cd ../../../

如果在每个 pod install 运行时调用此脚本,它会更有用。

播客文件

post_install do |installer|
system(". ./pod_post_install.sh")
end

我相信它会有所帮助。

关于ios - React Native 与 Google VR SDK 不兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44838800/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com