LiquidPlayer / LiquidCore

Node.js virtual machine for Android and iOS
MIT License
1.01k stars 127 forks source link

iOS build faild #160

Closed pantaopt closed 4 years ago

pantaopt commented 4 years ago

image image

xcode: 11.4 macos: 10.15.4

pantaopt commented 4 years ago

LiquidCore version: 0.7.3 Cocoapods version: 1.9.0

ericwlange commented 4 years ago

This is an incredibly strange set of symbols to be undefined (and just those?). Very odd.

I cannot reproduce this. What does your podfile look like?

pantaopt commented 4 years ago

@ericwlange Thank you for your response. This is happened on my office iMac, build is ok on myself macbookpro. The content of Podfile sent as an screenshot.

susieyy commented 4 years ago

Hi, there. Thanks for developing a great library.

I had the same problem. My environment is as follows.

load '.liquidcore/liquidcore.rb'
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'LiquidCoreTest' do
  # liquidcore_pods
  pod 'LiquidCore', git: 'https://github.com/LiquidPlayer/LiquidCore.git', commit: 'HEAD'

  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for LiquidCoreTest

  target 'LiquidCoreTestTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'LiquidCoreTestUITests' do
    # Pods for testing
  end

end
davidgdoyle commented 3 years ago

I've also run into this issue, and I think I finally have a satisfactory reason why it failed in the first place and what to do about it.

I spotted this in the pod install --verbose log when attempting to use this module via a Flutter plugin, after a day or so of banging my head against the problem:

 > Running prepare command
   $ /bin/bash -c  set -e bash LiquidCore/src/ios/generate_node_javascript.sh
   bash LiquidCore/src/ios/generate_javascript_polyfills.sh bash
   LiquidCore/src/ios/copy_headers.sh
   Traceback (most recent call last):
     File "tools/js2c.py", line 365, in <module>
       main()
     File "tools/js2c.py", line 362, in main
       JS2C(source_files, [natives])
     File "tools/js2c.py", line 294, in JS2C
       (consts, macros) = ReadMacros(macro_lines)
     File "tools/js2c.py", line 167, in ReadMacros
       args = map(string.strip, macro_match.group(2).split(','))
   AttributeError: module 'string' has no attribute 'strip'
   generated: /Users/dd/Library/Caches/CocoaPods/Pods/Release/LiquidCore/0.7.10-fadf5/LiquidCore/src/ios/gen/node_javascript.cc
   Generated javascript polyfill: /Users/dd/Library/Caches/CocoaPods/Pods/Release/LiquidCore/0.7.10-fadf5/LiquidCore/src/ios/gen/polyfill.c
   Copied headers to: /Users/dd/Library/Caches/CocoaPods/Pods/Release/LiquidCore/0.7.10-fadf5/LiquidCore/src/ios/gen/include
  > Copying LiquidCore from
  `/Users/dd/Library/Caches/CocoaPods/Pods/Release/LiquidCore/0.7.10-fadf5` to
  `Pods/LiquidCore`

This looks to be a python 2.7 vs python 3 error being emitted from the prepare_command step in the Pod install script. Resolving it is simple - make sure you change to use a global python 2.7 version instead. If you're seeing this on macOS, this is probably (but not strictly) down to using pyenv to use a python 3 script environment; just switch to using the system version instead.

Doing so causes all the scripts in the prepare_command to be executed completely. As a suggestion for this issue, it would be good to get the pod installation to fail with a proper error message explaining the python environment isn't right - for anyone affected by it however, it is at least simple to work around.

You will need to clean the Cocoapods cache directory and rebuild the pod after switching to python 2.7:

pod cache clean 'LiquidCore'
pod cache clean 'LiquidCore' --all
pod install
bill19 commented 1 year ago

That's right! Thank you, brother

setting path for python 2.7 to .bash_profile

PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}" export PATH alias python="/Library/Frameworks/Python.framework/Versions/2.7/bin/python"

If you are a chip of m1, you need to download python 2.7.18 in advance!!!!!

**【非常重要】1.需要提前下载python2.7.18 !!这一点非常重要,然后确定python2.7.18可以正常在你的环境上运行起来

flutter 删掉你工程下的 pubspec.lock 删掉你的ios目录下的Podfile.lock fluuter clean

pod cache clean 'LiquidCore' pod cache clean 'LiquidCore' --all pod install