2013-10-31 52 views
0

我正在編譯我的tl-wdr4300的pycups。我使用debian stable編譯。如何編譯openwrt路由器的pycups?

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 /包括向/home/linuxlover/openwrt/trunk/staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/usr /有/

最後一個錯誤:

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 

回答

0

看起來你有gcc設爲您的鏈接,而不是mips-openwrt-linux-uclibc-gcc

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

是的,但我寫了這個LD = mips-openwrt-linux-uclibc-ld – Admdebian