如何为openwrt路由器编译pycups?

时间:2013-10-31 16:53:22

标签: python mips openwrt cross-compiling cups

我要为我的tl-wdr4300编译pycups。我使用debian stable来编译。

https://pypi.python.org/pypi/pycups

http://wiki.openwrt.org/doc/devel/crosscompile

我得到的第一个错误:

make CC=mips-openwrt-linux-uclibc-gcc LD=mips-openwrt-linux-uclibc-ld CFLAGS=/home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/ LDFLAGS=/home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/lib/
python setup.py build
running build
running build_ext
building 'cups' extension
creating build
creating build/temp.linux-x86_64-2.7
mips-openwrt-linux-uclibc-gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/ -fPIC -DVERSION="1.9.63" -I/usr/include/python2.7 -c cupsmodule.c -o build/temp.linux-x86_64-2.7/cupsmodule.o
In file included from /usr/include/python2.7/Python.h:58:0,
                 from cupsmodule.c:22:
/usr/include/python2.7/pyport.h:873:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
error: command 'mips-openwrt-linux-uclibc-gcc' failed with exit status 1
make: *** [cups.so] Error 1

我知道这是一个坏主意,但是我编辑了/usr/include/python2.7/pyport.h并改变了这个条件

#if LONG_BIT != 8 * SIZEOF_LONG

第二个错误:

make CC=mips-openwrt-linux-uclibc-gcc LD=mips-openwrt-linux-uclibc-ld CFLAGS=/home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/ LDFLAGS=/home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/lib/
python setup.py build
running build
running build_ext
building 'cups' extension
creating build
creating build/temp.linux-x86_64-2.7
mips-openwrt-linux-uclibc-gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/ -fPIC -DVERSION="1.9.63" -I/usr/include/python2.7 -c cupsmodule.c -o build/temp.linux-x86_64-2.7/cupsmodule.o
cupsmodule.c:23:23: fatal error: cups/cups.h: No such file or directory
compilation terminated.
error: command 'mips-openwrt-linux-uclibc-gcc' failed with exit status 1
make: *** [cups.so] Error 1

之后我将杯子,iconv.h和python2.7从/ usr / include复制到/home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/ < / p>

上次错误:

make CC=mips-openwrt-linux-uclibc-gcc LD=mips-openwrt-linux-uclibc-ld CFLAGS=/home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/ LDFLAGS=/home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/lib/
python setup.py build
running build
running build_ext
building 'cups' extension
creating build
creating build/temp.linux-x86_64-2.7
mips-openwrt-linux-uclibc-gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/ -fPIC -DVERSION="1.9.63" -I/usr/include/python2.7 -c cupsmodule.c -o build/temp.linux-x86_64-2.7/cupsmodule.o
mips-openwrt-linux-uclibc-gcc: warning: /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/: linker input file unused because linking not done
mips-openwrt-linux-uclibc-gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/ -fPIC -DVERSION="1.9.63" -I/usr/include/python2.7 -c cupsconnection.c -o build/temp.linux-x86_64-2.7/cupsconnection.o
    mips-openwrt-linux-uclibc-gcc: warning: /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/: linker input file unused because linking not done
mips-openwrt-linux-uclibc-gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/ -fPIC -DVERSION="1.9.63" -I/usr/include/python2.7 -c cupsppd.c -o build/temp.linux-x86_64-2.7/cupsppd.o
mips-openwrt-linux-uclibc-gcc: warning: /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/: linker input file unused because linking not done
mips-openwrt-linux-uclibc-gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/ -fPIC -DVERSION="1.9.63" -I/usr/include/python2.7 -c cupsipp.c -o build/temp.linux-x86_64-2.7/cupsipp.o
mips-openwrt-linux-uclibc-gcc: warning: /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/: linker input file unused because linking not done
creating build/lib.linux-x86_64-2.7
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/lib/ /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/lib/ /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/ build/temp.linux-x86_64-2.7/cupsmodule.o build/temp.linux-x86_64-2.7/cupsconnection.o build/temp.linux-x86_64-2.7/cupsppd.o build/temp.linux-x86_64-2.7/cupsipp.o -lcups -o build/lib.linux-x86_64-2.7/cups.so
/usr/bin/ld: cannot find /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/lib/: File format not recognized
/usr/bin/ld: cannot find /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/lib/: File format not recognized
/usr/bin/ld: cannot find /home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr/include/: File format not recognized
/usr/bin/ld: build/temp.linux-x86_64-2.7/cupsmodule.o: Relocations in generic ELF (EM: 8)
/usr/bin/ld: build/temp.linux-x86_64-2.7/cupsmodule.o: Relocations in generic ELF (EM: 8)
/usr/bin/ld: build/temp.linux-x86_64-2.7/cupsmodule.o: Relocations in generic ELF (EM: 8)
/usr/bin/ld: build/temp.linux-x86_64-2.7/cupsmodule.o: Relocations in generic ELF (EM: 8)
/usr/bin/ld: build/temp.linux-x86_64-2.7/cupsmodule.o: Relocations in generic ELF (EM: 8)
/usr/bin/ld: build/temp.linux-x86_64-2.7/cupsmodule.o: Relocations in generic ELF (EM: 8)
/usr/bin/ld: build/temp.linux-x86_64-2.7/cupsmodule.o: Relocations in generic ELF (EM: 8)
/usr/bin/ld: build/temp.linux-x86_64-2.7/cupsmodule.o: Relocations in generic ELF (EM: 8)
build/temp.linux-x86_64-2.7/cupsmodule.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
make: *** [cups.so] Error 1

1 个答案:

答案 0 :(得分:0)

您似乎将gcc设置为链接器而不是mips-openwrt-linux-uclibc-gcc

mips-openwrt-linux-uclibc-gcc: warning: ......
creating build/lib.linux-x86_64-2.7
gcc -pthread -shared .......