官方文档里有的就在这里赘述了,官方文档里没有的要在下面说一下。
root@zyp-virtual-machine:/opt/L3.0.35_4.1.0_130816_source/ltib# ./ltibDon't have HTTP::Request::Common
Don't have LWP::UserAgent
Cannot test proxies, or remote file availability without both
HTTP::Request::Common and LWP::UserAgent You should not be root when running ltib, do you really
want to continue ? y|N y ltib cannot be run because one or more of the host packages needed to run it
are either missing or out of date or not in ltib's standard path. Please
install/upgrade these packages on your host. If you have your own utilities
in non-standard paths, please add an entry into the .ltibrc file for example: %path_std
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/my/own/exes Package Minimum ver Installed info
------- ----------- ---------------
zlib 0 not installed Died at ./ltib line 1409.
traceback:
main::host_checks:1409
main:554
Started: Mon Oct 6 11:02:06 2014
Ended: Mon Oct 6 11:02:08 2014
Elapsed: 2 seconds
Build Failed Exiting on error or interrupt
出现上面的情况怎么办呢?
在执行程序./ltib同一级目录中,进入bin目录,用vim打开Ltibutils.pm文件,底行模式输入/zlib回车,全文查找zlib,代码如下所示: zlib => sub { my @f = (glob('/usr/lib/libz.so*'),
glob('/lib/libz.so*'),
glob('/lib64/libz.so*'),
glob('/usr/lib/i386-linux-gnu/libz.so*'),
glob('/usr/lib32/libz.so*'),
glob('/usr/lib/x86_64-linux-gnu/libz.so*') ); @f > 1 ? 1 : 0 },
'zlib-devel' => sub { -f '/usr/include/zlib.h' }, 可见,zlib指向的是一个libz.so*的库文件,这个库文件可能位于/usr或者是/lib目录下,那么我们在/usr和/lib目录下,分别使用find ./ -depth -name libz.so*命令来找找看这个库文件的路径,肯定能找到的。 修改后的Ltibutils.pm如下所示: zlib => sub { my @f = (
glob('/usr/lib/i386-linux-gnu/libz.so*'),
glob('/lib/i386-linux-gnu/libz.so*'),
glob('/usr/lib/x86_64-linux-gnu/libz.so*') ); @f > 1 ? 1 : 0 },
'zlib-devel' => sub { -f '/usr/include/zlib.h' },
如果出现:
stdafx.h:30:36: fatal error: /usr/include/sys/types.h: No such file or directory compilation terminated. 那么在终端下执行apt-get install libc6-dev
如果出现:
/opt/freescale/ltib/usr/src/rpm/BUILD/elftosb-3.0.35-4.0.0/common/stdafx.h:30:36: fatal error: /usr/include/sys/types.h: No such file or directory
compilation terminated.
make[1]: *** [AESKey.o] Error 1
make[1]: Leaving directory `/opt/freescale/ltib/usr/src/rpm/BUILD/elftosb-3.0.35-4.0.0/bld/linux'
make: *** [all] Error 2
error: Bad exit status from /home/cody/i.mx6/ltib/tmp/rpm-tmp.77914 (%build)
RPM build errors:
Bad exit status from /home/cody/i.mx6/ltib/tmp/rpm-tmp.77914 (%build)
Build time for elftosb: 1 seconds
Failed building elftosb
Died at ./ltib line 1392.
traceback:
main::build_host_rpms:1392
main::host_checks:1447
main:554
解决:将下面内容保存为:elftosb-types_h-fix.patch并放在/opt/freescale/pkgs/目录
diff -rupN elftosb-11.09.01/common/stdafx.h elftosb-11.09.01-new/common/stdafx.h
--- elftosb-11.09.01/common/stdafx.h2011-03-01 05:05:19.000000000 +0100
+++ elftosb-11.09.01-new/common/stdafx.h2013-05-07 06:03:56.399989483 +0200
@@ -27,7 +27,7 @@
// For Linux systems only, types.h only defines the signed
// integer types. This is not professional code.
// Update: They are defined in the header files in the more recent version of redhat enterprise gcc.
-#include "/usr/include/sys/types.h"
+#include <sys/types.h>
#include <stdint.h>
//typedef unsigned long uint32_t;
//typedef unsigned short uint16_t;
diff -rupN elftosb-11.09.01/stdafx.h elftosb-11.09.01-new/stdafx.h
--- elftosb-11.09.01/stdafx.h2013-05-07 06:04:25.055987505 +0200
+++ elftosb-11.09.01-new/stdafx.h2013-05-07 06:03:23.671990775 +0200
@@ -27,7 +27,7 @@
// For Linux systems only, types.h only defines the signed
// integer types. This is not professional code.
// Update: They are defined in the header files in the more recent version of redhat enterprise gcc.
-#include "/usr/include/sys/types.h"
+#include <sys/types.h>
//typedef unsigned long uint32_t;
//typedef unsigned short uint16_t;
//typedef unsigned char uint8_t;
再编辑文件ltib_root/dist/lfs-5.1/elftosb/elftosb.spec,增加如下红色部分内容:
...
Source : %{name}-%{version}-%{release}.tar.gz
Patch0 : elftosb-types_h-fix.patch
BuildRoot : %{_tmppath}/%{name}
...
%setup -n %{name}-%{version}-%{release}
%patch0 -p1
%Build
make
...
再删掉/opt/freescale/ltib/usr/src/rpm/BUILD/elftosb-3.0.35-4.0.0,或其它以elftosb开头的,如有的话