Cocoapods OpenCV 2.4.10链接器错误 [英] Cocoapods OpenCV 2.4.10 Linker Error

查看:315
本文介绍了Cocoapods OpenCV 2.4.10链接器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用OpenCV 2.4.10构建一个简单的项目但是我得到了一堆这样的错误:

I'm trying to build a simple project using OpenCV 2.4.10 but I get a bunch of errors like this:


Undefined symbols for architecture x86_64:
  "_jpeg_free_large", referenced from:
      _free_pool in opencv2(jmemmgr.o)
  "_jpeg_free_small", referenced from:
      _free_pool in opencv2(jmemmgr.o)
      _self_destruct in opencv2(jmemmgr.o)

这是ViewController.m

Here is ViewController.m

#import "ViewController.h"
#import <opencv2/opencv.hpp>

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    cv::Mat greyMat;
}

Podfile

platform :ios, '8.1'

pod 'OpenCV', '2.4.10'

当我使用版本2.4.9.1或2.4.9时,项目构建正常。

我也能够使用从URL下载的框架文件构建此项目我在podspec 2.4.10中找到了。

Project builds just fine when I use version 2.4.9.1 or 2.4.9.
I was also able to build this project with framework file downloaded from URL which I found in podspec 2.4.10.

推荐答案

我已将新版本的OpenCV添加到CocoaPods(2.4.11,2.4.12,2.4.12.3,3.0) .0)。

I've added the new versions of OpenCV to CocoaPods (2.4.11, 2.4.12, 2.4.12.3, 3.0.0).

2.4.11,2.4.12和2.4.12.3需要链接libjpeg,所以现在pod实际下载了repo,从源代码编译,然后链接libjpeg以及opencv2.framework文件。现在通过CocoaPods开箱即用,但是在执行 pod install 时需要一段时间,因为它是从源代码编译的。只要确保在它执行时不取消它(CocoaPods中有一个错误,导致如果它被取消,则会出现问题。)

2.4.11, 2.4.12, and 2.4.12.3 need libjpeg to be linked, so now the pod actually downloads the repo, compiles from source, and then links libjpeg in addition to the opencv2.framework file. This works out of the box now through CocoaPods, however it takes a while when doing pod install since it's compiling from source. Just make sure not to cancel it while it's doing that (there's a bug in CocoaPods that causes issues if it's canceled).

在底层,3.0.0与预先构建的opencv2.framework文件一样,现在可以通过CocoaPods安装得很好。

Under the hood, 3.0.0 works just like before with the prebuilt opencv2.framework file and can now be installed just fine through CocoaPods.

版本2.4.10在CocoaPods中仍然被破坏,但由于该版本在我的机器上从源代码编译时会抛出错误,所以我无能为力。

Version 2.4.10 is still broken in CocoaPods, but since that version throws errors while compiling from source on my machine, there's not much I can do.

(注意:我不是pod的原始维护者,我只提供了这些新版本。)

(Note: I am not the original maintainer of the pod, I merely contributed these new versions.)

这篇关于Cocoapods OpenCV 2.4.10链接器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆