ubuntu16.04 下dbus-cxx Library编译安装指南
2017-10-11 15:44
537 查看
下载去官网http://dbus-cxx.sourceforge.net/index.html
然后他说依赖几个库,
dbus: http://dbus.freedesktop.org -
Should be installed by default (runtime dependency)
libsigc++ http://libsigc.sourceforge.net/ (compile
dependency) See the README file for more information on compile-time dependencies
前者我sudo apt-get install dbus* 估计装了一堆东西
后者可以直接sudo apt-get install libsigc++就行了
其实可能还依赖一堆东西,缺啥apt-get啥就行了。这个很烦……
然后去根目录下执行 configure,会生成makefile。
这个makefile八成是编译不过的……因为缺少2个文件。那2个文件,再官网找找,找到了放在根目录下。
然后再makefile就可以编译通过了。
然后sudo make install就可以安装了。
接着测试样例程序,样例程序的makefile很复杂,我很菜也看不懂。
然后我自己给改了。。。(2个程序原来的文件名我分别改为a.cpp和b.cpp)
CFLAGS += -I/usr/local/include/dbus-cxx-0.9/
CFLAGS += -I/usr/include/dbus-1.0/
CFLAGS += -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include
CFLAGS += -I/usr/include/sigc++-2.0
CFLAGS += -I/usr/lib/x86_64-linux-gnu/sigc++-2.0/include
LIBS += -ldbus-1 -lsigc-2.0 -lpthread -lrt -ldbus-cxx -lpopt
CXX = g++ -std=c++14
aim : a b
a : a.o
$(CXX) -o a a.o $(CFLAGS) $(LIBS) $(LDFLAGS)
a.o : a.cpp
$(CXX) -c a.cpp $(CFLAGS) $(LIBS) $(LDFLAGS)
b : b.o
$(CXX) -o b b.o $(CFLAGS) $(LIBS) $(LDFLAGS)
b.o : b.cpp
$(CXX) -c b.cpp $(CFLAGS) $(LIBS) $(LDFLAGS)
那一堆依赖,缺啥装啥。特别是lpopt别忘了,不然其他库编译不过。
至此,dbus-cxx-0.9.0/examples/quick-start算是编译通过了。
现在dbus-cxx-0.9.0/examples/basics/methods里的makefile应该是编译不过去的。
手动打开里面的makefile,找到g++相关,加上-lpopt (原来作者怎么编译过的)
同时源程序里一些函数也编译不过,打开程序加上std:: (难道原作者引用了某个using namespace std的东西?) 就可以编译过了。
然后他说依赖几个库,
dbus: http://dbus.freedesktop.org -
Should be installed by default (runtime dependency)
libsigc++ http://libsigc.sourceforge.net/ (compile
dependency) See the README file for more information on compile-time dependencies
前者我sudo apt-get install dbus* 估计装了一堆东西
后者可以直接sudo apt-get install libsigc++就行了
其实可能还依赖一堆东西,缺啥apt-get啥就行了。这个很烦……
然后去根目录下执行 configure,会生成makefile。
这个makefile八成是编译不过的……因为缺少2个文件。那2个文件,再官网找找,找到了放在根目录下。
然后再makefile就可以编译通过了。
然后sudo make install就可以安装了。
接着测试样例程序,样例程序的makefile很复杂,我很菜也看不懂。
然后我自己给改了。。。(2个程序原来的文件名我分别改为a.cpp和b.cpp)
CFLAGS += -I/usr/local/include/dbus-cxx-0.9/
CFLAGS += -I/usr/include/dbus-1.0/
CFLAGS += -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include
CFLAGS += -I/usr/include/sigc++-2.0
CFLAGS += -I/usr/lib/x86_64-linux-gnu/sigc++-2.0/include
LIBS += -ldbus-1 -lsigc-2.0 -lpthread -lrt -ldbus-cxx -lpopt
CXX = g++ -std=c++14
aim : a b
a : a.o
$(CXX) -o a a.o $(CFLAGS) $(LIBS) $(LDFLAGS)
a.o : a.cpp
$(CXX) -c a.cpp $(CFLAGS) $(LIBS) $(LDFLAGS)
b : b.o
$(CXX) -o b b.o $(CFLAGS) $(LIBS) $(LDFLAGS)
b.o : b.cpp
$(CXX) -c b.cpp $(CFLAGS) $(LIBS) $(LDFLAGS)
那一堆依赖,缺啥装啥。特别是lpopt别忘了,不然其他库编译不过。
至此,dbus-cxx-0.9.0/examples/quick-start算是编译通过了。
现在dbus-cxx-0.9.0/examples/basics/methods里的makefile应该是编译不过去的。
手动打开里面的makefile,找到g++相关,加上-lpopt (原来作者怎么编译过的)
同时源程序里一些函数也编译不过,打开程序加上std:: (难道原作者引用了某个using namespace std的东西?) 就可以编译过了。
相关文章推荐
- ubuntu 16.04 libQGLViewer编译安装指南
- ubuntu16.04安装交叉编译工具
- Ubuntu 16.04 LTS 下Nginx的编译安装与启动
- 在Ubuntu 16.04 上编译安装OpenCV3.2.0(Cmake + python3 + OpenCV3)(转)
- Ubuntu16.04编译安装xdebug(phpstorm)
- PCL(PointCloud Library) 于 Ubuntu 16.04的编译安装
- ubuntu16.04编译安装mysql-boost-5.7.21并编译成php扩展测试与使用
- ubuntu 16.04安装git和qt编译环境命令及其相关内容
- Ubuntu 16.04编译安装最新的OpenCV3.2
- ubuntu16.04编译安装mysql5.7
- ubuntu16.04 安装caffe 编译python接口
- ubuntu16.04 64位编译安装qt4.8.0和qt creator2.4.1
- ubuntu16.04编译安装php7.2
- ubuntu编译环境安装指南
- ubuntu16.04上用虚拟环境上安装django的指南
- ubuntu14.04 /16.04 编译安装OpenCV 3.2
- ubuntu16.04 安装完Qt后,编译项目出现cannot find -lGL
- Openfoam学习记录(2017.06.10)(foam-extend-3.2在ubuntu16.04上的安装与编译)
- Ubuntu16.04+Cuda8.0+Caffe+ Opencv3.2+Matlab2015b的配置、安装与编译(一)
- Ubuntu16.04 python3编译安装