2008年1月15日 星期二

FLTK with nxlib and nano-X

1.Modify configure.in
# LIBS="$LIBS -lXext -lX11 $X_EXTRA_LIBS"

If static link
LIBS="$LIBS -lnx11 -lnano-X $X_EXTRA_LIBS"

If dynamic link
LIBS="$LIBS -lX11 -lnano-X $X_EXTRA_LIBS"


2.Fix
Compiling Fl_x.cxx...
Fl_x.cxx: In function `int fl_wait(double)':
Fl_x.cxx:238: error: impossible constraint in `asm'
Fl_x.cxx:239: error: impossible constraint in `asm'
Fl_x.cxx:240: error: impossible constraint in `asm'
make[1]: *** [Fl_x.o] Error 1

The problem casue by reference to host header file.
Remove -I/usr/include to solve it.

Because we need X header files
cp -a /usr/include/X11 /usr/local/MIPSEL/mipsel-linux/include/

Add config param --x-include=-Iinclude

3.Configure
CFLAGS="-G 0" CXXFLAGS="-G 0" LDFLAGS="-s -L$PWD/../nxlib-0.45 -L$PWD/../microwindows-0.91/src/lib" ./configure --host=mipsel-linux --target=mipsel-linux --enable-shared --with-x --disable-gl --disable-cygwin --x-includes=include/ --x-libraries=$PWD/../nxlib-0.45 --cache-file=/dev/null

Fix ar in makeinclude
LIBCOMMAND = mipsel-linux-ar cr
Fix strip in makeinclude
STRIP = mipsel-linux-strip

4.make

5.Fix
Linking fluid...
../lib/libfltk.a(Fl_x.o)(.text+0x1420): In function `Fl::paste(Fl_Widget&, int)':
: undefined reference to `XConvertSelection'
../lib/libfltk.a(Fl_x.o)(.text+0x1624): In function `Fl::copy(char const*, int, int)':
: undefined reference to `XSetSelectionOwner'
../lib/libfltk.a(Fl_x.o)(.text+0x22c4): In function `fl_handle(_XEvent const&)':
: undefined reference to `XConvertSelection'
../lib/libfltk.a(fl_dnd.o)(.text+0x29c): In function `Fl::dnd()':
: undefined reference to `XSetSelectionOwner'
collect2: ld returned 1 exit status

Append the following to nxlib-0.45/stub.c
/* required for FLTK 1.1.7*/
int XConvertSelection() { printf("XConvertSelection called\n"); return 0; }
int XSetSelectionOwner() { printf("XSetSelectionOwner called\n"); return 0; }

6.vi test/Makefile

Mark following item

# fast_slow(EXEEXT) \
# keyboard$(EXEEXT) \
# mandelbrot$(EXEEXT) \
# preferences$(EXEEXT) \
# radio$(EXEEXT) \
# resize$(EXEEXT) \
# sudoku$(EXEEXT) \
# tabs$(EXEEXT) \
# valuators$(EXEEXT)

7.Copy shared library to lib/
cp src/*.so.*  lib/

8.make again to let demo programs on test/ as dynamic link

9.Library needed
/tmp # /lib/ld-2.2.5.so --list ./utf8
        libfltk-utf8.so.1.1 => /phone/lib/libfltk-utf8.so.1.1 (0x2aaa9000)
        libm.so.6 => /lib/libm.so.6 (0x2aba3000)
        libX11.so.6 => /phone/lib/libX11.so.6 (0x2ac65000)
        libnano-X.so => /usr/lib/libnano-X.so (0x2acdf000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2ad31000)
        libc.so.6 => /lib/libc.so.6 (0x2ad82000)
        /lib/ld.so.1 => /lib/ld-2.2.5.so (0x55550000)







沒有留言:

張貼留言