【LinuxCNC开发序列教程⼀】Ubuntu环境下安装Ethercat主
⽼朋友们,本序列教程⽤于Linuxcnc开发实际遇到的问题。更多的⽤于命令记录,希望对后⾯的朋友少点弯路。
系统:Ubuntu 12 LTS
内核:3.4.9-rtai-686-pae
1、下载etherlabmaster主站代码并配置代码
命令:./bootstrap
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat$ hg clone hg.code.sf/p/etherlabmaster/code etherlabmaster-code
程序“hg”尚未安装。您可以使⽤以下命令安装:
sudo apt-get install mercurial
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat$ sudo apt-get install mercurial[sudo] password for gemc2:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
将会安装下列额外的软件包:
mercurial-common
建议安装的软件包:
qct vim emacs kdiff3 tkdiff meld xxdiff python-mysqldb python-pygments
下列【新】软件包将被安装:
mercurial mercurial-common
升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 1,987 kB 的软件包。
解压缩后会消耗掉 6,693 kB 的额外空间。
您希望继续执⾏吗?[Y/n]y
获取:1 cn.archive.ubuntu/ubuntu/ precise-updates/universe mercurial-common all 2.0.2-1ubuntu1.2 [1,949 kB]
获取:2 cn.archive.ubuntu/ubuntu/ precise-updates/universe mercurial i386 2.0.2-1ubuntu1.2 [37.7 kB]
下载 1,987 kB,耗时 18秒 (108 kB/s)
Selecting previously unselected package mercurial-common.
(正在读取数据库 ... 系统当前共安装有 195761 个⽂件和⽬录。)
正在解压缩 mercurial-common (从 .../mercurial-common_2.0.2-1ubuntu1.2_all.deb) ...
Selecting previously unselected package mercurial.
正在解压缩 mercurial (从 .../mercurial_2.0.2-1ubuntu1.2_i386.deb) ...
正在处理⽤于 man-db 的触发器...
正在设置 mercurial-common (2.0.2-1ubuntu1.2) ...
正在设置 mercurial (2.0.2-1ubuntu1.2) ...
Creating config file /etc/mercurial/hgrc. with new version
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat$ hg clone hg.code.sf/p/etherlabmaster/code etherlabmaster-code
正在请求全部修改
正在增加修改集
正在增加清单
正在增加⽂件改变
已增加 2722 个修改集,包含 10312 个改变,修改了 1664 个⽂件 (+4 heads)
updating to branch default
1116 files updated, 0 files merged, 0 files removed, 0 files unresolved
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat$ ls
etherlabmaster-code
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat$ cd etherlabmaster-code/
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$ ls
AUTHORS          devices          globals.h  Makefile.am  TODO
bootstrap        documentation    include    master      tool
<  Doxyfile.in      INSTALL    NEWS        tty
configure.ac    ethercat.spec.in  Kbuild.in  README
COPYING          examples          lib        README.EoE
COPYING.LESSER  FEATURES          m4        script
COPYING.LESSER  FEATURES          m4        script
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$ ./boostrapbash: ./boostrap: 没有那个⽂件或⽬录
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$ ./boostrapbash: ./boostrap: 没有那个⽂件或⽬录
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$ ./bootstrap
+ touch ChangeLog
+ autoreconf -i
./bootstrap: ⾏ 36: autoreconf: 未到命令
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$
gemc2@gemc2-VirtualBox:~/LinuxCNC/Ethercat/etherlabmaster-code$ sudo suroot@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# 正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
将会安装下列额外的软件包:
automake autotools-dev m4
建议安装的软件包:
autoconf2.13 autoconf-archive gnu-standards autoconf-doc libtool
gettext
下列【新】软件包将被安装:
autoconf automake autotools-dev m4
升级了 0 个软件包,新安装了 4 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 1,369 kB 的软件包。
解压缩后会消耗掉 4,023 kB 的额外空间。
您希望继续执⾏吗?[Y/n]y
获取:1 cn.archive.ubuntu/ubuntu/ precise/main m4 i386 1.4.16-2ubuntu1 [195 kB]
获取:2 cn.archive.ubuntu/ubuntu/ precise/main autoconf all 2.68-1ubuntu2 [560 kB]
获取:3 cn.archive.ubuntu/ubuntu/ precise/main autoconf all 2.68-1ubuntu2 [560 kB]
获取:4 cn.archive.ubuntu/ubuntu/ precise/main autoconf all 2.68-1ubuntu2 [560 kB]
获取:5 cn.archive.ubuntu/ubuntu/ precise/main autotools-dev all 20120210.1ubuntu1 [42.4 kB]
获取:6 cn.archive.ubuntu/ubuntu/ precise/main autotools-dev all 20120210.1ubuntu1 [42.4 kB]
获取:7 cn.archive.ubuntu/ubuntu/ precise/main automake all 1:1.11.3-1ubuntu2 [571 kB]
获取:8 cn.archive.ubuntu/ubuntu/ precise/main automake all 1:1.11.3-1ubuntu2 [571 kB]
下载 1,026 kB,耗时 16分 53秒 (1,011 B/s)
Selecting previously unselected package m4.
(正在读取数据库 ... 系统当前共安装有 196372 个⽂件和⽬录。)
正在解压缩 m4 (从 .../m4_1.4.16-2ubuntu1_i386.deb) ...
Selecting previously unselected package autoconf.
正在解压缩 autoconf (从 .../autoconf_2.68-1ubuntu2_all.deb) ...
Selecting previously unselected package autotools-dev.
正在解压缩 autotools-dev (从 .../autotools-dev_20120210.1ubuntu1_all.deb) ...
Selecting previously unselected package automake.
正在解压缩 automake (从 .../automake_1%3a1.11.3-1ubuntu2_all.deb) ...
正在处理⽤于 install-info 的触发器...
正在处理⽤于 man-db 的触发器...
正在处理⽤于 doc-base 的触发器...
Processing 1 added
正在设置 m4 (1.4.16-2ubuntu1) ...
正在设置 autoconf (2.68-1ubuntu2) ...
正在设置 autotools-dev (20120210.1ubuntu1) ...
正在设置 automake (1:1.11.3-1ubuntu2) ...
update-alternatives: 使⽤ /usr/bin/automake-1.11 来提供 /usr/bin/automake (automake),于⾃动模式中。
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code#
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code#
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# ./boostrap
bash: ./boostrap: 没有那个⽂件或⽬录
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# ls
AUTHORS          COPYING        ethercat.spec.in  INSTALL      master      TODO
bootstrap        COPYING.LESSER  examples          Kbuild.in    NEWS        tool
ChangeLog        devices        FEATURES          lib          README      tty
<  documentation  globals.h        m4          README.EoE
configure.ac    Doxyfile.in    include          Makefile.am  script
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# ./bootstrap + touch ChangeLog
+ autoreconf -i
Can't exec "libtoolize": 没有那个⽂件或⽬录 at /usr/bin/autoreconf line 196.
Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf line 196.
Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf line 196.
configure.ac:57: error: possibly undefined macro: AC_PROG_LIBTOOL
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# sudo apt-get install build-essential libtool 正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
将会安装下列额外的软件包:
dpkg-dev fakeroot g++ g++-4.6 libalgorithm-diff-perl libalgorithm-diff-xs-perl
libalgorithm-merge-perl libdpkg-perl libltdl-dev libstdc++6-4.6-dev
libtimedate-perl
建议安装的软件包:
debian-keyring g++-multilib g++-4.6-multilib gcc-4.6-doc libstdc++6-4.6-dbg
libtool-doc libstdc++6-4.6-doc gfortran fortran95-compiler gcj
下列【新】软件包将被安装:
build-essential dpkg-dev fakeroot g++ g++-4.6 libalgorithm-diff-perl
libalgorithm-diff-xs-perl libalgorithm-merge-perl libdpkg-perl libltdl-dev
libstdc++6-4.6-dev libtimedate-perl libtool
升级了 0 个软件包,新安装了 13 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 9,755 kB 的软件包。
解压缩后会消耗掉 29.8 MB 的额外空间。
您希望继续执⾏吗?[Y/n]y
获取:1 cn.archive.ubuntu/ubuntu/ precise/main libstdc++6-4.6-dev i386 4.6.3-1ubuntu5 [1,643 kB]
2% [1 libstdc++6-4.6-dev 184 kB/1,643 kB 11%]
获取:2 cn.archive.ubuntu/ubuntu/ precise/main g++-4.6 i386 4.6.3-1ubuntu5 [6,745 kB]
获取:3 cn.archive.ubuntu/ubuntu/ precise/main g++ i386 4:4.6.3-1ubuntu5 [1,444 B]
获取:4 cn.archive.ubuntu/ubuntu/ precise/main libtimedate-perl all 1.2000-1 [41.6 kB]
获取:5 cn.archive.ubuntu/ubuntu/ precise-updates/main libdpkg-perl all 1.16.1.2ubuntu7.8 [181 kB]
获取:6 cn.archive.ubuntu/ubuntu/ precise-updates/main dpkg-dev all 1.16.1.2ubuntu7.8 [
468 kB]
获取:7 cn.archive.ubuntu/ubuntu/ precise-updates/main build-essential i386 11.5ubuntu2.1 [5,796 B]
获取:8 cn.archive.ubuntu/ubuntu/ precise/main fakeroot i386 1.18.2-1 [87.9 kB]
获取:9 cn.archive.ubuntu/ubuntu/ precise/main libalgorithm-diff-perl all 1.19.02-2 [50.7 kB]
获取:10 cn.archive.ubuntu/ubuntu/ precise/main libalgorithm-diff-xs-perl i386 0.04-2build2 [12.9 kB]
获取:11 cn.archive.ubuntu/ubuntu/ precise/main libalgorithm-merge-perl all 0.08-2 [12.7 kB]
获取:12 cn.archive.ubuntu/ubuntu/ precise/main libltdl-dev i386 2.4.2-1ubuntu1 [203 kB]
获取:13 cn.archive.ubuntu/ubuntu/ precise/main libtool i386 2.4.2-1ubuntu1 [302 kB]
下载 9,755 kB,耗时 5分 55秒 (27.4 kB/s)
Selecting previously unselected package libstdc++6-4.6-dev.
(正在读取数据库 ... 系统当前共安装有 196660 个⽂件和⽬录。)
正在解压缩 libstdc++6-4.6-dev (从 .../libstdc++6-4.6-dev_4.6.3-1ubuntu5_i386.deb) ...
Selecting previously unselected package g++-4.6.
正在解压缩 g++-4.6 (从 .../g++-4.6_4.6.3-1ubuntu5_i386.deb) ...
Selecting previously unselected package g++.
正在解压缩 g++ (从 .../g++_4%3a4.6.3-1ubuntu5_i386.deb) ...
Selecting previously unselected package libtimedate-perl.
正在解压缩 libtimedate-perl (从 .../libtimedate-perl_1.2000-1_all.deb) ...
Selecting previously unselected package libdpkg-perl.
正在解压缩 libdpkg-perl (从 .../libdpkg-perl_1.16.1.2ubuntu7.8_all.deb) ...
Selecting previously unselected package dpkg-dev.
正在解压缩 dpkg-dev (从 .../dpkg-dev_1.16.1.2ubuntu7.8_all.deb) ...
Selecting previously unselected package build-essential.
正在解压缩 build-essential (从 .../build-essential_11.5ubuntu2.1_i386.deb) ...
Selecting previously unselected package fakeroot.
正在解压缩 fakeroot (从 .../fakeroot_1.18.2-1_i386.deb) ...
Selecting previously unselected package libalgorithm-diff-perl.
正在解压缩 libalgorithm-diff-perl (从 .../libalgorithm-diff-perl_1.19.02-2_all.deb) ...
Selecting previously unselected package libalgorithm-diff-xs-perl.
正在解压缩 libalgorithm-diff-xs-perl (从 .../libalgorithm-diff-xs-perl_0.04-2build2_i386.deb) ...
Selecting previously unselected package libalgorithm-merge-perl.
正在解压缩 libalgorithm-merge-perl (从 .../libalgorithm-merge-perl_0.08-2_all.deb) ...
Selecting previously unselected package libltdl-dev.
正在解压缩 libltdl-dev (从 .../libltdl-dev_2.4.2-1ubuntu1_i386.deb) ...
Selecting previously unselected package libtool.
正在解压缩 libtool (从 .../libtool_2.4.2-1ubuntu1_i386.deb) ...
正在解压缩 libtool (从 .../libtool_2.4.2-1ubuntu1_i386.deb) ...
正在处理⽤于 man-db 的触发器...
正在设置 libtimedate-perl (1.2000-1) ...
正在设置 libdpkg-perl (1.16.1.2ubuntu7.8) ...
正在设置 dpkg-dev (1.16.1.2ubuntu7.8) ...
正在设置 fakeroot (1.18.2-1) ...
update-alternatives: 使⽤ /usr/bin/fakeroot-sysv 来提供 /usr/bin/fakeroot (fakeroot),于⾃动模式中。
正在设置 libalgorithm-diff-perl (1.19.02-2) ...
正在设置 libalgorithm-diff-xs-perl (0.04-2build2) ...
正在设置 libalgorithm-merge-perl (0.08-2) ...
正在设置 libltdl-dev (2.4.2-1ubuntu1) ...
正在设置 libtool (2.4.2-1ubuntu1) ...
正在设置 libstdc++6-4.6-dev (4.6.3-1ubuntu5) ...
正在设置 g++-4.6 (4.6.3-1ubuntu5) ...
正在设置 g++ (4:4.6.3-1ubuntu5) ...
update-alternatives: 使⽤ /usr/bin/g++ 来提供 /usr/bin/c++ (c++),于⾃动模式中。
正在设置 build-essential (11.5ubuntu2.1) ...
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# ls
aclocal.m4        documentation    include      master      tool
AUTHORS        configure        Doxyfile.in      INSTALL      NEWS        tty
autoconf        configure.ac    ethercat.spec.in  Kbuild.in    README
autom4te.cache  COPYING          examples          lib          README.EoE
bootstrap      COPYING.LESSER  FEATURES          m4          script
ChangeLog      devices          globals.h        Makefile.am  TODO
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# ./bootstrap + touch ChangeLog + autoreconf -i
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `autoconf'.
libtoolize: copying file `autoconf/config.guess'
libtoolize: copying file `autoconf/config.sub'
libtoolize: copying file `autoconf/install-sh'
libtoolize: copying file `autoconf/ltmain.sh'
ubuntu安装教程
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
configure.ac:55: installing `autoconf/ar-lib'
configure.ac:54: installing `autoconf/compile'
configure.ac:44: installing `autoconf/missing'
examples/dc_user/Makefile.am: installing `autoconf/depcomp'
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code#
2、配置源码
命令:./configure
root@gemc2-VirtualBox:/home/gemc2/LinuxCNC/Ethercat/etherlabmaster-code# ./configure
checking for a /usr/bin/install -c
checking whether build environment yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking no
checking mawk
checking whether make sets $(MAKE)... yes
checking for style of include used GNU
checking gcc
checking whether the C yes
checking for C compiler default output a.out
checking for suffix
checking whether we are no
checking for suffix of o
checking whether we are using the GNU yes
checking whether gcc accepts -g... yes
checking for gcc option to accept none needed
checking dependency style gcc3
checking dependency style gcc3
checking whether gcc and cc understand -c and - yes
checking ar
checking the archiver (ar) ar
checking for g++... g++
checking whether we are using the GNU C++ yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking build i686-pc-linux-gnu
checking host i686-pc-linux-gnu
checking how to printf
checking for a sed that does not /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking /bin/grep -E
checking /bin/grep -F
checking for ld used /usr/bin/ld
checking if the linker (/usr/bin/ld) is yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) BSD nm
checking whether ln - yes
checking the maximum length of command line arguments (1572864)
checking whether the shell understands some yes
checking whether the shell understands "+="... yes
checking how to convert i686-pc-linux-gnu file names to func_convert_file_noop checking how to convert i686-pc-linux-gnu file names to func_convert_file_noop checking for /usr/bin/ld option to reload -r
checking objdump
checking how to recognize pass_all
checking no
checking how to associate runtime and printf %s\n
checking for archiver @ @
checking strip
checking ranlib
checking command to parse /usr/bin/nm -B output from ok
checking no
checking mt
checking if mt is a no
checking how to run the gcc -E
checking for ANSI C yes
checking for sys/ yes
checking for sys/ yes
checking for yes
checking for yes
checking for yes
checking for yes
checking for yes
checking for yes
checking for yes
checking for yes
checking .libs
checking if gcc supports -fno-rtti - no
checking for gcc option to -fPIC -DPIC
checking if gcc PIC flag -fPIC - yes
checking if gcc static flag - yes
checking if gcc supports -c - yes
checking if gcc supports -c - (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports yes
checking whether -lc should be explicitly no
checking dynamic GNU/Linux ld.so
checking how to hardcode library paths immediate
checking whether stripping libraries yes
checking if libtool supports yes
checking whether to build yes
checking whether to build yes
checking how to run the C++ g++ -E
checking for ld used by g++... /usr/bin/ld