如何为openwrt路由器编译pycups?

2024-05-14 22:24:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我正设法为我的tl-wdr4300编译pycups。我使用debian稳定程序来编译。在

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并更改了这个条件

^{pr2}$

第二个错误:

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

之后,我将cups、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/

上次错误:

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

Tags: buildhomeincludelinuxusrdirx86gcc

热门问题