opencv 4.0 + linux + cuda静态编译
#下载最新的opencv
git clone "https://github.com/opencv/opencv.git"
git clone "https://github.com/opencv/opencv_contrib.git"
#定义自己的生成目录
mkdir 20190509_cuda
mkdir -p opencv-master/build_cuda
cd opencv-master/build_cuda
#生成配置的时候选择带上opencv-contrib
# 注意 -DCUDA_CUDA_LIBRARY= 这个一定要加,这个是配置项的一个BUG,只能从这里绕过去。地址是cuda库中libcuda.so的绝对路径
cmake -DOPENCV_EXTRA_MODULES_PATH=/home/admin/opencv/opencv_contrib-master/modules -DCUDA_CUDA_LIBRARY=/usr/local/cuda-9.0/lib64/stubs/libcuda.so -DCMAKE_LIBRARY_PATH=/usr/local/cuda-9.0/lib64/stubs/ ..
#执行ccmake,配置编译选项
ccmake ..
#按t,切换进入高级模式
#主要修改的配置项如下:
1 //Build CUDA modules stubs when no CUDA SDK
2 BUILD_CUDA_STUBS:BOOL=OFF
3
4 //Create build rules for OpenCV Documentation
5 BUILD_DOCS:BOOL=OFF
6
7 //Build all examples
8 BUILD_EXAMPLES:BOOL=OFF
9
10 //Create Java wrapper exporting all functions of OpenCV library
11 // (requires static build of OpenCV modules)
12 BUILD_FAT_JAVA_LIB:BOOL=OFF
13
14 //Build IPP IW from source
15 BUILD_IPP_IW:BOOL=OFF
16
17 //Build Intel ITT from source
18 BUILD_ITT:BOOL=OFF
19
20 //Build libjasper from source
21 BUILD_JASPER:BOOL=OFF
22
23 //Enable Java support
24 BUILD_JAVA:BOOL=OFF
25
26 //Build libjpeg from source
27 BUILD_JPEG:BOOL=OFF
28
29 //Build openexr from source
30 BUILD_OPENEXR:BOOL=OFF
31
32 //Build performance tests
33 BUILD_PERF_TESTS:BOOL=OFF
34
35 //Build libpng from source
36 BUILD_PNG:BOOL=OFF
37
38 //Force to build libprotobuf from sources
39 BUILD_PROTOBUF:BOOL=OFF
40
41 //Build shared libraries (.dll/.so) instead of static ones (.lib/.a)
42 BUILD_SHARED_LIBS:BOOL=OFF
43
44 //Download and build TBB from source
45 BUILD_TBB:BOOL=OFF
46
47 //Build accuracy & regression tests
48 BUILD_TESTS:BOOL=OFF
49
50 //Build libtiff from source
51 BUILD_TIFF:BOOL=OFF
52
53 //Build WebP from source
54 BUILD_WEBP:BOOL=OFF
55
56 //Include debug info into release binaries ('OFF' means default
57 // settings)
58 BUILD_WITH_DEBUG_INFO:BOOL=OFF
59
60 //Enables dynamic linking of IPP (only for standalone IPP)
61 BUILD_WITH_DYNAMIC_IPP:BOOL=OFF
62
63 //Build zlib from source
64 BUILD_ZLIB:BOOL=OFF
65
66 //Include opencv_face module into the OpenCV build
67 BUILD_opencv_face:BOOL=OFF
68
69 //Include opencv_highgui module into the OpenCV build
70 BUILD_opencv_highgui:BOOL=OFF
71
72 //Include opencv_java_bindings_generator module into the OpenCV
73 // build
74 BUILD_opencv_java_bindings_generator:BOOL=OFF
75
76 //Include opencv_xfeatures2d module into the OpenCV build
77 BUILD_opencv_xfeatures2d:BOOL=OFF
78
79 //Choose the type of build, options are: None Debug Release RelWithDebInfo
80 // MinSizeRel ...
81 CMAKE_BUILD_TYPE:STRING=Debug
82
83 //Installation Directory
84 CMAKE_INSTALL_PREFIX:PATH=/home/admin/opencv/2019-05-09_cuda
85
86 //"cudart" library
87 CUDA_CUDART_LIBRARY:FILEPATH=/usr/local/cuda/lib64/libcudart.so
88
89 //Path to a program.
90 CUDA_NVCC_EXECUTABLE:FILEPATH=/usr/local/cuda/bin/nvcc
91
92 //Path to a file.
93 CUDA_TOOLKIT_INCLUDE:PATH=/usr/local/cuda/include
94
95 //Toolkit location.
96 CUDA_TOOLKIT_ROOT_DIR:PATH=/usr/local/cuda
97
98 //Use the static version of the CUDA runtime library if available
99 CUDA_USE_STATIC_CUDA_RUNTIME:BOOL=ON
100
101 //Enable ADE framework (required for Graph API module)
102 WITH_ADE:BOOL=OFF
103
104 //Include Aravis GigE support
105 WITH_ARAVIS:BOOL=OFF
106
107 //Include NVidia Cuda Runtime support
108 WITH_CUDA:BOOL=ON
109
110 //Include Intel Inference Engine support
111 WITH_INF_ENGINE:BOOL=OFF
112
113 //Include Intel IPP support
114 WITH_IPP:BOOL=OFF
115
116 //Include Intel ITT support
117 WITH_ITT:BOOL=OFF
118
119 //Include JPEG2K support
120 WITH_JASPER:BOOL=OFF
121
122 //Include JPEG support
123 WITH_JPEG:BOOL=OFF
124
125 //Include Lapack library support
126 WITH_LAPACK:BOOL=OFF
127
128 //Include NVidia Video Decoding library support
129 WITH_NVCUVID:BOOL=ON
130
131 //Include PNG support
132 WITH_PNG:BOOL=OFF
133
134 //Enable libprotobuf
135 WITH_PROTOBUF:BOOL=OFF
136
137 //Include Intel TBB support
138 WITH_TBB:BOOL=OFF
139
140 //Include TIFF support
141 WITH_TIFF:BOOL=OFF
142
143 //Include Vulkan support
144 WITH_VULKAN:BOOL=OFF
145
146 //Include WebP support
147 WITH_WEBP:BOOL=OFF
make -j 20
make install
=============================
2019-05-10补充:
//Build openexr from source
BUILD_OPENEXR:BOOL=ON
//Include ILM support via OpenEXR
WITH_OPENEXR:BOOL=ON
以上两项要打开,否则链接程序的时候出现大量如下错误:
/home/admin/opencv/opencv-master/modules/imgcodecs/src/grfmt_exr.cpp:250: undefined reference to `Im
f::Slice::Slice(Imf::PixelType, char*, unsigned long, unsigned long, int, int, double, bool, bool)'
/home/admin/opencv/opencv-master/modules/imgcodecs/src/grfmt_exr.cpp:252: undefined reference to `Im
f::FrameBuffer::insert(char const*, Imf::Slice const&)'
/home/admin/opencv/opencv-master/modules/imgcodecs/src/grfmt_exr.cpp:257: undefined reference to `Im
f::Slice::Slice(Imf::PixelType, char*, unsigned long, unsigned long, int, int, double, bool, bool)'
/home/admin/opencv/opencv-master/modules/imgcodecs/src/grfmt_exr.cpp:259: undefined reference to `Im
f::FrameBuffer::insert(char const*, Imf::Slice const&)'
opencv 4.0 + linux + cuda静态编译的更多相关文章
- opencv 4.0 + linux下静态编译,展示详细ccmake的参数配置
#先安装 cmake 3.14 # cmake安装到了 /usr/local/bin #配置PATH export PATH="$PATH:/usr/local/bin" #下载最 ...
- ACE-6.1.0 linux 下的编译与安装步骤
ACE-6.1.0 linux 下的编译与安装步骤 引用至http://www.cnblogs.com/liangxiaxu/archive/2013/03/07/2948417.html 1.从 ...
- Qt5.5.0在Linux下静态编译(加上-fontconfig编译项才能显示中文) good
测试系统环境:Ubuntu12.04 (32bit/64bit)编译软件环境:QT5.5.0 本文章主要介绍Linux下QT静态编译环境的搭建,以及如何编译我们的程序board_driver. 1 ...
- Linux下静态编译Qt
Qt采用编译的方式安装的时候,配置中默认的编译方式是动态编译的,但是有时候你编写的程序要发布出去,带很多动态库文件是很繁琐的,此时就需要静态编译你的程序,Qt要实现静态编译必须库文件也是静态编译的,所 ...
- Linux下静态编译Qt程序
一般情况下,我们用Qt编译出来的程序是要依赖于系统Qt库的,也就是这个程序移到别的没有安装Qt库的系统上是不能使用的.会提示缺少……库文件之类的错误.这就是动态编译的结果. 但是如果我们想编译一个程序 ...
- QT全平台设置图标,全平台静态编译 good
1. 概述 当我们用QT写好了一个软件,要把你的程序分享出去的时候,不可能把编译的目录拷贝给别人去运行.编译好的程序应该是一个主程序,加一些资源文件,再加一些动态链接库,高大上一些的还可以做一个安装 ...
- 用mingw静态编译Qt4.8.2和Qt5.1.1(需要修改不少源码)
因为一些乱七八糟的原因,我需要用mingw静态编译Qt4.8.2和Qt5.1.1.经历了一天的折腾之后,自觉编译一下Qt还是件颇为麻烦的事情,故将过程略作总结,以备不时之需. 首先,在编译之前,我需要 ...
- VS2010 win7 QT4.8.0,实现VS2010编译调试Qt程序,QtCreator静态发布程序
下载源代码,注意一定是源码压缩包如qt-everywhere-opensource-src-4.8.0.zip, 不是Qt发布的已编译的不同版本的标准库如qt-win-opensource-4.8.0 ...
- 记录下 QT Linux 静态编译遇到的坑
Qt下静态编译Qt,根据我的经验,如果按照Windows下那种直接拿官方sdk安装之后的文件来编译是行不通的,需要直接下载Qt的source包,目前诺基亚的源码叫做qt-everywhere-open ...
随机推荐
- Spring核心原理分析之MVC九大组件(1)
本文节选自<Spring 5核心原理> 1 什么是Spring MVC Spring MVC 是 Spring 提供的一个基于 MVC 设计模式的轻量级 Web 开发框架,本质上相当于 S ...
- 解决VMware开机黑屏问题
最近搞虚拟机.一直遇见了许多问题.发现某一天.VMware开机后.其中一个虚拟机直接卡住黑屏了.关的时候就一直显示.xxx繁忙.无法关闭.网上搜到了解决方法.这边记录一下. 1.关闭所有服务 2.修复 ...
- JAVA生成订单编号工具类
JAVA根据时间戳和随机数方式生成订单编号工具类 OrderUtils.java package com.util; import java.text.DateFormat; import java. ...
- sql改写优化:简单规则重组实现
我们知道sql执行是一个复杂的过程,从sql到逻辑计划,到物理计划,规则重组,优化,执行引擎,都是很复杂的.尤其是优化一节,更是内容繁多.那么,是否我们本篇要来讨论这个问题呢?答案是否定的,我们只特定 ...
- c/c++一些常用的内置宏
关于 本文演示环境: win10 + VS2017 Note 市面上的编译器五花八门,但是通常都支持: __DATE__,__FILE__,__LINE__ 和 __TIME__ 这个4个宏 VS20 ...
- 【LeetCode】1060. Missing Element in Sorted Array 解题报告 (C++)
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 遍历 日期 题目地址:https://leetcode ...
- 【LeetCode】449. Serialize and Deserialize BST 解题报告(Python)
[LeetCode]449. Serialize and Deserialize BST 解题报告(Python) 标签: LeetCode 题目地址:https://leetcode.com/pro ...
- C. Andryusha and Colored Balloons
C. Andryusha and Colored Balloons time limit per test 2 seconds memory limit per test 256 megabytes ...
- react hooks 如何自定义组件(react函数组件的封装)
前言 这里写一下如何封装可复用组件.首先技术栈 react hooks + props-type + jsx封装纯函数组件.类组件和typeScript在这不做讨论,大家别白跑一趟. 接下来会说一下封 ...
- Mysql 层级无限嵌套
1.新建测试数据 新建channel表 DROP TABLE IF EXISTS channel; CREATE TABLE channel ( id INT(11) NOT NULL AUTO_IN ...