配置脚本:
#!/bin/bash
PREFIX=/home/mstar/mips-4.3/mips-linux-gnu/libc
CC=mips-linux-gnu-gcc /
CXX=mips-linux-gnu-g++ /
AR=mips-linux-gnu-ar /
RANLIB=mips-linux-gnu-ranlib /
NM=mips-linux-gnu-nm /
AS=mips-linux-gnu-as /
LD=mips-linux-gnu-ld /
STRIP=mips-linux-gnu-strip /
READELF=mips-linux-gnu-readelf /
STRINGS=mips-linux-gnu-strings /
SIZE=mips-linux-gnu-size /
ADDR2LINE=mips-linux-gnu-addr2line /
CFLAGS="-g -I${PREFIX}/user/include -I${PREFIX}/uclibc/user/include -I/home/mstar/Obama/SDK/opt/include" /
LDFLAGS="-L${PREFIX}/user/lib -L${PREFIX}/uclibc/user/lib -L/home/mstar/Obama/SDK/opt/lib" /
LIBS="-L${PREFIX}/user/lib -L${PREFIX}/uclibc/user/lib -L/home/mstar/Obama/SDK/opt/lib" /
CPPFLAGS="-g -I${PREFIX}/user/include -I${PREFIX}/uclibc/user/include -I/home/mstar/Obama/SDK/opt/include" /
CXXFLAGS="-g -I${PREFIX}/user/include -I${PREFIX}/uclibc/user/include -I/home/mstar/Obama/SDK/opt/include" /
./configure /
--build=i386-linux /
--host=mips-linux-gnu /
--target=mips-linux-gnu /
--prefix=/home/mstar/malin/FLTK /
--enable-jpeg /
--enable-zlib /
--enable-png /
--disable-xft /
--disable-x11 /
--libdir=/home/mstar/Obama/SDK/opt/lib /
--includedir=/home/mstar/Obama/SDK/opt/include /
--enable-debug /
--enable-shared /
--enable-directfb=yes /
--with-archflags="-I /home/mstar/Obama/SDK/opt/include/directfb" /
--enable-gl=no
2.FD_ZERO,FD_SET等函数问题
错误信息:
cc1plus: warning: include location "/usr/include" is unsafe for cross-compilation
x11/run.cxx: In function 'int fl_wait(float)':
x11/run.cxx:461: error: impossible constraint in 'asm'
x11/run.cxx:462: error: impossible constraint in 'asm'
x11/run.cxx:463: error: impossible constraint in 'asm'
解决办法:
/usr/include/bits/select.h文件用自己交叉编译SDK包当中的include/bits/select.h替换。
3.修改makeinclude
# flags for C++ compiler:
OPTIM = -g -Wall -Wunused -fPIC
#CFLAGS = $(OPTIM) -I/usr/include
CFLAGS = $(OPTIM) -I/home/mstar/Obama/SDK/opt/include
#CXXFLAGS = $(OPTIM) -I/usr/include -Wno-non-virtual-dtor
CXXFLAGS = $(OPTIM) -I/home/mstar/Obama/SDK/opt/include -Wno-non-virtual-dtor