POD安装在Flutter IOS项目中提供基本64:无效输入
停机后,我试图在没有成功的情况下为iOS构建我的Flutter应用程序。 pod intall
给我以下输出(即使在清洁Xcode工作区之后):
$ pod install
Analyzing dependencies
cloud_firestore: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
firebase_analytics: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
Warning: firebase_app_id_file.json file does not exist. This may cause issues in upload-symbols. If this error is unexpected, try running flutterfire configure again.
firebase_crashlytics: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
firebase_dynamic_links: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
firebase_messaging: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
firebase_remote_config: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
firebase_storage: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
Downloading dependencies
Installing AppAuth (1.5.0)
Installing BoringSSL-GRPC (0.0.24)
[!] /opt/homebrew/bin/bash -c
set -e
set -e
# Add a module map and an umbrella header
mkdir -p src/include/openssl
cat > src/include/openssl/umbrella.h <<EOF
#include "ssl.h"
#include "crypto.h"
#include "aes.h"
/* The following macros are defined by base.h. The latter is the first file included by the
other headers. */
#if defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64)
# include "arm_arch.h"
#endif
#include "asn1.h"
#include "asn1_mac.h"
#include "asn1t.h"
#include "blowfish.h"
#include "cast.h"
#include "chacha.h"
#include "cmac.h"
#include "conf.h"
#include "cpu.h"
#include "curve25519.h"
#include "des.h"
#include "dtls1.h"
#include "hkdf.h"
#include "md4.h"
#include "md5.h"
#include "obj_mac.h"
#include "objects.h"
#include "opensslv.h"
#include "ossl_typ.h"
#include "pkcs12.h"
#include "pkcs7.h"
#include "pkcs8.h"
#include "poly1305.h"
#include "rand.h"
#include "rc4.h"
#include "ripemd.h"
#include "safestack.h"
#include "srtp.h"
#include "x509.h"
#include "x509v3.h"
EOF
cat > src/include/openssl/BoringSSL.modulemap <<EOF
framework module openssl {
umbrella header "umbrella.h"
textual header "arm_arch.h"
export *
module * { export * }
}
EOF
# To avoid symbol conflict with OpenSSL, gRPC needs to rename all the BoringSSL symbols with a
# prefix. This is done with BoringSSL's BORINGSSL_PREFIX mechanism
# (https://github.com/google/boringssl/blob/75148d7abf12bdd1797fec3c5da9a21963703516/BUILDING.md#building-with-prefixed-symbols).
# The required prefix header file boringssl_prefix_symbols.h is not part of BoringSSL repo at
# this moment. It has to be generated by BoringSSL's users and be injected to BoringSSL build.
# gRPC generates this file in script /tools/distrib/upgrade_boringssl_objc.sh. This script
# outputs a gzip+base64 encoded version of boringssl_prefix_symbols.h because of Cocoapods'
# limit on the 'prepare_command' field length. The encoded header is generated from
# /src/boringssl/boringssl_prefix_symbols.h. Here we decode the content and inject the header to
# the correct location in BoringSSL.
case "$(uname)" in
Darwin) opts="" ;;
*) opts="--ignore-garbage" ;;
esac
base64 --decode $opts <<EOF | gunzip > src/include/openssl/boringssl_prefix_symbols.h
*** SNIP: long base 64 string ***
EOF
# We are renaming openssl to openssl_grpc so that there is no conflict with openssl if it exists
find . -type f \( -path '*.h' -or -path '*.cc' -or -path '*.c' \) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include <openssl/;#include <openssl_grpc/;g'
# Include of boringssl_prefix_symbols.h does not follow Xcode import style. We add the package
# name here so that Xcode knows where to find it.
find . -type f \( -path '*.h' -or -path '*.cc' -or -path '*.c' \) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include <boringssl_prefix_symbols.h>;#include <openssl_grpc/boringssl_prefix_symbols.h>;g'
base64: invalid input
gunzip: (stdin): unexpected end of file
如果我从上面的输出中复制base64字符串,并通过base64 -decode
我执行获取相同的错误(无效输入“:
cat base64.txt | base64 --decode
�boringssl_prefix_symbols.h��]s۸�h��W��ܩ:5;�n�base64: invalid input
我不知道这是我的环境,可可录,boringssl-grpc或依靠它的东西的问题(也许是firebase软件包之一?)指针
硬件:Mac mini M1 Cocoapods:1.11.3来自Homebrew 扑来医生:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.1, on macOS 12.4 21F79 darwin-arm, locale en-SE)
[✗] Android toolchain - develop for Android devices
✗ ANDROID_HOME = /Users/tjarvstrand/Android/Sdk
but Android SDK not found at this location.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2021.1)
[!] Android Studio
✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Community Edition (version 2021.3.3)
[✓] VS Code (version 1.67.2)
[✓] VS Code (version 1.66.2)
[✓] Connected device (1 available)
[✓] HTTP Host Availability
! Doctor found issues in 3 categories.
After some downtime I'm trying to build my Flutter app for iOS without success. pod intall
gives me the following output (even after cleaning the XCode workspace):
$ pod install
Analyzing dependencies
cloud_firestore: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
firebase_analytics: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
Warning: firebase_app_id_file.json file does not exist. This may cause issues in upload-symbols. If this error is unexpected, try running flutterfire configure again.
firebase_crashlytics: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
firebase_dynamic_links: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
firebase_messaging: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
firebase_remote_config: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
firebase_storage: Using Firebase SDK version '8.15.0' defined in 'firebase_core'
Downloading dependencies
Installing AppAuth (1.5.0)
Installing BoringSSL-GRPC (0.0.24)
[!] /opt/homebrew/bin/bash -c
set -e
set -e
# Add a module map and an umbrella header
mkdir -p src/include/openssl
cat > src/include/openssl/umbrella.h <<EOF
#include "ssl.h"
#include "crypto.h"
#include "aes.h"
/* The following macros are defined by base.h. The latter is the first file included by the
other headers. */
#if defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64)
# include "arm_arch.h"
#endif
#include "asn1.h"
#include "asn1_mac.h"
#include "asn1t.h"
#include "blowfish.h"
#include "cast.h"
#include "chacha.h"
#include "cmac.h"
#include "conf.h"
#include "cpu.h"
#include "curve25519.h"
#include "des.h"
#include "dtls1.h"
#include "hkdf.h"
#include "md4.h"
#include "md5.h"
#include "obj_mac.h"
#include "objects.h"
#include "opensslv.h"
#include "ossl_typ.h"
#include "pkcs12.h"
#include "pkcs7.h"
#include "pkcs8.h"
#include "poly1305.h"
#include "rand.h"
#include "rc4.h"
#include "ripemd.h"
#include "safestack.h"
#include "srtp.h"
#include "x509.h"
#include "x509v3.h"
EOF
cat > src/include/openssl/BoringSSL.modulemap <<EOF
framework module openssl {
umbrella header "umbrella.h"
textual header "arm_arch.h"
export *
module * { export * }
}
EOF
# To avoid symbol conflict with OpenSSL, gRPC needs to rename all the BoringSSL symbols with a
# prefix. This is done with BoringSSL's BORINGSSL_PREFIX mechanism
# (https://github.com/google/boringssl/blob/75148d7abf12bdd1797fec3c5da9a21963703516/BUILDING.md#building-with-prefixed-symbols).
# The required prefix header file boringssl_prefix_symbols.h is not part of BoringSSL repo at
# this moment. It has to be generated by BoringSSL's users and be injected to BoringSSL build.
# gRPC generates this file in script /tools/distrib/upgrade_boringssl_objc.sh. This script
# outputs a gzip+base64 encoded version of boringssl_prefix_symbols.h because of Cocoapods'
# limit on the 'prepare_command' field length. The encoded header is generated from
# /src/boringssl/boringssl_prefix_symbols.h. Here we decode the content and inject the header to
# the correct location in BoringSSL.
case "$(uname)" in
Darwin) opts="" ;;
*) opts="--ignore-garbage" ;;
esac
base64 --decode $opts <<EOF | gunzip > src/include/openssl/boringssl_prefix_symbols.h
*** SNIP: long base 64 string ***
EOF
# We are renaming openssl to openssl_grpc so that there is no conflict with openssl if it exists
find . -type f \( -path '*.h' -or -path '*.cc' -or -path '*.c' \) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include <openssl/;#include <openssl_grpc/;g'
# Include of boringssl_prefix_symbols.h does not follow Xcode import style. We add the package
# name here so that Xcode knows where to find it.
find . -type f \( -path '*.h' -or -path '*.cc' -or -path '*.c' \) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include <boringssl_prefix_symbols.h>;#include <openssl_grpc/boringssl_prefix_symbols.h>;g'
base64: invalid input
gunzip: (stdin): unexpected end of file
If I copy the base64 string from the output above and run it through base64 --decode
I do get the same error (invalid input":
cat base64.txt | base64 --decode
�boringssl_prefix_symbols.h��]s۸�h��W��ܩ:5;�n�base64: invalid input
I have no idea if this is an issue with my environment, cocoapods, BoringSSL-GRPC or something that depends on it (one of the firebase packages maybe?). Would really appreciate if anyone has any pointers.
Environment
Hardware: Mac mini M1
Cocoapods: 1.11.3 from Homebrew
Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.1, on macOS 12.4 21F79 darwin-arm, locale en-SE)
[✗] Android toolchain - develop for Android devices
✗ ANDROID_HOME = /Users/tjarvstrand/Android/Sdk
but Android SDK not found at this location.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2021.1)
[!] Android Studio
✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Community Edition (version 2021.3.3)
[✓] VS Code (version 1.67.2)
[✓] VS Code (version 1.66.2)
[✓] Connected device (1 available)
[✓] HTTP Host Availability
! Doctor found issues in 3 categories.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过一番彻底的挖掘,事实证明,这是由于我在系统上安装了GNU Coreutils,因此安装使用了不兼容的base64命令。
编辑:要澄清,设置了我的
路径
环境变量,以便base64
称为命令的GNU版本,该版本不喜欢Cocapods通过的输入参数。我通过更改路径
来解决问题,以便调用Systembase64
命令。在这种情况下,不确定它们是如何/为什么不兼容的,但这解决了我的问题。After some thorough digging, it turns out that this was due to me having GNU coreutils installed on my system, so the installation was using an incompatible base64 command.
EDIT: To clarify, my
PATH
environment variable was set up so thatbase64
called the GNU version of the command which did not like the input arguments passed by Cocapods. I solved my problem by changing myPATH
so that the systembase64
command was invoked instead. Not sure exactly how/why they are incompatible in this case but this fixed my issue.因此,在给定解决方案的基础上,这所包含的内容是评论
〜/.bash_profile
或〜/.zshrc
(取决于您使用的内容) :执行此编辑后,请不要忘记执行
source〜/.bash_profile
或source〜/.zshrc
在重试安装POD之前。基本上,在此过程之前,
哪个base64
将打印:/opt/opt/homebrew/opt/coreutils/libexec/libexec/gnubin/base64
,但是,在此过程之后,
哪个base64
将打印此:/usr/bin/base64
So, building upon the given solution, what this translates to is commenting the following lines inside your
~/.bash_profile
or~/.zshrc
(depending to what you are using):After doing this editing, do not forget to execute
source ~/.bash_profile
orsource ~/.zshrc
before retrying to install the pods.Basically, before this procedure,
which base64
would print:/opt/homebrew/opt/coreutils/libexec/gnubin/base64
But, after this procedure,
which base64
would print this instead:/usr/bin/base64