Python 如何为openwrt路由器编译Pycup?

Python 如何为openwrt路由器编译Pycup?,python,mips,openwrt,cross-compiling,cups,Python,Mips,Openwrt,Cross Compiling,Cups,我正在尝试为我的tl-wdr4300编译pycups。我使用debian stable进行编译 我得到的第一个错误是: 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/ LDFL

我正在尝试为我的tl-wdr4300编译pycups。我使用debian stable进行编译

我得到的第一个错误是:

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
之后,我将cups、iconv.h和python2.7从/usr/include复制到/home/linuxlover/openwrt/trunk/staging\u dir/toolchain-mips\u 34kc\u gcc-4.6-linaro\u 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

看起来您将
gcc
设置为链接器,而不是
mips openwrt linux uclibc gcc

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