Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't build project after adding framework #66

Closed
jsb04 opened this issue Nov 20, 2014 · 9 comments
Closed

can't build project after adding framework #66

jsb04 opened this issue Nov 20, 2014 · 9 comments

Comments

@jsb04
Copy link

jsb04 commented Nov 20, 2014

I've added the framework to a new x code 6.1 project targeting iPhone with objective C and tried to build it for iphone5 simulator but - but I still get build issues I can't seem to solve or avoid. Log below. Ultimately I'd like to use it in an iPad app with swift but from another issue I thought the above configuration would be the easiest way to get started initially. How can I solve these issues?

Thanks
Josh

Ld /Users/Josh/Library/Developer/Xcode/DerivedData/ClubMembership-fqjdchajssebyhdwivvuwtxvclnu/Build/Products/Debug-iphonesimulator/ClubMembership.app/ClubMembership normal i386
cd /Users/Josh/Documents/ClubMembership
export IPHONEOS_DEPLOYMENT_TARGET=8.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/Josh/Library/Developer/Xcode/DerivedData/ClubMembership-fqjdchajssebyhdwivvuwtxvclnu/Build/Products/Debug-iphonesimulator -F/Users/Josh/Library/Developer/Xcode/DerivedData/ClubMembership-fqjdchajssebyhdwivvuwtxvclnu/Build/Products/Debug-iphonesimulator -F/Users/Josh/Documents/ClubMembership -filelist /Users/Josh/Library/Developer/Xcode/DerivedData/ClubMembership-fqjdchajssebyhdwivvuwtxvclnu/Build/Intermediates/ClubMembership.build/Debug-iphonesimulator/ClubMembership.build/Objects-normal/i386/ClubMembership.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.1 -framework TesseractOCR -Xlinker -dependency_info -Xlinker /Users/Josh/Library/Developer/Xcode/DerivedData/ClubMembership-fqjdchajssebyhdwivvuwtxvclnu/Build/Intermediates/ClubMembership.build/Debug-iphonesimulator/ClubMembership.build/Objects-normal/i386/ClubMembership_dependency_info.dat -o /Users/Josh/Library/Developer/Xcode/DerivedData/ClubMembership-fqjdchajssebyhdwivvuwtxvclnu/Build/Products/Debug-iphonesimulator/ClubMembership.app/ClubMembership

Undefined symbols for architecture i386:
"std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::find(char, unsigned long) const", referenced from:
tesseract::TessLangModel::IsLeadingPunc(int) in TesseractOCR
tesseract::TessLangModel::IsTrailingPunc(int) in TesseractOCR
tesseract::TessLangModel::IsDigit(int) in TesseractOCR
tesseract::WordSizeModel::Init(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::1::allocator > const&) in TesseractOCR
"std::1::basic_string<char, std::1::char_traits, std::1::allocator >::compare(char const) const", referenced from:
tesseract::CubeObject::Recognize(tesseract::LangModel
, bool) in TesseractOCR
tesseract::CubeRecoContext::Load(tesseract::TessdataManager
, UNICHARSET
) in TesseractOCR
tesseract::CubeSearchObject::CubeSearchObject(tesseract::CubeRecoContext
, tesseract::CharSamp
) in TesseractOCR
tesseract::CubeSearchObject::CubeSearchObject(tesseract::CubeRecoContext, tesseract::CharSamp) in TesseractOCR
tesseract::CubeSearchObject::CharSample(int, int) in TesseractOCR
tesseract::CubeTuningParams::Load(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in TesseractOCR
tesseract::TessLangModel::TessLangModel(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::1::allocator > const&, bool, tesseract::TessdataManager, tesseract::CubeRecoContext) in TesseractOCR
...
"std::__1::__vector_base_common::__throw_length_error() const", referenced from:
void std::__1::vector<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > >::__push_back_slow_path<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&&) in TesseractOCR
std::__1::vector<float, std::__1::allocator >::vector(unsigned long, float const&) in TesseractOCR
std::__1::vector<float, std::__1::allocator >::vector(unsigned long) in TesseractOCR
std::__1::vector<float, std::__1::allocator >::__append(unsigned long, float const&) in TesseractOCR
std::__1::vector<tesseract::NeuralNet*, std::__1::allocatortesseract::NeuralNet* >::__append(unsigned long, t

@kevincon
Copy link
Collaborator

Are you using Cocoa Pods or did you add the framework manually? If you're using Cocoa Pods, are you using version 2.2 of the library or the latest from the Github repo?

@jsb04
Copy link
Author

jsb04 commented Nov 20, 2014

I downloaded the zip from github and drag & dropped TesseractOCR.framework into my project. I tried using Cocoapods earlier but I haven't used cocoapods before and it didn't seem to add the framework to my project and I wasn't sure the problem was. Which would you recommend ?

@kevincon
Copy link
Collaborator

Definitely the easiest method is to use CocoaPods (I'd recommend the development version of the Tesseract wrapper library for now since it has more functionality, just the one downside that it won't work with the iPhone 5S and newer simulators). See the README in this repo for the right line to add to your Podfile.

Also make sure after running "pod install" to install the Tesseract library you open the ".xcworkspace" file instead of the ".xcodeproject". The framework will appear in the new Pods subproject in the workspace, and it will be automatically configured so everything should just work in your project if you add #import <TesseractOCR/TesseractOCR.h> to the header file of wherever you're trying to use the library in your project.

I highly recommend following the CocoaPods guide if you're new to CocoaPods: http://guides.cocoapods.org/using/using-cocoapods.html

If you want to manually add the framework to your project, make sure you also follow the other instructions listed in the README in this repo for manually adding the framework to the project. In particular, I believe the errors you are getting are a result of not linking in the "libstdc++.6.0.9.dylib" library. But again, see the README and make sure you've followed all of those instructions.

@jsb04
Copy link
Author

jsb04 commented Nov 20, 2014

Thanks Kevin, I've been working through things. The problem with cocopods seems to be that when I run Pods Install I get this error:
Analyzing dependencies
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/pathname.rb:422:in `open': No such file or directory - /Users/Josh/.cocoapods/repos (Errno::ENOENT)
I haven't been able to find a way to fix that - any suggestions?

@kevincon
Copy link
Collaborator

Try following the suggestion in the comment on this Stack Overflow post: http://stackoverflow.com/questions/26990057/cocoapods-commands-fail-due-to-no-such-file-or-directory-dir-initialize-us

@jsb04
Copy link
Author

jsb04 commented Nov 20, 2014

Thanks again Kevin, once I fixed up the cocoa pods specs repository issue I was able to successfully read my first image. Had to create a bridging header for swift and import the lib like this:
#import "../Pods/Headers/Public/TesseractOCRiOS/TesseractOCR.h"
which while it worked I wondered if there should had been a path added somewhere that wasn't setup correctly?

@kevincon
Copy link
Collaborator

So #import <TesseractOCR/TesseractOCR.h> in the bridging header doesn't work but the relative path import does work? If so, yeah that sounds like a path-related issue. I have not used Swift with CocoaPods before, but this blog post suggests that what you did is all you have to do: https://medium.com/@stigi/swift-cocoapods-da09d8ba6dd2

Now that CocoaPods is cooperating, you could try nuking your current project and starting over from a fresh project/folder (using the CocoaPod from the get-go) to see if the issue persists.

@jsb04
Copy link
Author

jsb04 commented Nov 20, 2014

Yeah, the relative path worked fine. I started the project from scratch once cocoa pods was working so guess I'll just live with it how it is. Thanks for your help.

@kevincon
Copy link
Collaborator

Okay, I'm glad you got it working. Could you close this issue when you get a chance?

@jsb04 jsb04 closed this as completed Nov 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants