line / line-sdk-unity

Provides a modern way of implementing LINE APIs in Unity games, for iOS and Android.
https://developers.line.biz/
Apache License 2.0
118 stars 24 forks source link

iOS Build: Undefined symbols for architecture armv7 after import facebook sdk 7.18 #16

Closed kultie closed 3 years ago

kultie commented 4 years ago

Is it a security issue?

No

What did you do?

Create fresh unity project using unity 2018.2.21f1 Fill in random facebook app id and random channel id for Line SDK Object Build iOS with target 10.0 minimum Using xcproject to build test project

What did you expect?

The build success with no error

What happened actually?

Warning about Could not find auto-linked library

ld: warning: Could not find auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find auto-linked library 'swiftObjectiveC'
ld: warning: Could not find auto-linked library 'swiftFoundation'
ld: warning: Could not find auto-linked library 'swiftMetal'
ld: warning: Could not find auto-linked library 'swiftDarwin'
ld: warning: Could not find auto-linked library 'swiftUIKit'
ld: warning: Could not find auto-linked library 'swiftCore'
ld: warning: Could not find auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find auto-linked library 'swiftDispatch'
ld: warning: Could not find auto-linked library 'swiftQuartzCore'
ld: warning: Could not find auto-linked library 'swiftCoreImage'

And an error

ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Only Line build OK Only Facebook Build OK

Your environment?

Build from Unity 2018.2.21f1 XCode 10.1 Build target iOS 10.0 Facebook SDK 7.18.0 LineSDK 1.0.0

Sample project

https://drive.google.com/file/d/1dK10JyyRc71djlggGO5TL5Eu-GBFosSt/view?usp=sharing Included Unity project and xcode project build folder

onevcat commented 4 years ago

LINE SDK is using Swift, so you need to make sure the ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES is true in your exported Xcode project.

LINE SDK for Unity contains a script to do it automatically, but in your case, it might be overwritten by some other SDK (such as Facebook). Can you check the ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES in your Xcode project Build Setting tab?

onevcat commented 4 years ago

Oh,

I saw your sample project.

It seems that Facebook is using PlayServicesResolver contained in their package to manage the pod dependency.

May I know how did you add the pod 'LineSDKSwift/ObjC', '~> 5.1' to your Podfile? Or is it also managed by the PlayServicesResolver plugin?

LineSDK requires to be built as a dynamic framework instead of a static one now. So maybe you can try to add use_frameworks! to your Podfile. However, I am not sure whether it would break the Facebook integrating or not.

Another easier choice might be using the Carthage instead of CocoaPods when installing LINE SDK. You can find more information from this section: https://developers.line.biz/zh-hant/docs/unity-sdk/project-setup/#installation-on-ios

and change the export method to "Carthage": https://developers.line.biz/zh-hant/docs/unity-sdk/integrate-line-login/#update-player-settings

kultie commented 4 years ago

I didn't touch the pod file so I'm pretty sure it being managed by PlayServicesResolver I also change to export using Carthage and after receive error about invalid option --no-ri --no-rdoc The only thing prevent me from building now is the missing of CFPropertyList-3.0.2 ~I hope so~ /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.2/lib/bundler/spec_set.rb:87:inblock in materialize': Could not find CFPropertyList-3.0.2 in any of the sources (Bundler::GemNotFound)` My gem list

$gem list
*** LOCAL GEMS ***

activesupport (4.2.11.1)
addressable (2.7.0)
algoliasearch (1.27.1)
atomos (0.1.3)
babosa (1.0.3)
bigdecimal (default: 1.4.2)
bundler (2.1.4, default: 2.1.2, 2.0.2)
bundler-unload (1.0.2)
CFPropertyList (3.0.2, 3.0.1)
claide (1.0.3)
cmath (default: 1.0.0)
cocoapods-core (1.8.4)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.3.0)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.4.1)
cocoapods-try (1.1.0)
colored (1.2)
colored2 (3.1.2)
commander-fastlane (4.4.6)
concurrent-ruby (1.1.5)
csv (default: 3.0.9)
date (default: 2.0.0)
dbm (default: 1.0.0)
declarative (0.0.10)
declarative-option (0.1.0)
did_you_mean (1.3.0)
digest-crc (0.4.1)
domain_name (0.5.20190701)
dotenv (2.7.5)
e2mmap (default: 0.1.0)
emoji_regex (1.0.1)
escape (0.0.4)
etc (default: 1.0.1)
excon (0.71.0, 0.70.0)
executable-hooks (1.6.0)
faraday (0.17.1)
faraday-cookie_jar (0.0.6)
faraday_middleware (0.13.1)
fastimage (2.1.7)
fastlane (2.137.0)
fcntl (default: 1.0.0)
fiddle (default: 1.0.0)
fileutils (default: 1.1.0)
forwardable (default: 1.2.0)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gdbm (default: 2.0.0)
gem-wrappers (1.4.0)
gh_inspector (1.1.3)
google-api-client (0.23.9)
google-cloud-core (1.4.1)
google-cloud-env (1.3.0)
google-cloud-storage (1.16.0)
googleauth (0.6.7)
highline (1.7.10)
http-cookie (1.0.3)
httpclient (2.8.3)
i18n (0.9.5)
io-console (default: 0.4.7)
ipaddr (default: 1.2.2)
irb (default: 1.0.0)
json (2.3.0, default: 2.2.0)
jwt (2.1.0)
logger (default: 1.3.0)
matrix (default: 0.1.0)
memoist (0.16.2, 0.16.1)
mime-types (3.3)
mime-types-data (3.2019.1009)
mini_magick (4.9.5)
minitest (5.11.3)
molinillo (0.6.6)
multi_json (1.14.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
mutex_m (default: 0.1.0)
nanaimo (0.2.6)
nap (1.1.0)
naturally (2.2.0)
net-telnet (0.2.0)
netrc (0.11.0)
openssl (default: 2.1.2)
os (1.0.1)
ostruct (default: 0.1.0)
plist (3.5.0)
power_assert (1.1.4)
prime (default: 0.1.0)
psych (default: 3.1.0)
public_suffix (2.0.5)
rake (12.3.2)
rdoc (default: 6.1.0)
reline (default: 0.0.0)
representable (3.0.4)
retriable (3.1.2)
rexml (default: 3.1.9)
rouge (2.0.7)
rss (default: 0.2.8)
ruby-macho (1.4.0)
rubygems-bundler (1.4.5)
rubygems-update (3.1.2)
rubyzip (1.3.0)
rvm (1.11.3.9)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
security (0.1.3)
shell (default: 0.7)
signet (0.12.0)
simctl (1.6.6)
slack-notifier (2.3.2)
stringio (default: 0.0.2)
strscan (default: 1.0.0)
sync (default: 0.5.0)
terminal-notifier (2.0.0)
terminal-table (1.8.0)
test-unit (3.3.3)
thread_safe (0.3.6)
thwait (default: 0.1.0)
tracer (default: 0.1.0)
tty-cursor (0.7.0)
tty-screen (0.7.0)
tty-spinner (0.9.2, 0.9.1)
tzinfo (1.2.5)
uber (0.1.0)
unf (0.1.4)
unf_ext (0.0.7.6)
unicode-display_width (1.6.0)
webrick (default: 1.4.2)
word_wrap (1.0.0)
xcodeproj (1.14.0, 1.13.0)
xcpretty (0.3.0)
xcpretty-travis-formatter (1.0.0)
xmlrpc (0.3.0)
zlib (default: 1.0.0)

I even copy the CFPropertyList 3.0.2 from .rvm from usr/.rvm/gems/ruby-2.7.0-preview1/gems to /Library/Ruby/Gems/2.3.0/gems

onevcat commented 4 years ago

Hi, it seems that you are still using the system ruby instead of the one managed by rvm in your folder. Our Carthage integration requires a local version of Ruby environment. Can you check the ruby version and path you are using (ruby -v and which ruby) in the exported project folder?

onevcat commented 4 years ago

And you can also use gem env in that folder to see the gem environment currently in use.

kultie commented 4 years ago

Sorry for late reply, here are the information inside the exported project folder

=> - current

=* - current && default

* - default

onevcat commented 4 years ago

Oh.

It seems that --no-rdoc and --no-ri are totally removed from gem version 3.

Let me check what I can do and maybe soon we can release a new version.

onevcat commented 4 years ago

@kultie Hey, can you try the version 1.1.1 and see whether it works? You can find it on the release page here: https://github.com/line/line-sdk-unity/releases/tag/1.1.1

kultie commented 4 years ago

@onevcat I just build the project with version 1.1.1 the error about --no-rdoc and --no-ri are gone but the error about missing CFPropertyList-3.0.2 still persist

onevcat commented 4 years ago

Ummm. So there is still something wrong with the Ruby environment but I am not sure what it could be.

Could you navigate to the exported folder and find if there are two files "Gemfile" and "copy_carthage_framework.rb" in that folder?

If there are, you can try to manually execute the command below one by one to make the Xcode project happy. (This is exactly what LINE SDK tries to do after copying the necessary files to the build folder.)

gem install bundler --no-document
bundle install --path vendor/bundle
bundle exec ruby copy_carthage_framework.rb

Please let me know if there are still some errors, and also the log.

kultie commented 4 years ago

Weird everything seem fine

kultie commented 4 years ago

Yeah the project successfully built after run these command with the terminal so I guess I stick to this method for now, but there are anything I can do about this or what unity using during the execution of those commands?

onevcat commented 4 years ago

Thanks for the feedback. I will investigate it deeper to see what is going on.

kultie commented 4 years ago

The carthage option build is a lot slower than pods export on my machine, so if you can, can you also check the

ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

so i can continue using pods export?

onevcat commented 4 years ago

Carthage will build the framework when exporting, so you do not have to build it again in Xcode. While CocoaPods only copies the source code to the project instead of building them (the source will be built with the Xcode project).

Our Carthage integration contains build cache in the target folder, so if you are not doing a full clean export in Unity, but do an append, would boost the build a lot.

For your original issue, as I mentioned, LINE SDK only supports with building as dynamic framework, so you may need use_framework! in the Podfile.

LineSDK requires to be built as a dynamic framework instead of a static one now. So maybe you can try to add use_frameworks! to your Podfile.

kultie commented 4 years ago

Is that the Podfile in exported project? I manually added the use_framework! in it but still same error Current Podfile

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target 'Unity-iPhone' do
pod 'FBSDKCoreKit', '~> 5.2'
pod 'FBSDKLoginKit', '~> 5.2'
pod 'FBSDKShareKit', '~> 5.2'
pod 'LineSDKSwift/ObjC', '~> 5.1'
end

Or there anything I don't know?

onevcat commented 4 years ago

Yes. After that, you need to run pod install in the folder.