交叉编译FLTK

配置脚本:

 

#!/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 

遇到问题:
1.src/filename_list.cxx文件的fltk::filename_list函数问题:
错误信息:
filename_list.cxx: In function 'int fltk::filename_list(const char*, dirent64***, int (*)(const dirent64* const*, const dirent64* const*))':
filename_list.cxx:69: error: invalid conversion from 'int (*)(const void*, const void*)' to 'int (*)(const dirent64**, const dirent64**)'
filename_list.cxx:69: error:   initializing argument 4 of 'int scandir64(const char*, dirent64***, int (*)(const dirent64*), int (*)(const dirent64**, const dirent64**))'
make[1]: *** [filename_list.o] 错误 1
解决办法:
修改filename_list.cxx:69行改为:int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);

 

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

# libraries to link with:
 #LDLIBS =  -L/usr/lib  -lXi -lXinerama -lpthread -lm  -lXext  -lsupc++
 LDLIBS =  -L/home/mstar/Obama/SDK/opt/lib   -lpthread -lm  -lsupc++
 #GLDLIBS =  -L/usr/lib   -lXi -lXinerama -lpthread -lm  -lXext  -lsupc++
 GLDLIBS =  -L/home/mstar/Obama/SDK/opt/lib  -lpthread -lm  -lsupc++

 

你可能感兴趣的:(function,list,脚本,include,float,compiler)