realm / realm-swift

Realm is a mobile database: a replacement for Core Data & SQLite
https://realm.io
Apache License 2.0
16.3k stars 2.14k forks source link

ld: library not found for -lrealm-ios #3960

Closed superzcj closed 8 years ago

superzcj commented 8 years ago

Goals

Build the project without having to run a clean

Expected Results

Build to Succeed

Actual Results

Build failed with these errors:

ld: library not found for -lrealm-ios clang: error: linker command failed with exit code 1 (use -v to see invocation)

Ld /Users/zhangchaojie/Library/Developer/Xcode/DerivedData/WMDoctor-fnyjhcfjkdvagqcncvwdxeixyovx/Build/Products/Debug-iphoneos/Realm.framework/Realm normal arm64 cd /Users/zhangchaojie/Documents/Project/WMDoctor/trunk/Pods export IPHONEOS_DEPLOYMENT_TARGET=8.0 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch arm64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk -L/Users/zhangchaojie/Library/Developer/Xcode/DerivedData/WMDoctor-fnyjhcfjkdvagqcncvwdxeixyovx/Build/Products/Debug-iphoneos -L/Users/zhangchaojie/Documents/Project/WMDoctor/trunk/Pods/Realm/core -F/Users/zhangchaojie/Library/Developer/Xcode/DerivedData/WMDoctor-fnyjhcfjkdvagqcncvwdxeixyovx/Build/Products/Debug-iphoneos -filelist /Users/zhangchaojie/Library/Developer/Xcode/DerivedData/WMDoctor-fnyjhcfjkdvagqcncvwdxeixyovx/Build/Intermediates/Pods.build/Debug-iphoneos/Realm.build/Objects-normal/arm64/Realm.LinkFileList -install_name @rpath/Realm.framework/Realm -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -miphoneos-version-min=8.0 -dead_strip -Xlinker -no_deduplicate -fembed-bitcode-marker -lc++ -lrealm-ios -stdlib=libc++ -fapplication-extension -fobjc-arc -fobjc-link-runtime -framework Foundation -single_module -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/zhangchaojie/Library/Developer/Xcode/DerivedData/WMDoctor-fnyjhcfjkdvagqcncvwdxeixyovx/Build/Intermediates/Pods.build/Debug-iphoneos/Realm.build/Objects-normal/arm64/Realm_dependency_info.dat -o /Users/zhangchaojie/Library/Developer/Xcode/DerivedData/WMDoctor-fnyjhcfjkdvagqcncvwdxeixyovx/Build/Products/Debug-iphoneos/Realm.framework/Realm

Steps to Reproduce

Add Realm as a cocoa pod and build the project in another mac

Code Sample

Build errors

Version of Realm and Tooling

Realm version: 1.0.2 Xcode version: 7.3 iOS/OSX version: 9.3.3/swif2.2 Dependency manager + version: cocoapod 0.39.0

stel commented 8 years ago

Thanks for that report, @superzcj!

Do you experience this issue if you perform Clean or Clean Build Directory in Xcode?

superzcj commented 8 years ago

Tried,but the result did not change.

stel commented 8 years ago

Unfortunately I wasn't able to reproduce this issue (with an empty Xcode project), could you please provide us your Podfile and some more steps to reproduce this?

superzcj commented 8 years ago

My Podfile:

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

target "WMDoctor” do
pod 'Alamofire'
pod 'MBProgressHUD', '~> 0.9.2'
pod 'ObjectMapper', '~> 1.3'
#pod 'Argo'
pod 'Kingfisher'
pod 'SnapKit'
pod 'EZSwiftExtensions'
pod 'RealmSwift'
pod 'IQKeyboardManagerSwift'
pod 'MJRefresh'
pod 'SnapKit'
pod 'WebViewJavascriptBridge'
pod 'AwesomeCache'

end

target “WMDoctorTests" do

end

First I update these third-party libraries with 'pod update' in my mac. Then copy the whole project which contain these third-party libraries to another mac . The result is above.

stel commented 8 years ago

Your Podfile looks good to me. How do you copy your project? Please make sure that you copy Pods directory and all it's content as well. Also check /Users/zhangchaojie/Documents/Project/WMDoctor/trunk/Pods/Realm/core folder (I believe it's your second Mac?), does it contain librealm-ios.a?

superzcj commented 8 years ago

Think you very much. You answer remind me. The question has solved. The reason is SVN configuration. In SVN .a file is ignored in the default state. So another mac can not run the project.