- Open a Terminal (under Utilities)
- Convert the ISO to UDRW format
hdiutil convert -format UDRW -o destination_file.img source_file.iso - Run
diskutil listand determine the device node assigned to your flash media (e.g., /dev/disk2) - Run
diskutil unmountDisk /dev/diskN(replace N with the disk number from the last command; in the previous example, N would be 2) - Execute
sudo dd if=/path/to/destination_file.img.dmg of=/dev/diskN bs=1m(replace /path/to/destination_file.img.dmg with the path where the image file is located; for example, ./win7.img.dmg)- Using /dev/rdisk instead of /dev/disk will faster, 20x
- If you see the error dd: Invalid number '1m', you are using GNU dd. Use the same command but replace bs=1m with bs=1M
- If you see the error dd: /dev/diskN: Resource busy, make sure the disk is not in use. Start the 'Disk Utility.app' and unmount (don't eject) the drive
- Run
diskutil eject /dev/diskN, and remove your flash media when the command completes (this can take a few hours on slower drives)
ThinkPad-T440通过U盘启动的方式升级BIOS
最近在ThinkPad-T440上安装最新的Ubuntu 17.04的时候,系统提示如下信息:
|
1 |
Oct 21 00:29:34 ThinkPad-T440 kernel: [ 0.000000] [Firmware Bug]: TSC_DEADLINE disabled due to Errata; please update microcode to version: 0x20 (or later) |
通过提示,可以看到是系统的CPU微码部分没有更新到最新,导致系统在执行部分功能的时候发生了异常,升级BIOS可以解决这个问题。
在联想官网上下载最新的BIOS光盘镜像(假定镜像名为BIOSCD.iso)之后,发现无法直接通过U盘启动系统。原因是光盘的镜像格式不符合U盘启动需要的格式,需要进行转换之后才可以正常启动系统。
可以通过如下的方式,转换下载到的镜像文件之后,刷新BIOS。
|
1 2 3 4 5 6 7 8 |
$ sudo apt-get install genisoimage $ geteltorito -o bios.img BIOSCD.iso #找出U盘挂载的位置,假定是/dev/sdb $ df $ sudo dd if=bios.img of=/dev/sdb |
之后,重启系统即可。
WD MyCloud编译PHP-7.1安装包
1.按照How to successfully build packages for WD My Cloud from source中的介绍,搭建完成WDMyCloud的编译环境
2.使用如下方式编译:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
$ su $ cd ~/wdmc-build/64k-jessie $ chroot build $ mount -t proc none /proc $ mount -t devtmpfs none /dev $ mount -t devpts none /dev/pts $ export DEBIAN_FRONTEND=noninteractive $ export DEBCONF_NONINTERACTIVE_SEEN=true $ export LC_ALL=C $ export LANGUAGE=C $ export LANG=C $ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE' $ export DEB_BUILD_OPTIONS=nocheck $ cd root $ apt-get update $ apt-get upgrade $ apt-get install ca-certificates $ apt-get install dh-autoreconf $ apt-get install git $ apt-get install apache2-dev $ apt-get install apache2 $ apt-get install systemtap-sdt-dev $ apt-get install libxml2 $ apt-get install libxml2-dev $ apt-get install libssl-dev $ apt-get install libpcre3 libpcre3-dev $ apt-get install libsqlite3-dev $ apt-get install libbz2-dev $ apt-get install libcurl4-openssl-dev $ apt-get install libqdbm-dev $ apt-get install libdb-dev #configure: error: Cannot find enchant $ apt-get install enchant libenchant-dev #configure: error: webp/decode.h not found $ apt-get install libwebp-dev #configure: error: png.h not found. $ apt-get install libpng-dev #configure: error: xpm.h not found. $ apt-get install libxpm-dev #configure: error: freetype-config not found. $ apt-get install libfreetype6-dev #configure: error: Unable to find gd.h anywhere under /usr $ apt-get install libgd-dev #configure: error: Unable to locate gmp.h $ apt-get install libgmp-dev #configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information. $ apt-get install libc-client-dev #configure: error: Kerberos libraries not found. $ apt-get install libkrb5-dev #configure: error: libfbclient, libgds or libib_util not found! Check config.log for more information. $ apt-get install firebird-dev #configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works. $ apt-get install libicu-dev #configure: error: sasl.h not found! $ apt-get install libsasl2-dev #configure: error: mcrypt.h not found. Please reinstall libmcrypt. $ apt-get install libmcrypt-dev #checking for unixODBC support... configure: error: ODBC header file '/usr/include/sqlext.h' not found! $ apt-get install unixODBC-dev #configure: error: Directory /usr is not a FreeTDS installation directory $ apt-get install FreeTDS-dev #configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path $ apt-get install libpq-dev #configure: error: Cannot find pspell $ apt-get install libpspell-dev #configure: error: Please reinstall libedit - I cannot find readline.h $ apt-get install libedit-dev #configure: error: Can not find recode.h anywhere under /usr /usr/local /usr /opt. $ apt-get install librecode-dev #configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation. $ apt-get install libsnmp-dev #configure: error: Cannot find libtidy $ apt-get install libtidy-dev #checking for XMLRPC-EPI in default path... not found $ apt-get install libxmlrpc-epi-dev #configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution $ apt-get install libxslt-dev #configure: error: Please reinstall the libzip distribution $ apt-get install libzip-dev $ git clone -b master-7.1 https://gitlab.com/deb.sury.org/php.git php7 --depth=1 $ cd php7 #禁用systemd $ sed -i "s/CONFIGURE_SYSTEMD *:= *--with-fpm-systemd/CONFIGURE_SYSTEMD := --without-fpm-systemd/g" debian/rules $ sed -i "s/DH_SYSTEMD *:= *--with systemd/DH_SYSTEMD :=/g" debian/rules $ dpkg-buildpackage -d -b -uc #编译依赖包php-common $ cd .. $ git clone -b debian/50 git://anonscm.debian.org/pkg-php/php-defaults.git $ cd php-defaults #禁用systemd $ sed -i "s/DH_SYSTEMD *:= *--with *systemd/DH_SYSTEMD :=/g" debian/rules $ dpkg-buildpackage -d -b -uc $ exit |
3.编译php-apcu,这个模块WD MyCloud需要
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
$ su $ cd ~/wdmc-build/64k-jessie $ chroot build $ mount -t proc none /proc $ mount -t devtmpfs none /dev $ mount -t devpts none /dev/pts $ export DEBIAN_FRONTEND=noninteractive $ export DEBCONF_NONINTERACTIVE_SEEN=true $ export LC_ALL=C $ export LANGUAGE=C $ export LANG=C $ export DEB_CFLAGS_APPEND='-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE' $ export DEB_BUILD_OPTIONS=nocheck $ cd root #安装依赖 $ apt-get install shtool $ apt-get install liblist-moreutils-perl $ apt-get install xml2 # "dch" command $ apt-get install devscripts #安装我们刚刚编译好的PHP7包 $ dpkg -i php-common_50_all.deb $ dpkg -i php7.1-common_7.1.10-1_armhf.deb $ dpkg -i php7.1-readline_7.1.10-1_armhf.deb $ dpkg -i php7.1-opcache_7.1.10-1_armhf.deb $ dpkg -i php7.1-json_7.1.10-1_armhf.deb $ dpkg -i php7.1-cli_7.1.10-1_armhf.deb $ dpkg -i php7.1-dev_7.1.10-1_armhf.deb #编译依赖 $ git clone git://anonscm.debian.org/pkg-php/dh-php.git $ cd dh-php $ git checkout debian/0.26 -b debian/0.26 $ dpkg-buildpackage -d -b -uc $ cd .. $ dpkg -i dh-php_0.26_all.deb #参考 https://packages.debian.org/source/sid/php-apcu # git://anonscm.debian.org/pkg-php/php-apcu.git #https://pecl.php.net/package/APCu $ git clone git://anonscm.debian.org/pkg-php/php-apcu.git $ cd php-apcu $ git checkout debian/5.1.8+4.0.11-1 -b debian/5.1.8+4.0.11-1 #Build the package $ debuild -b -d -uc -us $ cd .. $ dpkg -i php-apcu_5.1.8+4.0.11-1_armhf.deb $ git clone git://anonscm.debian.org/pkg-php/php-apcu-bc.git $ cd php-apcu-bc $ debuild -b -d -uc -us $ exit |
上面下载的代码由于是国外的服务器,因此可能会出现一直无法下载成功的情况,可以从这里下载代码的拷贝。PHP源代码点击这里,PHP7 Debian编译配置文件点击这里,dh-php源代码点击这里,php-apcu源代码点击这里, php-apcu-bc源代码点击这里。
在WDMyCloud中安装的时候执行如下命令:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
$ sudo apt-get update $ sudo apt-get install -y --force-yes php7.1 $ sudo apt-get install -y --force-yes libapache2-mod-php7.1 $ sudo apt-get install -y --force-yes php7.1-curl $ sudo apt-get install -y --force-yes php-apcu $ sudo apt-get install -y --force-yes php-apcu-bc $ sudo apt-get install -y --force-yes php7.1-xml #这个是个坑,如果没有增加这个模块,也是可以正常启动的,但是却没办法正常登录进入,应用会出现异常 $ sudo apt-get install -y --force-yes php7.1-mbstring #由于PHP7中的parse_ini_file不再兼容“#”作为注释字符,只能使用“;”进行注释,但是这个注释无法 #被其他应用读取,而WDMyCloud里面的其他脚本也需要读取/etc/system.conf里面的内容 #目前唯一的解决方法就是删除全部的注释行 # /var/www/htdocs/UI/index.php $ sudo cp /etc/system.conf /etc/system.conf.bak $ sudo sed -i '/^#/d' /etc/system.conf #语法调整 $ sudo cp /var/www/htdocs/UI/views/common/dates.php /var/www/htdocs/UI/views/common/dates.php.bak $ sudo sed -i 's/^<?.*$/<?php/g' /var/www/htdocs/UI/views/common/dates.php #/var/www/htdocs/UI/views/layouts/main/main.php $ sudo cp /etc/php5/apache2/conf.d/include_path.ini /etc/php/7.1/apache2/conf.d/ $ sudo chmod 777 /etc/php/7.1/apache2/conf.d/include_path.ini $ sudo a2dismod php5 $ sudo a2enmod php7.1 $ sudo phpenmod curl $ sudo service apache2 restart |
注意,这部分的功能目前仅仅是可用,还没有达到完全正常的情况,如果出现问题,可以切换回PHP5,目前已知的完美切换回到原来的PHP5的办法就是卸载上面安装的所有PHP7的相关应用才能切换成功,否则总有部分小功能不是太正常.
参考链接
神经网络瘦身:SqueezeNet
2016年2月份,UC Berkeley和Stanford一帮人在arXiv贴了一篇文章:
这篇文章做成了许多人梦寐以求的事——压缩神经网络参数。但和以往不同,原作不是在前人网络基础上修修补补(例如Deep Compression),而是自己设计了一个全新的网络,它用了比AlexNet少50倍的参数,达到了AlexNet相同的精度!
关于SqueezeNet的创新点、网络结构,国内已经有若干爱好者发布了相关的简介,如这篇、这篇,国外的文献没有查,相信肯定也有很多。
本文关注的重点在SqueezeNet为什么能实现网络瘦身?难道网络参数的冗余性就那么强吗?或者说很多参数都是浪费的、无意义的?
OpenMediaVault-3.0.89在系统更新升级后无法挂载磁盘
OpenMediaVault-3.0.89在执行应用升级
|
1 2 |
$ sudo apt-get update $ sudo apt-get upgrade |
重启无法自动挂载磁盘,查看系统日志,看到如下内容:
|
1 2 3 4 5 6 |
Oct 13 22:53:54 openmediavault systemd[1]: systemd-fsck@dev-disk-by\x2duuid-7909fba8\x2dcc50\x2d430f\x2d986f\x2d9db4ba7caa3c.service: Job systemd-fsck@dev-disk-by\x2duuid-7909fba8\x2dcc50\x2d430f\x2d986f\x2d9db4ba7caa3c.service/start failed with result 'dependency'. Oct 13 22:53:54 openmediavault systemd[1]: dev-disk-by\x2duuid-7909fba8\x2dcc50\x2d430f\x2d986f\x2d9db4ba7caa3c.device: Job dev-disk-by\x2duuid-7909fba8\x2dcc50\x2d430f\x2d986f\x2d9db4ba7caa3c.device/start failed with result 'timeout'. Oct 13 22:54:25 openmediavault monit[1551]: 'collectd' process is not running Oct 13 22:54:25 openmediavault monit[1551]: 'collectd' trying to restart Oct 13 22:54:25 openmediavault monit[1551]: 'collectd' start: '/bin/systemctl start collectd' Oct 13 22:54:55 openmediavault monit[1551]: 'collectd' failed to start (exit status 0) -- no output |
这个原因是由于collectd的升级导致了无法使用systemd来启动。而Openmediavaule加载硬盘的时候依赖collectd模块,这个模块的启动问题导致全部磁盘都无法加载。
目前的做法是升级到最新的OpenMediaVault-4.0,参考OpenMediaVault系统升级。
但是升级后会遇到如下错误:
|
1 |
Oct 14 18:01:10 openmediavault collectd[1081]: rrdcached plugin: Failed to connect to RRDCacheD at unix:/var/run/rrdcached.sock: Unable to connect to rrdcached: No such file or directory (status=2) |
以及
|
1 2 3 4 |
Oct 14 18:19:28 openmediavault monit[1053]: 'omv-engined' process is not running Oct 14 18:19:28 openmediavault monit[1053]: 'omv-engined' trying to restart Oct 14 18:19:28 openmediavault monit[1053]: 'omv-engined' start: '/bin/systemctl start openmediavault-engined' Oct 14 18:19:59 openmediavault monit[1053]: 'omv-engined' failed to start (exit status 1) -- '/bin/systemctl start openmediavault-engined': Failed to start openmediavault-engined.service: Unit openmediavault-engined.service is masked. |
修复方法为:
|
1 2 3 4 5 6 7 8 9 |
$ omv-mkconf collectd $ omv-mkconf rrdcached $ omv-mkconf monit $ sudo systemctl unmask openmediavault-engined.service $ sudo reboot |
参考链接
ROS Kinetic切换OpenCV到2.X版本
注意,本文章只针对简单的应用,不涉及到复杂的严重依赖OpenCV模块的项目。如果依赖复杂,可能会导致OpenCV 2.X与OpenCV 3.X的运行时库同时被加载,导致运行时候崩溃。
最近在使用ROS开发项目,代码从Indigo(Ubuntu 14.04)升级到Kinetic(Ubuntu 16.04)。
发现OpenCV升级到了opencv-3.2.0-dev版本,但是实际使用中发现代码在opencv-2.4.9版本上能正确运行,但是升级到opencv-3.2.0-dev版本之后,就不能正常工作了。
为了查找问题,需要降级一下OpenCV版本。
网上查找了一下,找到如下解决方法:
|
1 2 3 4 5 6 7 8 9 |
$ sudo apt-get install libcv-dev $ sudo apt-get install libopencv-dev $ sudo apt-get install libopencv-contrib-dev $ sudo apt-get install libopencv-gpu-dev $ sudo gedit /opt/ros/kinetic/share/cv_bridge/cmake/cv_bridgeConfig.cmake |
然后修改如下的内容(修改之前请注意先备份)
|
1 2 3 4 5 6 7 |
第94-96行: if(NOT "include;/opt/ros/kinetic/include/opencv-3.1.0-dev/opencv;/opt/ros/kinetic/include/opencv-3.1.0-dev " STREQUAL " ") set(cv_bridge_INCLUDE_DIRS "") set(_include_dirs "include;/opt/ros/kinetic/include/opencv-3.1.0-dev/opencv;/opt/ros/kinetic/include/opencv-3.1.0-dev") #112行: set(libraries "cv_bridge;/opt/ros/kinetic/lib/libopencv_calib3d3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_core3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_features2d3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_flann3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_highgui3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_imgcodecs3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_imgproc3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_ml3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_objdetect3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_photo3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_shape3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_stitching3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_superres3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_video3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_videoio3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_videostab3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_viz3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_aruco3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_bgsegm3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_bioinspired3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_ccalib3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_cvv3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_datasets3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_dpm3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_face3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_fuzzy3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_hdf3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_line_descriptor3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_optflow3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_phase_unwrapping3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_plot3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_reg3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_rgbd3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_saliency3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_stereo3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_structured_light3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_surface_matching3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_text3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_xfeatures2d3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_ximgproc3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_xobjdetect3.so.3.2.0;/opt/ros/kinetic/lib/libopencv_xphoto3.so.3.2.0") |
指向系统自带的opencv-2.4.9版本
|
1 2 3 4 5 6 7 |
#94-96行: if(NOT "include;/usr/include/opencv;/usr/include " STREQUAL " ") set(cv_bridge_INCLUDE_DIRS "") set(_include_dirs "include;/usr/include/opencv;/usr/include") #112行: set(libraries "cv_bridge;/usr/lib/x86_64-linux-gnu/libopencv_calib3d.so;/usr/lib/x86_64-linux-gnu/libopencv_contrib.so;/usr/lib/x86_64-linux-gnu/libopencv_core.so;/usr/lib/x86_64-linux-gnu/libopencv_features2d.so;/usr/lib/x86_64-linux-gnu/libopencv_flann.so;/usr/lib/x86_64-linux-gnu/libopencv_gpu.so;/usr/lib/x86_64-linux-gnu/libopencv_highgui.so;/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so;/usr/lib/x86_64-linux-gnu/libopencv_legacy.so;/usr/lib/x86_64-linux-gnu/libopencv_ml.so;/usr/lib/x86_64-linux-gnu/libopencv_objdetect.so;/usr/lib/x86_64-linux-gnu/libopencv_ocl.so;/usr/lib/x86_64-linux-gnu/libopencv_photo.so;/usr/lib/x86_64-linux-gnu/libopencv_stitching.so;/usr/lib/x86_64-linux-gnu/libopencv_superres.so;/usr/lib/x86_64-linux-gnu/libopencv_ts.so;/usr/lib/x86_64-linux-gnu/libopencv_video.so;/usr/lib/x86_64-linux-gnu/libopencv_videostab.so") |
修改完成后,必要的情况下,请在删除~/workspace/ros/catkin/目录下的build,devel目录之后,重新编译。
参考链接
CVR100W升级到最新固件1.0.1.24
家里用的CVR100W路由是几年前买的,当时升级过一次固件,版本到1.0.1.19,但是最近几个月发现出现了无线不稳定的情况,有线访问打开路由器主页也变得比较慢,重启无效。因此怀疑是路由器系统在长时间运行后,这个版本的固件是存在问题的。
去思科官网搜索一下最新固件,竟然看到了1.0.1.24版本的固件,于是下载下来CVR100W_FW_1.0.1.24,各位也可以去思科官网去搜索下载。
目前测试来看,这个版本的固件应该是更稳定,速度也有所提升。
继续阅读CVR100W升级到最新固件1.0.1.24
NVIDIA TX2 (Ubuntu 16.04)上安装CUDA 8.0
使用如下方式安装:
|
1 2 3 4 5 6 7 8 9 |
$ cd ~ $ wget http://developer.download.nvidia.com/devzone/devcenter/mobile/jetpack_l4t/013/linux-x64/cuda-repo-l4t-8-0-local_8.0.84-1_arm64.deb $ sudo dpkg -i cuda-repo-l4t-8-0-local_8.0.84-1_arm64.deb $ sudo apt-get update $ sudo apt-get install cuda-toolkit-8-0 |
至于如何获取最新的NVIDIA TX2上使用的CUDA 8.0版本的下载地址,请访问Jetson Download Center,下载目前最新的JetPack 3.1。执行之后在存储目录下的repository.json中找到最新的下载链接即可。当然也可以让JetPack 3.1自动下载完成最新的CUDA 8.0版本到指定目录。
NVIDIA TX2 (Ubuntu 16.04)上安装ROS
首先编辑安装源
|
1 |
$ sudo vim /etc/apt/sources.list |
找到如下内容
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted ## Uncomment the following two lines to add software from the 'universe' ## repository. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. # deb http://ports.ubuntu.com/ubuntu-ports/ xenial universe # deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial universe # deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates universe # deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates universe ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. # deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted # deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted # deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security universe # deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security universe # deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security multiverse # deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security multiverse |
开启universe源,修改为:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted ## Uncomment the following two lines to add software from the 'universe' ## repository. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://ports.ubuntu.com/ubuntu-ports/ xenial universe deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial universe deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates universe deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates universe ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. # deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted # deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted # deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security universe # deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security universe # deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security multiverse # deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security multiverse |
然后更新源
|
1 |
$ sudo apt-get update |
然后执行如下安装脚本:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#!/bin/bash sudo apt-get update sudo apt-get upgrade -y --force-yes sudo apt-get autoremove -y # 必须先安装boost ,否则,整个安装过程会失败,应该是apt的BUG sudo apt-get -y install libboost-all-dev UBUNTU_VERSION=`lsb_release -c -s` ROS_DISTRO=hydro if [ $UBUNTU_VERSION = trusty ] || [ $UBUNTU_VERSION = saucy ] ; then ROS_DISTRO=indigo elif [ $UBUNTU_VERSION = xenial ] ; then ROS_DISTRO=kinetic fi ROS_PACKAGES="python-rosinstall ros-$ROS_DISTRO-robot-state-publisher ros-$ROS_DISTRO-cmake-modules ros-$ROS_DISTRO-freenect-stack ros-$ROS_DISTRO-openni-launch ros-$ROS_DISTRO-camera-info-manager-py" echo "deb http://packages.ros.org/ros/ubuntu $UBUNTU_VERSION main" | sudo tee /etc/apt/sources.list.d/ros-latest.list wget http://packages.ros.org/ros.key -O - | sudo apt-key add - sudo apt-get update sudo apt-get install ros-$ROS_DISTRO-desktop-full -y sudo rosdep init rosdep update sudo apt-get install $ROS_PACKAGES -y --force-yes |
参考链接
Ubuntu 16.04上使用crosstool-ng编译Nvidia TX2上使用的boost库
目前在Nvidia TX2上尝试安装ROS Kinetic的时候发现依赖libboost-all-dev,但是自带的源http://ports.ubuntu.com下面没有合适的源,尽管在universe源下面包含libboost-all-dev ,但是实际安装的时候发现安装不上。
因此尝试手工编译最新的boost安装包,建立自己的源。
首先,编译安装最新的crosstool-ng,如下:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
$ sudo apt-get install git $ sudo apt-get install gperf $ sudo apt-get install bison $ sudo apt-get install flex $ sudo apt-get install texinfo $ sudo apt-get install help2man $ sudo apt-get install gawk $ sudo apt-get install libncurses5-dev $ cd ~ $ git clone https://github.com/crosstool-ng/crosstool-ng.git $ cd crosstool-ng $ git checkout crosstool-ng-1.23.0 $ ./bootstrap $ ./configure --prefix=/usr/local $ make $ sudo make install $ cd ~ $ mkdir tx2 $ cd tx2 #用树莓派的模板作为参考模板即可 $ cp ~/crosstool-ng/samples/aarch64-rpi3-linux-gnueabi/crosstool.config .config $ ct-ng oldconfig #默认一路回车即可,如果使用图形界面配置执行 ct-ng menuconfig $ unset LD_LIBRARY_PATH $ ct-ng build |
生成的工具链在~/x-tools/aarch64-rpi3-linux-gnueabi目录下,编译的时候,指定编译工具即可。
安装编译依赖
|
1 2 3 4 5 6 7 |
$ sudo apt-get install devscripts $ sudo apt-get install cdbs $ sudo apt-get install python-dev $ sudo apt-get install libbz2-dev |
接着,下载并编译最新的代码
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
#!/bin/bash export DEBVERSION=1.58.0-1 if [ ! -d "boost_1_58_0" ]; then wget "http://nchc.dl.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.tar.bz2" -O boost_1_58_0.tar.bz2 tar xjvf boost_1_58_0.tar.bz2 fi cd boost_1_58_0 :<<BLOCK 'export DEBVERSION=1.60.0-1 if [ ! -d "boost_1_60_0" ]; then wget "http://downloads.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0.tar.bz2" -O boost-all_1.60.0.orig.tar.bz2 tar xjvf boost-all_1.60.0.orig.tar.bz2 fi cd boost_1_60_0 ' BLOCK #Build DEB rm -rf debian mkdir -p debian #Use the LICENSE file from nodejs as copying file touch debian/copying #Create the changelog (no messages needed) dch --create -v $DEBVERSION --package libboost-all "" #Create copyright file touch debian #Create control file cat > debian/control <<EOF Source: libboost-all Maintainer: LongSky <wangqiang1588@sina.com> Section: misc Priority: optional Standards-Version: 3.9.2 Build-Depends: debhelper (>= 8), cdbs, libbz2-dev, zlib1g-dev Package: libboost-all Architecture: arm64 Depends: \${shlibs:Depends}, \${misc:Depends}, libboost-all (= $DEBVERSION) Description: Boost library, version $DEBVERSION (shared libraries) Package: libboost-all-dev Architecture: any Depends: libboost-all (= $DEBVERSION) Description: Boost library, version $DEBVERSION (development files) Package: libboost-build Architecture: any Depends: \${misc:Depends} Description: Boost Build v2 executable EOF #Create rules file cat > debian/rules <<EOF #!/usr/bin/make -f %: dh \$@ override_dh_auto_configure: ./bootstrap.sh override_dh_auto_build: ./b2 link=static,shared -j 1 --prefix=`pwd`/debian/libboost-all/usr/ override_dh_auto_test: override_dh_auto_install: mkdir -p debian/libboost-all/usr debian/libboost-all-dev/usr debian/libboost-build/usr/bin ./b2 link=static,shared --prefix=`pwd`/debian/libboost-all/usr/ install mv debian/libboost-all/usr/include debian/libboost-all-dev/usr cp b2 debian/libboost-build/usr/bin ./b2 install --prefix=`pwd`/debian/libboost-build/usr/ install EOF #Create some misc files echo "8" > debian/compat mkdir -p debian/source echo "3.0 (quilt)" > debian/source/format #Build the package nice -n19 ionice -c3 debuild -b -d -uc -us |
注意,对于boost-1.58来说,当时的代码是没有检测ARM64的功能的,当年也没有ARM64的芯片。因此需要修改{boost_root}/libs/config/checks/architecture/arm.cpp里面的代码,增加ARM64的判断
|
1 2 3 4 5 |
#if !defined(__arm__) && !defined(__thumb__) && \ !defined(__TARGET_ARCH_ARM) && !defined(__TARGET_ARCH_THUMB) && \ !defined(_ARM) && !defined(_M_ARM) #error "Not ARM" #endif |
调整为
|
1 2 3 4 5 |
#if !defined(__arm__) && !defined(__thumb__) && \ !defined(__TARGET_ARCH_ARM) && !defined(__TARGET_ARCH_THUMB) && \ !defined(_ARM) && !defined(_M_ARM) && !defined(__aarch64__) #error "Not ARM" #endif |