在redhat9中交叉编译nano-X nxlib和fltk

来自:http://tauruspdj.blog.163.com/blog/static/4312500620080279183197/


1)编译nano-X(即microwindows-0.91

2)编译nxlib0.45

3)编译fltk-1.1.7

安装目录是/usr/local/arm/2.95.3

 准备工作:解压交叉编译cross2.95.3/usr/local/arm并添加路径

exportPATH=/usr/local/arm/2.95.3/bin:$PATH

 

1 编译安装nano-X

主要是修改config文件,

./src/cinfigs中的 config.fb覆盖掉./src下的config
再进行适当修改

####################################################################
#Microwindows and Nano-X configuration file
#
# This package canbe configured to run on Linux (MIPS, ARM, POWERPC or x86)
# UNIX,ELKS, DJGPP, or RTEMS.
# On Linux, we've got drivers for Linux 2.xframebuffers, X11, or,
# svgalib for VGA hardware.
# Inaddition, a gpm or direct serial mouse driver can be configured.
#On ELKS, the bios screen driver and serial mouse driver are alwaysused.
#
# Either Microwindows and/or Nano-X can be built.
#Microwindows and Nano-X have several demos.
#
# For MSDOSmakes, see mcmwin.mak andmcnanox.mak
####################################################################

####################################################################
#
#build target platform
#
# Valid ARCH values are:
#
#LINUX-NATIVE
# LINUX-TCC
# LINUX-ARM
# LINUX-MIPS
#LINUX-POWERPC (BIGENDIAN=Y)
# LINUX-SPARC (BIGENDIAN=Y)
#LINUX-SH
# FREEBSD-X86
# SOLARIS (BIGENDIAN=Y)
# TRIMEDIA
#RTEMS
# DJGPP
# ELKS
#
# note: ELKS can't buildclient/server nano-X, nor widgetlib
#
####################################################################
ARCH                    = LINUX-ARM  #LINUX-NATIVE
BIGENDIAN               = N
NATIVETOOLSPREFIX        =
ARMTOOLSPREFIX          = arm-linux-
MIPSTOOLSPREFIX         = mipsel-linux-
POWERPCTOOLSPREFIX      = powerpc-linux-
SHTOOLSPREFIX           = sh-linux-gnu
RTEMSTOOLSPREFIX        = i386-rtemself-

####################################################################
#
#Compilingoptions
#
####################################################################
OPTIMIZE                = Y
DEBUG                   = N
VERBOSE                 = N
THREADSAFE              = Y  #N

####################################################################
#
#Libraries to build: microwin, nano-X, nanowidget, objectframeworks
#
####################################################################
MICROWIN                = Y
NANOX                   = Y
SHAREDLIBS              = N
OBJFRAMEWORK            = N


####################################################################
#
#Demos tobuild
#
####################################################################
MICROWINDEMO            = Y
NANOXDEMO               = Y

####################################################################
#
#Applications tobuild
#
####################################################################
NANOWM                  = Y

####################################################################
#
#The pixeltype of the native hardware or underlying graphicslibrary.
# This definition defines the PIXELVAL to be 32, 16 or 8bits wide.
# If using Linux framebuffer, set toMWPF_TRUECOLOR0888, and use fbset.
# It also enables GdArea/GrAreafor this particular pixel packing format.
#
# defineMWPF_PALETTE       /* pixel is packed 8bits 1, 4 or 8 pal index*/
# define MWPF_TRUECOLOR8888 /* pixel ispacked 32 bits 8/8/8/8 truecolor w/alpha*/
# defineMWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
#define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8truecolor*/
# define MWPF_TRUECOLOR565  /* pixel is packed 16bits 5/6/5 truecolor*/
# define MWPF_TRUECOLOR555  /* pixelis packed 16 bits 5/5/5 truecolor*/
# define MWPF_TRUECOLOR332 /* pixel is packed 8 bits 3/3/2truecolor*/
#
####################################################################
SCREEN_PIXTYPE          = MWPF_TRUECOLOR565  #MWPF_TRUECOLOR0888

####################################################################
#
#NanoX: Put Y to the following line to link the nano-X application
#with the server.  This is required for ELKS, if no network ispresent,
# or for speed or debugging.  This affects thenano-X serveronly.
#
####################################################################
LINK_APP_INTO_SERVER    = N

####################################################################
#Shared memory support for Nano-X client/server protocolspeedup
####################################################################
HAVE_SHAREDMEM_SUPPORT  = N

####################################################################
#
#File I/O support
# Supporting either below drags in libc stdio,which may not bewanted
#
####################################################################
HAVE_FILEIO             = Y

####################################################################
#BMP, GIF readingsupport
####################################################################
HAVE_BMP_SUPPORT        = Y
HAVE_GIF_SUPPORT        = Y
HAVE_PNM_SUPPORT        = Y
HAVE_XPM_SUPPORT        = Y

####################################################################
#JPEG support through libjpeg, see README.txt incontrib/jpeg
####################################################################
HAVE_JPEG_SUPPORT       = N
INCJPEG                 = .
LIBJPEG                 = /usr/lib/libjpeg.a

####################################################################
#PNG support via libpng andlibz
####################################################################
HAVE_PNG_SUPPORT        = N
INCPNG                  = .
LIBPNG                  = /usr/lib/libpng.a
LIBZ                    = /usr/lib/libz.a

####################################################################
#TIFF support throughlibtiff
####################################################################
HAVE_TIFF_SUPPORT       = N
INCTIFF                 = .
LIBTIFF                 = /usr/lib/libtiff.a

####################################################################
#native .fnt loadable fontsupport
####################################################################
HAVE_FNT_SUPPORT        = Y
HAVE_FNTGZ_SUPPORT       = N #Y
FNT_FONT_DIR            = "fonts/bdf"

####################################################################
#T1 adobe type1 font support thrut1lib
####################################################################
HAVE_T1LIB_SUPPORT      = N
INCT1LIB                = .
LIBT1LIB                = /usr/local/lib/libt1.a

####################################################################
#TrueType font support thru FreeType1.x
####################################################################
HAVE_FREETYPE_SUPPORT   = Y                  #N
INCFTLIB                = /usr/local/include        #/usr/include/freetype1
LIBFTLIB                = /usr/local/lib/libttf.a      #/usr/lib/libttf.so
FREETYPE_FONT_DIR       = "fonts/truetype"

####################################################################
#Support for many kinds of font thru FreeType 2.x
# Must also setFREETYPE_FONT_DIR in the Freetype 1.xsection
####################################################################
HAVE_FREETYPE_2_SUPPORT = N
INCFT2LIB               = .
LIBFT2LIB               = /usr/lib/libfreetype.a

####################################################################
#PCF font support
# Selecting HAVE_PCFGZ_SUPPORT will allow you todirectly read
# .pcf.gz files, but it will add libz to the size oftheserver
####################################################################
HAVE_PCF_SUPPORT        = N
HAVE_PCFGZ_SUPPORT       =N
PCF_FONT_DIR            = "fonts/pcf"

####################################################################
#Chinese Han Zi Ku loadable fontsupport
####################################################################
HAVE_HZK_SUPPORT        = N
HZK_FONT_DIR            = "fonts/chinese"

####################################################################
#Chinese BIG5 compiled in font support(big5font.c)
####################################################################
HAVE_BIG5_SUPPORT       = Y  #

####################################################################
#Chinese GB2312 compiled in font support(gb2312font.c)
####################################################################
HAVE_GB2312_SUPPORT     = Y  #

####################################################################
#Japanese JISX0213 compiled in font support(jisx0213-12x12.c)
####################################################################
HAVE_JISX0213_SUPPORT   = N

####################################################################
#Korean HANGUL font support(jo16x16.c)
####################################################################
HAVE_KSC5601_SUPPORT    = N

####################################################################
#Japanese EUC-JP support using loadable MGLfont
####################################################################
HAVE_EUCJP_SUPPORT      = N
EUCJP_FONT_DIR          = "fonts/japanese"

####################################################################
#Generate screen driver interface only with no fonts orclipping
####################################################################
NOFONTSORCLIPPING       = N

####################################################################
#
#Window move algorithms for Microwindows
# Change for tradeoffbetween cpu speed and looks
# ERASEMOVE repaints only backgroundswhile window dragging, quicker.
# Otherwise an XOR redraw is usedfor window moves only after button up,
# quickest (should set forELKS)
# UPDATEREGIONS paints in update clipping region only forbetter look andfeel
#
####################################################################
ERASEMOVE               = Y
UPDATEREGIONS           = Y

####################################################################
#
#Link with Gray Palette (valid only for 4bppmodes)
#
####################################################################
GRAYPALETTE             = N

####################################################################
#
#If the platform is running UNIX, Linux orRTEMS...
#
####################################################################
ifneq($(ARCH), ELKS)

# X Window screen, mouse andkbd drivers
X11                     = N

ifeq ($(X11), Y)
#startup screen width, height, (depth for palette modeonly)
SCREEN_WIDTH            = 640
SCREEN_HEIGHT           = 480
SCREEN_DEPTH            = 4

# You may want to turn thison for XFree86 4.x or if your backing store
# isn't functioningproperly
USE_EXPOSURE   = Y

else

# framebuffer screen driver(linear and/or vga 4 planes)
# set VTSWITCH to include virtualterminal switch code
# set FBREVERSE to reverse bit orders in1,2,4 bpp
# set FBVGA=N for all systems without VGA hardware (forMIPS must=N)
FRAMEBUFFER             = Y
FBVGA                   = N   #Y
VTSWITCH                = N  #Y
#or else output "#error VTSWITCH depends onMW_FEATURE_TIMERS"
FBREVERSE               = N

# set HAVETEXTMODE=Y forsystems that can switch between text & graphics.
# On agraphics-only embedded system, such as Osprey and Embedded
#Planet boards, set HAVETEXTMODE=N
HAVETEXTMODE            = Y

# svgalib screendriver
VGALIB                  = N

# direct VGA hardware accessscreen driver
HWVGA                   = N

####################################################################
#Mouse drivers
# GPMMOUSE gpm mouse
# SERMOUSE serialMicrosoft, PC, Logitech, PS/2 mice (/dev/psaux)
# SUNMOUSE SunWorkstation mouse (/dev/sunmouse)
# NOMOUSE no mousedriver
#
# Touchscreen drivers
# IPAQMOUSE Compaq iPAQ,Intel Assabet (/dev/h3600_tsraw)
# ZAURUSMOUSE Sharp Zaurus(/dev/sharp_ts)
# TUXMOUSE TuxScreen (/dev/ucb1x00-ts)
#ADSMOUSE Applied Data Systems GC+ (/dev/ts)
#ADS7846MOUSE         ADS7846chip, PSI OMAP Innovator (/dev/innnovator_ts)
# EPMOUSE EmbeddedPlanet (/dev/tpanel)
# VHMOUSE Vtech Helio (/dev/tpanel)
#MTMOUSE MicroTouch serial (/dev/ttyS1)
# PSIONMOUSE Psion5 (/dev/touch_psion)
# YOPYMOUSE Yopy (/dev/yopy-ts)
#HARRIERMOUSE NEC Harrier(/dev/tpanel)
####################################################################
GPMMOUSE                = Y
SERMOUSE                = N
SUNMOUSE                = N
NOMOUSE                 = N
IPAQMOUSE               = N
ZAURUSMOUSE             = N
TUXMOUSE                = N
ADSMOUSE                = N
ADS7846MOUSE            = N
EPMOUSE                 = N
VHMOUSE                 = N
MTMOUSE                 = N
PSIONMOUSE              = N
YOPYMOUSE               = N
HARRIERMOUSE            = N
LIRCMOUSE               = N

# keyboard or null kbddriver
TTYKBD                  = Y  #N
SCANKBD                 = N  #Y
PIPEKBD                 = N
IPAQKBD                 = N
LIRCKBD                 = N
NOKBD                   = N 

endif

# Secondary keyboarddrivers.
# You may have a normal keyboard driver in addition tothese
# drivers, e.g. for both normal keyboard and IRinput.
LIRCKBD2                = N

####################################################################
#Screen driver specific configuration
# SA1100_LCD_LTLEND 4bppdriver with arm SA1100 LCD controller
# INVERT4BPP 4bpp invertedpixel driver for VTechHelio
####################################################################
SA1100_LCD_LTLEND       = N
INVERT4BPP              = N

endif


make
后即可

 

nano-X的安装

修改Makefile,rules
INSTALL_PREFIX = /usr/local/arm/2.95.3

保存,makeinstall
[root@localhost src]# make install 2>&1 | tee~/nano-fltk/nanox-intall.log
Copying hdrs to/usr/local/arm/2.95.3/include/microwin
Copying libs to/usr/local/arm/2.95.3/lib
Copying binaries to/usr/local/arm/2.95.3/bin
Installation completed successfully.

/usr/local/arm/2.95.3/lib
-rw-r--r--   1 root     bin         1060  1
2722:25 libmwdrivers.a
-rw-r--r--    1 root    bin          1058 1
2722:25 libmwengine.a
-rw-r--r--    1 root    bin          1052 1
2722:25 libmwfonts.a
-rw-r--r--    1 root    bin        277032  1
27 22:25libmwimages.a
-rw-r--r--    1 root    bin        888234  1
27 22:25libmwin.a
-rw-r--r--    1 root    bin          1008 1
2722:25 libmwinlib.a
-rw-r--r--    1 root    bin         76738  1
27 22:25libnano-X.a
-rw-r--r--    1 root    bin          7862 1
2722:25 libvncauth.a

/usr/local/arm/2.95.3/bin
-rwxr-xr-x   1 root     bin       857336  1
2722:25 nano-X

/usr/local/arm/2.95.3/lib
drwxr-xr-x   2 root     root        4096  1
2722:25 microwin

 

 

 

2 编译安装nxlib


首先是阅读nxlib-0.45/INSTALL文件:

/********************************************************************/

NXLIB build and installationinstructions
Version 0.44, May 30, 2003

1. Modify Makefile to setMicrowindows and X11 include and libdirectories
 MWIN=/usr2/microwin/src
 X11=/usr/X11R6

 Microwindows v0.90 orlater must be used.

2. Modify Makefile to setX11 PCF font search directories(2)
 X11_FONT_DIR1=/usr/lib/X11/fonts/100dpi
 X11_FONT_DIR2=/usr/lib/X11/fonts/misc

3. Modify Makefile to setrgb.txt file location
 X11_RGBTXT=/usr/lib/X11/rgb.txt

4. Modify Makefile to enableX11 shared library and version if desired
 SHAREDLIB=Y
 LIBNAME= X11
 SOLIBREV = 6.2
 CFLAGS += -DXCONST=_Xconst

 Because of X11 hdrversion inconstencies, you may need to set
  CFLAGS +=-DXCONST=_Xconst  or  CFLAGS += -DXCONST=
 tocompile _Xconst in or out of a couple of function declarations.

5. Type "make".
 Thisbuilds the library using your already-installed X11 headers.
 IfDEBUG = -g, a larger library will be built with debuginformation.
 If INCLUDE_XRM=Y, unmodified Xrm databaseroutines will be included.

6. DO NOT "makeinstall" UNTIL YOU BACK UP THE FOLLOWING LIBRARIES.
  NOTE "make install" WILL BY DEFAULT OVERWRITE THE FOLLOWINGFILES:

 /usr/X11R6/lib/libX11.so.*
 (/usr/X11R6/lib/libX11.so/usr/X11R6/lib/libX11.so.6 /usr/X11R6/lib/libX11.so.6.2)

*********************************************************************/

然后修改Makefile文件:
MWIN=/usr/local/microwindows-0.91/src
CC= arm-linux-gcc

保存,然后make.出现如下错误:

arm-linux-gcc -Wall -g-I/usr/local/microwindows-0.91/src/include-DX11_FONT_DIR1=\"/usr/lib/X11/fonts/100dpi\"-DX11_FONT_DIR2=\"/usr/lib/X11/fonts/misc\"-DX11_RGBTXT=\"/usr/lib/X11/rgb.txt\" -I. -fPIC -o Quarks.o-c Quarks.c
In file included from Quarks.c:52:
Xresource.h:55:X11/Xlib.h: ?????????
make: *** [Quarks.o] Error 1

这时在编译Xrm(Xresource manager),出现错误,应该是头文件搜索路径没有设置好,所以造成找不到Xlib.h文件
[
 
注意此时的文件关系,nxlibX11中都有Xresource.hXlib.h
 
Quarks.c#include "Xresource.h" 来看是nxlibXresource.h
 
进入nxlibXresource.h,#include <X11/Xlib.h>来看是X11Xlib.h
]
解决办法:
nxlib目录的Makefile中增加X11的头文件目录

X11_INCLUDE=$(X11)/include

CFLAGS += -Wall $(DEBUG)-I$(MWIN_INCLUDE) -I$(X11_INCLUDE)

之后,编译顺利通过!

我们得到了想要的
libX11.so
libX11.so.6
libX11.so.6.2
libnx11.a
[root@localhostnxlib-0.45]# ls -l lib*
-rw-r--r--    1 root    root      4193830  1
27 21:12libnx11.a
lrwxrwxrwx    1 root    root           13 1
2721:12 libX11.so -> libX11.so.6.2
lrwxrwxrwx    1root     root          13  1
2721:12 libX11.so.6 -> libX11.so.6.2
-rwxr-xr-x   1 root     root      557154  1
2721:12 libX11.so.6.2


nxlib
的安装,前面提到的INSTALL的第六点已经强调,若不更改安装路径会覆盖掉原系统的相关lib文件.
应谨慎行事!!!!
我们想把所有的arm环境的编译工具和库文件全部放入/usr/local/arm/2.95.3
修改Makefile
INSTALL_DIR = /usr/local/arm/2.95.3/lib

保存,然后makeinstall
[root@localhost nxlib-0.45]# make install 2>&1 |tee ~/nano-fltk/nxlib-intall.log
rm -f/usr/local/arm/2.95.3/lib/libX11.so; \
mv libX11.so/usr/local/arm/2.95.3/lib
+ rm -f/usr/local/arm/2.95.3/lib/libX11.so.6
+ mv libX11.so.6/usr/local/arm/2.95.3/lib
rm -f/usr/local/arm/2.95.3/lib/libX11.so.6.2; \
mv libX11.so.6.2/usr/local/arm/2.95.3/lib

/usr/local/arm/2.95.3/lib
lrwxrwxrwx   1 root     root          13  1
2722:49 libX11.so -> libX11.so.6.2
lrwxrwxrwx    1root     root          13  1
2722:49 libX11.so.6 -> libX11.so.6.2
-rwxr-xr-x   1 root     root      557154  1
2722:49 libX11.so.6.2

 

 

3 编译fltk

[root@localhost fltk-1.1.7]#./configure --host=arm-linux --prefix=/usr/local/arm/2.95.3/ --with-x\
--x-includes=/usr/X11R6/include/--x-libraries=/usr/local/arm/2.95.3/lib/ \
 2>&1 | tee~/nano-fltk/fltk-config.log

[root@localhost fltk-1.1.7]#make 2>&1 | tee ~/nano-fltk/fltk-make.log


Linkingfluid...
/usr/local/arm/2.95.3/arm-linux/bin/ld: cannot find-lXext
collect2: ld returned 1 exit status
make[1]: *** [fluid]Error 1+


[root@localhostfltk-1.1.7]# make install 2>&1 | tee~/nano-fltk/fltk-install.log


/usr/local/arm/2.95.3/lib
[root@localhostlib]# ls -l libfltk*
-rw-r--r--    1 root    root       873420  1
28 19:20libfltk.a
-rw-r--r--    1 root    root        21852  1
28 19:20libfltk_forms.a
-rw-r--r--    1 root    root        55526  1
28 19:20libfltk_images.a
-rw-r--r--    1 root    root       184162  1
28 19:20libfltk_jpeg.a
-rw-r--r--    1 root    root       183636  1
28 19:20libfltk_png.a
-rw-r--r--    1 root    root        77762  1
28 19:20libfltk_z.a

/usr/local/arm/2.95.3/include
lrwxrwxrwx   1 root     dip            2  1
2819:20 Fl -> FL
drwxr-xr-x    3 root    dip          8192 1
2819:20 FL

/usr/local/arm/2.95.3/bin
-rwxr-xr-x   1 root     root        6780  1
2819:20 fltk-config

 

4、后续发现的问题

1
/usr/local/arm/2.95.3/arm-linux/bin/ld:cannot find -lXext
collect2: ld returned 1 exitstatus

查看/usr/local/arm/2.95.3/bin/fltk-config脚本
去掉掉59行的-lXext

 

2
/usr/local/arm/2.95.3/lib/libfltk.a(Fl_x.o):In function `Fl::paste(Fl_Widget &, int)':
Fl_x.o(.text+0xc90):undefined reference to`XConvertSelection'
/usr/local/arm/2.95.3/lib/libfltk.a(Fl_x.o):In function `Fl::copy(char const *, int, int)':
Fl_x.o(.text+0xde0):undefined reference to`XSetSelectionOwner'
/usr/local/arm/2.95.3/lib/libfltk.a(Fl_x.o):In function `fl_handle(_XEvent const &)':
Fl_x.o(.text+0x1880):undefined reference to`XConvertSelection'
/usr/local/arm/2.95.3/lib/libfltk.a(fl_dnd.o):In function `Fl::dnd(void)':
fl_dnd.o(.text+0x1c0): undefinedreference to `XSetSelectionOwner'
collect2: ld returned 1 exitstatus

fltk论坛上有人出现同样的问题,并找到解决办法:
Nxlib-0.45Makefile is missing Selection.o
进入Selection.c里面有XSetSelectionOwner XGetSelectionOwner  XConvertSelection 函数正是我们需要的
修改MakefileOBJS中加入 Selection.o
重新编译nxlib

maketest代码,成功通过!

 

5、在arm上运行

arm上执行之前要先把之前做好的libraryserver準備好︰
/bin/nano-X
/lib/libnano-X.so
/lib/libX11.so.6.2
ln-s libX11.so.6.2 libX11.so
ln -s libX11.so.6.2 libX11.so.6

# nano-X &
nano-X放入后台执行

然后就可以运行编译好的程序了

我到这里时出现一些问题,fltk程序还不能运行,总是会出现一些错误,暂时不能解决!


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值