跨平台编译个小插件:重新开始,整理了一下思路,继续求助。

Trusty Tahr (长期支持)
hahaxiansheng
帖子: 79
注册时间: 2014-05-05 23:33
系统: ubuntu 13.04
送出感谢: 20 次
接收感谢: 0

跨平台编译个小插件:重新开始,整理了一下思路,继续求助。

#1

帖子 hahaxiansheng » 2014-05-24 22:14

跨平台编译:重新开始,整理了一下思路,继续求助。

本人纯新手,我理解的思路和操作过程具体描述如下,有不对的地方烦请前辈给予指正。因具体的专有名词只是意会,不懂得专业定义,所以只用我理解的意思表述出来。

目的:现有华为Hg255d路由器一台,已刷openwrt 12.09版(bin文件名称:20120909-DreamBox-ramips-rt305x-hg255d-squashfs-sysupgrade.bin),路由器运行正常,且dmesg|grep usb能识别挂载的pcsc设备,证明该系统已集成pcsc设备驱动。现在需要一个能在该路由器上运行的oscam插件,且该插件须支持pcsc协议。(注:oscam源码默认编译不支持pcsc协议)

前期尝试:上网本一台,并安装ubuntu 13.04 server(ubuntu-13.04-server-i386 .iso),在该系统上下载pcsc和oscam源码并编译,成功完成,编译出来的oscam能在该平台(上网本ubuntu系统)正常运行,且支持pcsc协议。

现在需要的是能运行在openwrt系统的oscam,且支持pcsc协议,这涉及到跨平台交叉编译(网上教程所学直呼)

准备平台:ubuntu 13.04 server,已安装必要的库依赖,已update+upgrade。

主要参考教程:http://www.streamboard.tv/oscam/wiki/crosscompiling

该教程提及的toolchain,我下载了OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2(39.7M,下载地址:http://downloads.openwrt.org/attitude_a ... .2.tar.bz2

因所参考教程涉及的目录不一样,所以我修改了所有操作命令并整理如下:

cd /tmp
tar -xf libusb-1.0.9.tar.bz2 -C /home/jacy/cross
tar -xf pcsc-lite-1.8.8.tar.bz2 -C /home/jacy/cross
tar -xf OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2 -C /home/jacy/cross

第一部分:
cd cross
cd libusb-1.0.9
export TOOLCHAIN=/home/jacy/cross/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2
export PATH="$TOOLCHAIN/bin:$PATH"
./configure --prefix=$TOOLCHAIN/usr --host=mipsel-openwrt-linux-uclibc
make
make install

第二部分:
cd pcsc-lite-1.8.8
export TOOLCHAIN=/home/jacy/cross/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2
export PATH="$TOOLCHAIN/bin:$PATH"
./configure CC=$TOOLCHAIN/bin/mipsel-openwrt-linux-uclibc-gcc-4.6.3 --disable-libudev --host=mipsel-openwrt-linux-uclibc --prefix=$TOOLCHAIN/usr --exec-prefix=$TOOLCHAIN/usr --disable-shared LIBUSB_LIBS="-L$TOOLCHAIN/usr/lib -lusb-1.0" LIBUSB_CFLAGS="-I$TOOLCHAIN/usr/include/libusb-1.0"
make
make install

第三部分:
cd
sudo svn co http://streamboard.de.vu/svn/oscam/trunk oscam
cd oscam
export TOOLCHAIN=/home/jacy/cross/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2
make CROSS=$TOOLCHAIN/bin/mipsel-openwrt-linux-uclibc- USE_PCSC=1 EXTRA_FLAGS="-I$TOOLCHAIN/usr/include/PCSC"
cd build
cmake ..
make

问题:第一部分./configure的时候未提示error,但是make的时候提示mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable 'STAGING_DIR' ,查阅config.log
,提示mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable 'STAGING_DIR' not defined。
网上查阅资料,意思是说要定义'STAGING_DIR'的路径,把'STAGING_DIR'的路径添加到环境变量。但是在我下载的toochain里面没有staring_dir的目录。
前几天测试的时候,我一并下载了OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2 .tar.bz2(这文件超大,有594M,下载地址:http://downloads.openwrt.org/attitude_a ... .2.tar.bz2)。tar之后,我发现这个SDK文件夹下面有staring_dir目录,而且我之前下载的toochain所有文件目录就在staring_dir目录之下。
如果参照教程,那我究竟是需要下载OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2还是OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2 .tar.bz2文件?
因之前下载的SDK文件在tmp目录,没有拿出来,重启后没了。现在重新下载,只能下载完再测试了。

命令中的目录都是参照教程依葫芦画瓢修改的,如果分析问题所在需要详细的目录名称,我可以ls贴上来。
hahaxiansheng
帖子: 79
注册时间: 2014-05-05 23:33
系统: ubuntu 13.04
送出感谢: 20 次
接收感谢: 0

Re: 跨平台编译个小插件:重新开始,整理了一下思路,继续求助。

#2

帖子 hahaxiansheng » 2014-05-24 22:49

因个人对linux纯属新手(学法学出身的,汗)。所以开始想着参照网上的教程依葫芦画瓢去实现,但是中途遇见各种各样的问题傻了眼了。
举个不太恰当的比喻:这就如90岁的老人上手术台,各种并发症接踵而至。解决这个问题又出那个问题,解决那个问题又出另一个问题,一步步下来

最后根本不知道到底哪里出了问题。

后来停了几天,查阅了一些资料,重新整理了一下思路,对整个过程大致理解如下:

1.我需要的交叉编译,就是在ubuntu平台下,去编译一个openwrt平台下运行的插件。
2.这个openwrt平台,因为跟路由器CPU架构对应,所以需要对应的openwrt环境。这个环境有现成的可使用,就是下载的对应的toolchain。
3.我需要支持pcsc协议的oscam插件,具体操作流程是:oscam依赖make好的PCSC,make pcsc依赖libusb,所以先make install libusb,然后再make

install pcsc,最后make oscam的时候,指定PCSC的目录。
4.命令中:
export TOOLCHAIN=就是指定toolchain的目录,下次整个目录可以用$TOOLCHAIN代替;
export PATH="$TOOLCHAIN/bin:$PATH" 就是指定编译的时候使用的程序文件,与CC=的意思一样?
./configure 就是配置编译的环境设置调用文件等,config.log可以查看详细结果,比如文件安装到了什么位置等,下次调用的时候指定目录等;
--prefix=就是指定install到什么目录,这个目录只要下次需要用的时候能找到就行;
--host=就是目标平台的整个目录,备下次使用,这个貌似可以自定义,只要下次指定到它就行;(不太确定)
-L就是指定库文件所在位置,-I就是制定include所在位置
make和make install就是编译了,如果./configure出错,make就无从谈起。


见笑了,这样理解不知道对不对。
hahaxiansheng
帖子: 79
注册时间: 2014-05-05 23:33
系统: ubuntu 13.04
送出感谢: 20 次
接收感谢: 0

Re: 跨平台编译个小插件:重新开始,整理了一下思路,继续求助。

#3

帖子 hahaxiansheng » 2014-05-24 23:41

附上几个目录的ls
jacy@ubuntu:~/cross/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2$ ls
LICENSE README.TOOLCHAIN toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2 version.mk

jacy@ubuntu:~/cross/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2$ cd toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2
jacy@ubuntu:~/cross/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2$ ls
bin include info.mk initial lib lib64 libexec mipsel-openwrt-linux mipsel-openwrt-linux-uclibc sbin share usr


jacy@ubuntu:~/cross/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2$ cd bin
jacy@ubuntu:~/cross/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin$ ls
g++-uc mipsel-openwrt-linux-gprof mipsel-openwrt-linux-uclibc-c++ mipsel-openwrt-linux-uclibc-ld
g++-uc+std mipsel-openwrt-linux-ld mipsel-openwrt-linux-uclibc-c++.bin mipsel-openwrt-linux-uclibc-ld.bfd
ldd mipsel-openwrt-linux-ld.bfd mipsel-openwrt-linux-uclibc-cc mipsel-openwrt-linux-uclibc-ld.bin
mipsel-openwrt-linux-addr2line mipsel-openwrt-linux-nm mipsel-openwrt-linux-uclibc-c++filt mipsel-openwrt-linux-uclibc-nm
mipsel-openwrt-linux-ar mipsel-openwrt-linux-objcopy mipsel-openwrt-linux-uclibc-cpp mipsel-openwrt-linux-uclibc-objcopy
mipsel-openwrt-linux-as mipsel-openwrt-linux-objdump mipsel-openwrt-linux-uclibc-cpp.bin mipsel-openwrt-linux-uclibc-objdump
mipsel-openwrt-linux-c++ mipsel-openwrt-linux-ranlib mipsel-openwrt-linux-uclibc-elfedit mipsel-openwrt-linux-uclibc-ranlib
mipsel-openwrt-linux-c++filt mipsel-openwrt-linux-readelf mipsel-openwrt-linux-uclibc-g++ mipsel-openwrt-linux-uclibc-readelf
mipsel-openwrt-linux-cpp mipsel-openwrt-linux-size mipsel-openwrt-linux-uclibc-g++.bin mipsel-openwrt-linux-uclibc-size
mipsel-openwrt-linux-elfedit mipsel-openwrt-linux-strings mipsel-openwrt-linux-uclibc-gcc mipsel-openwrt-linux-uclibc-strings
mipsel-openwrt-linux-g++ mipsel-openwrt-linux-strip mipsel-openwrt-linux-uclibc-gcc-4.6.3 mipsel-openwrt-linux-uclibc-strip
mipsel-openwrt-linux-gcc mipsel-openwrt-linux-uclibc-addr2line mipsel-openwrt-linux-uclibc-gcc.bin mipsel-openwrt-linux-uclibc-wrapper.sh
mipsel-openwrt-linux-gcc-4.6.3 mipsel-openwrt-linux-uclibc-ar mipsel-openwrt-linux-uclibc-gcov
mipsel-openwrt-linux-gcov mipsel-openwrt-linux-uclibc-as mipsel-openwrt-linux-uclibc-gdb
mipsel-openwrt-linux-gdb mipsel-openwrt-linux-uclibc-as.bin mipsel-openwrt-linux-uclibc-gprof
jacy@ubuntu:~/cross/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin$
hahaxiansheng
帖子: 79
注册时间: 2014-05-05 23:33
系统: ubuntu 13.04
送出感谢: 20 次
接收感谢: 0

Re: 跨平台编译个小插件:重新开始,整理了一下思路,继续求助。

#4

帖子 hahaxiansheng » 2014-05-24 23:42

附上几个目录的ls
jacy@ubuntu:~/cross/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2$ ls
LICENSE README.TOOLCHAIN toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2 version.mk

jacy@ubuntu:~/cross/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2$ cd toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2
jacy@ubuntu:~/cross/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2$ ls
bin include info.mk initial lib lib64 libexec mipsel-openwrt-linux mipsel-openwrt-linux-uclibc sbin share usr


jacy@ubuntu:~/cross/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2$ cd bin
jacy@ubuntu:~/cross/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin$ ls
g++-uc mipsel-openwrt-linux-gprof mipsel-openwrt-linux-uclibc-c++ mipsel-openwrt-linux-uclibc-ld
g++-uc+std mipsel-openwrt-linux-ld mipsel-openwrt-linux-uclibc-c++.bin mipsel-openwrt-linux-uclibc-ld.bfd
ldd mipsel-openwrt-linux-ld.bfd mipsel-openwrt-linux-uclibc-cc mipsel-openwrt-linux-uclibc-ld.bin
mipsel-openwrt-linux-addr2line mipsel-openwrt-linux-nm mipsel-openwrt-linux-uclibc-c++filt mipsel-openwrt-linux-uclibc-nm
mipsel-openwrt-linux-ar mipsel-openwrt-linux-objcopy mipsel-openwrt-linux-uclibc-cpp mipsel-openwrt-linux-uclibc-objcopy
mipsel-openwrt-linux-as mipsel-openwrt-linux-objdump mipsel-openwrt-linux-uclibc-cpp.bin mipsel-openwrt-linux-uclibc-objdump
mipsel-openwrt-linux-c++ mipsel-openwrt-linux-ranlib mipsel-openwrt-linux-uclibc-elfedit mipsel-openwrt-linux-uclibc-ranlib
mipsel-openwrt-linux-c++filt mipsel-openwrt-linux-readelf mipsel-openwrt-linux-uclibc-g++ mipsel-openwrt-linux-uclibc-readelf
mipsel-openwrt-linux-cpp mipsel-openwrt-linux-size mipsel-openwrt-linux-uclibc-g++.bin mipsel-openwrt-linux-uclibc-size
mipsel-openwrt-linux-elfedit mipsel-openwrt-linux-strings mipsel-openwrt-linux-uclibc-gcc mipsel-openwrt-linux-uclibc-strings
mipsel-openwrt-linux-g++ mipsel-openwrt-linux-strip mipsel-openwrt-linux-uclibc-gcc-4.6.3 mipsel-openwrt-linux-uclibc-strip
mipsel-openwrt-linux-gcc mipsel-openwrt-linux-uclibc-addr2line mipsel-openwrt-linux-uclibc-gcc.bin mipsel-openwrt-linux-uclibc-wrapper.sh
mipsel-openwrt-linux-gcc-4.6.3 mipsel-openwrt-linux-uclibc-ar mipsel-openwrt-linux-uclibc-gcov
mipsel-openwrt-linux-gcov mipsel-openwrt-linux-uclibc-as mipsel-openwrt-linux-uclibc-gdb
mipsel-openwrt-linux-gdb mipsel-openwrt-linux-uclibc-as.bin mipsel-openwrt-linux-uclibc-gprof
jacy@ubuntu:~/cross/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin$
hahaxiansheng
帖子: 79
注册时间: 2014-05-05 23:33
系统: ubuntu 13.04
送出感谢: 20 次
接收感谢: 0

Re: 跨平台编译个小插件:重新开始,整理了一下思路,继续求助。

#5

帖子 hahaxiansheng » 2014-05-24 23:44

这是OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2文件tar后的ls

jacy@ubuntu:~$ cd cross
jacy@ubuntu:~/cross$ cd OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2
jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2$ ls
Config.in dl docs feeds.conf.default include LICENSE Makefile package README.SDK rules.mk scripts staging_dir target
jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2$ cd staging_dir
jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir$ ls
host target-mipsel_r2_uClibc-0.9.33.2 toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2
jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir$ cd toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2
jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2$ ls
bin include info.mk initial lib lib64 libexec mipsel-openwrt-linux mipsel-openwrt-linux-uclibc sbin share usr
jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2$ cd bin
jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin$ ls
g++-uc mipsel-openwrt-linux-gcov mipsel-openwrt-linux-uclibc-addr2line mipsel-openwrt-linux-uclibc-ld
g++-uc+std mipsel-openwrt-linux-gdb mipsel-openwrt-linux-uclibc-ar mipsel-openwrt-linux-uclibc-ld.bfd
ldd mipsel-openwrt-linux-gprof mipsel-openwrt-linux-uclibc-as mipsel-openwrt-linux-uclibc-nm
mipsel-openwrt-linux-addr2line mipsel-openwrt-linux-ld mipsel-openwrt-linux-uclibc-c++ mipsel-openwrt-linux-uclibc-objcopy
mipsel-openwrt-linux-ar mipsel-openwrt-linux-ld.bfd mipsel-openwrt-linux-uclibc-c++filt mipsel-openwrt-linux-uclibc-objdump
mipsel-openwrt-linux-as mipsel-openwrt-linux-nm mipsel-openwrt-linux-uclibc-cpp mipsel-openwrt-linux-uclibc-ranlib
mipsel-openwrt-linux-c++ mipsel-openwrt-linux-objcopy mipsel-openwrt-linux-uclibc-elfedit mipsel-openwrt-linux-uclibc-readelf
mipsel-openwrt-linux-c++filt mipsel-openwrt-linux-objdump mipsel-openwrt-linux-uclibc-g++ mipsel-openwrt-linux-uclibc-size
mipsel-openwrt-linux-cpp mipsel-openwrt-linux-ranlib mipsel-openwrt-linux-uclibc-gcc mipsel-openwrt-linux-uclibc-strings
mipsel-openwrt-linux-elfedit mipsel-openwrt-linux-readelf mipsel-openwrt-linux-uclibc-gcc-4.6.3 mipsel-openwrt-linux-uclibc-strip
mipsel-openwrt-linux-g++ mipsel-openwrt-linux-size mipsel-openwrt-linux-uclibc-gcov
mipsel-openwrt-linux-gcc mipsel-openwrt-linux-strings mipsel-openwrt-linux-uclibc-gdb
mipsel-openwrt-linux-gcc-4.6.3 mipsel-openwrt-linux-strip mipsel-openwrt-linux-uclibc-gprof
jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin$
hahaxiansheng
帖子: 79
注册时间: 2014-05-05 23:33
系统: ubuntu 13.04
送出感谢: 20 次
接收感谢: 0

Re: 跨平台编译个小插件:重新开始,整理了一下思路,继续求助。

#6

帖子 hahaxiansheng » 2014-05-25 0:06

改用OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2解压之后目录里的toolchain继续操作:

tar -xf OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2 -C /home/jacy/cross
cd
cd /cross/liubus-1.0.9
export TOOLCHAIN=/home/jacy/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2
export PATH="$TOOLCHAIN/bin:$PATH"
export STAGING_DIR=/home/jacy/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin:$STAGING_DIR
./configure --prefix=$TOOLCHAIN/usr --host=mipsel-openwrt-linux-uclibc
make
make install

这一步貌似顺利,查看$TOOLCHAIN/usr/lib和include下原来无文件,make intall之后的ls
jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/lib$ ls
libusb-1.0.a libusb-1.0.la libusb-1.0.so libusb-1.0.so.0 libusb-1.0.so.0.1.0 pkgconfig

jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include$ ls
libusb-1.0
jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include$ cd libusb-1.0
jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/libusb-1.0$ ls
libusb.h
hahaxiansheng
帖子: 79
注册时间: 2014-05-05 23:33
系统: ubuntu 13.04
送出感谢: 20 次
接收感谢: 0

Re: 跨平台编译个小插件:重新开始,整理了一下思路,继续求助。

#7

帖子 hahaxiansheng » 2014-05-25 0:23

继续操作

cd pcsc-lite-1.8.8
export TOOLCHAIN=/home/jacy/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2
export PATH="$TOOLCHAIN/bin:$PATH"
export STAGING_DIR=/home/jacy/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin:$STAGING_DIR
./configure CC=$TOOLCHAIN/bin/mipsel-openwrt-linux-uclibc-gcc-4.6.3 --disable-libudev --host=mipsel-openwrt-linux-uclibc --prefix=$TOOLCHAIN/usr --exec-prefix=$TOOLCHAIN/usr --disable-shared LIBUSB_LIBS="-L$TOOLCHAIN/usr/lib -lusb-1.0" LIBUSB_CFLAGS="-I$TOOLCHAIN/usr/include/libusb-1.0"
make
make install

这一步貌似也成功了。

jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/lib$ ls
libpcsclite.a libpcsclite.la libpcscspy.a libpcscspy.la libusb-1.0.a libusb-1.0.la libusb-1.0.so libusb-1.0.so.0 libusb-1.0.so.0.1.0 pkgconfig

jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include$ ls
libusb-1.0 PCSC
jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include$ cd PCSC
jacy@ubuntu:~/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/PCSC$ ls
debuglog.h ifdhandler.h pcsclite.h reader.h winscard.h wintypes.h
hahaxiansheng
帖子: 79
注册时间: 2014-05-05 23:33
系统: ubuntu 13.04
送出感谢: 20 次
接收感谢: 0

Re: 跨平台编译个小插件:重新开始,整理了一下思路,继续求助。

#8

帖子 hahaxiansheng » 2014-05-25 0:33

继续操作
cd
svn co http://streamboard.de.vu/svn/oscam/trunk oscam
cd oscam
export TOOLCHAIN=/home/jacy/cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2
make CROSS=$TOOLCHAIN/bin/mipsel-openwrt-linux-uclibc- USE_PCSC=1 EXTRA_FLAGS="-I$TOOLCHAIN/usr/include/PCSC"

这一步出错:csctapi/ifd_pcsc.c:14:27: fatal error: PCSC/pcsclite.h: No such file or directory
compilation terminated.
make[1]: *** [build/mipsel-openwrt-linux-uclibc-pcsc/csctapi/ifd_pcsc.o] Error 1
make: *** [all] Error 2

显示PCSC目录下没有pcsclite.h文件,但是实际上这个位置有pcsclite.h这个文件,不明原因。
hahaxiansheng
帖子: 79
注册时间: 2014-05-05 23:33
系统: ubuntu 13.04
送出感谢: 20 次
接收感谢: 0

Re: 跨平台编译个小插件:重新开始,整理了一下思路,继续求助。

#9

帖子 hahaxiansheng » 2014-05-25 0:51

jacy@ubuntu:~$ find | grep pcsclite.h
./cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging _dir/target-mipsel_r2_uClibc-0.9.33.2/usr/include/PCSC/pcsclite.h
./cross/OpenWrt-SDK-ramips-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2/staging _dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/PCSC/pcsclit e.h
./cross/pcsc-lite-1.8.8/src/PCSC/pcsclite.h
./cross/pcsc-lite-1.8.8/src/PCSC/pcsclite.h.in
hahaxiansheng
帖子: 79
注册时间: 2014-05-05 23:33
系统: ubuntu 13.04
送出感谢: 20 次
接收感谢: 0

Re: 跨平台编译个小插件:重新开始,整理了一下思路,继续求助。

#10

帖子 hahaxiansheng » 2014-05-27 9:05

有没有人指点一下啊。
头像
astolia
论坛版主
帖子: 3091
注册时间: 2008-09-18 13:11
送出感谢: 1 次
接收感谢: 511 次

Re: 跨平台编译个小插件:重新开始,整理了一下思路,继续求助。

#12

帖子 astolia » 2014-05-27 17:45

hahaxiansheng 写了: make CROSS=$TOOLCHAIN/bin/mipsel-openwrt-linux-uclibc- USE_PCSC=1 EXTRA_FLAGS="-I$TOOLCHAIN/usr/include/PCSC"
看起来是这个查找路径有问题。
指明头文件的查找目录是$TOOLCHAIN/usr/include/PCSC,程序代码中用的却是#include "PCSC/pcsclite.h"这样的语句,导致查找位置成了$TOOLCHAIN/usr/include/PCSC/PCSC/pcsclite.h,所以就找不到文件了

把最后的PCSC去掉试试
hahaxiansheng
帖子: 79
注册时间: 2014-05-05 23:33
系统: ubuntu 13.04
送出感谢: 20 次
接收感谢: 0

Re: 跨平台编译个小插件:重新开始,整理了一下思路,继续求助。

#13

帖子 hahaxiansheng » 2014-05-29 17:58


谢谢!好像是toolchain有问题。
hahaxiansheng
帖子: 79
注册时间: 2014-05-05 23:33
系统: ubuntu 13.04
送出感谢: 20 次
接收感谢: 0

Re: 跨平台编译个小插件:重新开始,整理了一下思路,继续求助。

#14

帖子 hahaxiansheng » 2014-05-29 17:59

astolia 写了:
hahaxiansheng 写了: make CROSS=$TOOLCHAIN/bin/mipsel-openwrt-linux-uclibc- USE_PCSC=1 EXTRA_FLAGS="-I$TOOLCHAIN/usr/include/PCSC"
看起来是这个查找路径有问题。
指明头文件的查找目录是$TOOLCHAIN/usr/include/PCSC,程序代码中用的却是#include "PCSC/pcsclite.h"这样的语句,导致查找位置成了$TOOLCHAIN/usr/include/PCSC/PCSC/pcsclite.h,所以就找不到文件了

把最后的PCSC去掉试试

谢谢!后来没搞了,好像这个hg255d的toolchain有问题。我用同样的方法,编译FW300R上成功了。
头像
crc8
帖子: 95
注册时间: 2008-01-12 1:19
送出感谢: 2 次
接收感谢: 0
联系:

Re: 跨平台编译个小插件:重新开始,整理了一下思路,继续求助。

#15

帖子 crc8 » 2014-10-31 17:10

hahaxiansheng 写了: make CROSS=$TOOLCHAIN/bin/mipsel-openwrt-linux-uclibc- USE_PCSC=1 EXTRA_FLAGS="-I$TOOLCHAIN/usr/include/PCSC"


看起来是这个查找路径有问题。
指明头文件的查找目录是$TOOLCHAIN/usr/include/PCSC,程序代码中用的却是#include "PCSC/pcsclite.h"这样的语句,导致查找位置成了$TOOLCHAIN/usr/include/PCSC/PCSC/pcsclite.h,所以就找不到文件了

把最后的PCSC去掉试试


谢谢!后来没搞了,好像这个hg255d的toolchain有问题。我用同样的方法,编译FW300R上成功了。
FW300R 有USB接口?
回复

回到 “Ubuntu 14.04 LTS”