LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1149|回复: 8

求助 cce + gcc4 问题

[复制链接]
发表于 2006-3-2 20:18:30 | 显示全部楼层 |阅读模式
我的系统,本来用的是cce ,但是, gcc4 编译不过,自己写如下 patch ,总算编译通过.
参数: --enable-x11-fonts --enable-freetype

但是,启动后无法用 framebuffer ,只能用 640x480 的 vga ,非常难受,而且花屏,退出后 所有 console 花屏.

希望有人能试试 cce ,看看是不是出现问题,有什么解决方案.

还有,编译时,我这里两个奇怪的问题,我怀疑是个人问题,所以没有补丁,若有人试验,出现问题,按下法解决:
1. 最后一步,连接成 cce 时, can't find FT_..... , 则修改 src/Makefile , -L/usr/X11R6/lib -lXfont 处 添加 -L/usr/lib -lfreetype
2.同样最后一步,连接成 cce 时,can't find GetX11BitmapFontBits ,则修改 vid??.c
GetX11BitmapFontBits 改为 GetX11FontBits 两处.

cce:
http://prdownloads.sourceforge.n ... 1-02132004-dist.tgz

补丁:
http://www.linuxsir.cn/bbs/attac ... =1&d=1141301820

  1. diff -Naur cce-0.51/include/defs.h cce-0.51-gcc4fix/include/defs.h
  2. --- cce-0.51/include/defs.h        2004-01-11 12:41:21.000000000 +0800
  3. +++ cce-0.51-gcc4fix/include/defs.h        2006-02-17 05:49:53.296939250 +0800
  4. @@ -58,14 +58,14 @@
  5. static inline void bzero2(void *head, int n)
  6. {
  7.         while (n-- > 0)
  8. -                *((unsigned char *)head)++ = (unsigned char)0x0;
  9. +                *((unsigned char *)head++) = (unsigned char)0x0;
  10. }

  11. static inline void wzero(void *head, int n)
  12. {
  13.         n >>= 1;
  14.         while (n-- > 0)
  15. -                *((unsigned short *)head)++ = (unsigned short)0x0;
  16. +                *((unsigned short *)head++) = (unsigned short)0x0;

  17. }

  18. @@ -73,33 +73,33 @@
  19. {
  20.         n >>= 2;
  21.      while (n-- > 0)
  22. -        *((unsigned int *)head)++ = (unsigned int)0x0;
  23. +        *((unsigned int *)head++) = (unsigned int)0x0;
  24. }

  25. static inline void bmove(void *dst, void *src, int n)
  26. {
  27.         while(n-- > 0)
  28. -                *((unsigned char *)dst)++ = *((unsigned char *)src)++;
  29. +                *((unsigned char *)dst++) = *((unsigned char *)src++);
  30. }

  31. static inline void brmove(void *dst, void *src, int n)
  32. {
  33.      while(n-- > 0)
  34. -        *--((unsigned char *)dst) = *--((unsigned char *)src);
  35. +        *((unsigned char *)(--dst)) = *((unsigned char *)(--src));
  36. }

  37. static inline void wmove(void *dst, void *src, int n)
  38. {
  39.         n >>= 1;
  40.      while(n-- > 0)
  41. -        *((unsigned short *)dst)++ = *((unsigned short *)src)++;
  42. +        *((unsigned short *)dst++) = *((unsigned short *)src++);
  43. }

  44. static inline void lmove(void *dst, void *src, int n)
  45. {
  46.         n >>= 2;
  47.         while(n-- > 0)
  48. -                *((unsigned int *)dst)++ = *((unsigned int *)src)++;
  49. +                *((unsigned int *)dst++) = *((unsigned int *)src++);
  50. }

  51. static inline void SafeFree(void **p)
  52. diff -Naur cce-0.51/inputs/utils/cin2tab.h cce-0.51-gcc4fix/inputs/utils/cin2tab.h
  53. --- cce-0.51/inputs/utils/cin2tab.h        2003-11-06 19:23:12.000000000 +0800
  54. +++ cce-0.51-gcc4fix/inputs/utils/cin2tab.h        2006-02-17 05:44:41.697465500 +0800
  55. @@ -69,7 +69,7 @@
  56.                 char *tabfname, char *lxfname );
  57. extern int GenerateAssociateFile(FILE *fr, int gen_lx, char *fname);

  58. -extern PinYin PYMap[26][];
  59. +extern PinYin PYMap[26][MAX_PY_PER_LETTER];
  60. extern u_short ZYToPYMap[];

  61. #endif
  62. diff -Naur cce-0.51/src/term/vc.c cce-0.51-gcc4fix/src/term/vc.c
  63. --- cce-0.51/src/term/vc.c        2004-01-11 12:25:30.000000000 +0800
  64. +++ cce-0.51-gcc4fix/src/term/vc.c        2006-02-17 05:45:04.006859750 +0800
  65. @@ -84,7 +84,7 @@
  66.         while (n-- > 0)
  67.         {
  68.                 (*(unsigned char *)head) &= (unsigned char)0x7F;
  69. -                ((unsigned char *)head)++;
  70. +                ((unsigned char *)head++);
  71.         }
  72. }

  73. @@ -94,7 +94,7 @@
  74.      while (n-- > 0)
  75.      {
  76.          (*(unsigned int *)head) &= (unsigned long)0x7F7F7F7F;
  77. -        ((unsigned int *)head)++;
  78. +        ((unsigned int *)head++);
  79.      }
  80. }

  81. diff -Naur cce-0.51/src/font/ftfont.c cce-0.51-gcc4fix/src/font/ftfont.c
  82. --- cce-0.51/src/font/ftfont.c        2003-12-06 02:28:50.000000000 +0800
  83. +++ cce-0.51-gcc4fix/src/font/ftfont.c        2006-03-03 01:51:43.369495250 +0800
  84. @@ -56,16 +56,16 @@

  85. #ifdef USE_DYNAMIC_FREETYPELIB

  86. -static FT_Error (*p_FT_Init_FreeType)( FT_Library  *alibrary );
  87. -static FT_Error (*p_FT_New_Face)( FT_Library library, const char*  filepathname,
  88. +FT_Error (*p_FT_Init_FreeType)( FT_Library  *alibrary );
  89. +FT_Error (*p_FT_New_Face)( FT_Library library, const char*  filepathname,
  90.             FT_Long      face_index, FT_Face     *aface );
  91. -static FT_Error (*p_FT_Done_FreeType)( FT_Library  library );
  92. -static FT_Error (*p_FT_Set_Pixel_Sizes)( FT_Face  face,
  93. +FT_Error (*p_FT_Done_FreeType)( FT_Library  library );
  94. +FT_Error (*p_FT_Set_Pixel_Sizes)( FT_Face  face,
  95.             FT_UInt  pixel_width, FT_UInt  pixel_height );
  96. -static FT_Error (*p_FT_Select_Charmap)( FT_Face face, FT_Encoding  encoding );
  97. -static FT_UInt  (*p_FT_Get_Char_Index)( FT_Face face, FT_ULong charcode);
  98. -static FT_Error (*p_FT_Load_Glyph)( FT_Face face, FT_UInt  glyph_index, FT_Int32 load_flags);
  99. -static FT_Error (*p_FT_Render_Glyph)( FT_GlyphSlot    slot, FT_Render_Mode  render_mode );
  100. +FT_Error (*p_FT_Select_Charmap)( FT_Face face, FT_Encoding  encoding );
  101. +FT_UInt  (*p_FT_Get_Char_Index)( FT_Face face, FT_ULong charcode);
  102. +FT_Error (*p_FT_Load_Glyph)( FT_Face face, FT_UInt  glyph_index, FT_Int32 load_flags);
  103. +FT_Error (*p_FT_Render_Glyph)( FT_GlyphSlot    slot, FT_Render_Mode  render_mode );

  104. static void *ftLibHandle;

  105. diff -Naur cce-0.51/src/display/fb.c cce-0.51-gcc4fix/src/display/fb.c
  106. --- cce-0.51/src/display/fb.c        2004-01-04 23:22:41.000000000 +0800
  107. +++ cce-0.51-gcc4fix/src/display/fb.c        2006-03-03 01:54:55.205484250 +0800
  108. @@ -372,7 +372,7 @@
  109.                                 break;
  110.                         case 15:
  111.                         case 16:
  112. -                                *((u_short *)dest)++ = (u_short)(pix);
  113. +                                *((u_short *)dest++) = (u_short)(pix);
  114.                                 break;
  115.                         case 24:
  116.                                 *dest++ = (u_char)(pix); pix >>= 8;
  117. @@ -380,7 +380,7 @@
  118.                                 *dest++ = (u_char)(pix);
  119.                                 break;
  120.                         case 32:
  121. -                                *((u_int *)dest)++ = (u_int)(pix);
  122. +                                *((u_int *)dest++) = (u_int)(pix);
  123.                                 break;
  124.                         }
  125.                 }
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
发表于 2006-3-2 20:25:26 | 显示全部楼层
我觉得类似
-                *((unsigned char *)head)++ = (unsigned char)0x0;
+                *((unsigned char *)head++) = (unsigned char)0x0;

两个表达式含义不一样,这样程序会不会运行出问题呀.
回复 支持 反对

使用道具 举报

发表于 2006-3-2 20:29:58 | 显示全部楼层
源码级的讨论,偶路过。。。。。。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-2 20:39:21 | 显示全部楼层
- *((unsigned char *)head)++ = (unsigned char)0x0;
+ *((unsigned char *)head++) = (unsigned char)0x0;

一样的, 非常多的源码 ,要在gcc4 里编译都是这样改的.

* 和 ++ 优先级相同, 但是结合性是 右->左, 这样改,应该不改变原意.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-2 20:50:47 | 显示全部楼层
至于这里:
-static FT_Error (*p_FT_Init_FreeType)( FT_Library  *alibrary );
+FT_Error (*p_FT_Init_FreeType)( FT_Library  *alibrary );
我没有办法,*.h 里相同的定义是 extern 的. 不过,这个应该不会导致问题.
回复 支持 反对

使用道具 举报

发表于 2006-3-2 20:59:50 | 显示全部楼层
静态函数和非静态函数应该会有不同,就如同静态变量和非静态变量的使用是不一样的,有可能会导致问题.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-2 21:08:18 | 显示全部楼层
头痛,用gcc4的,这种问题经常出现,lfs里就有n多 gcc4fix 补丁.

我们应该怪谁?
gcc3 ,语法太宽松?
gcc4,语法过于严格?
开发者用不规范语法?
回复 支持 反对

使用道具 举报

发表于 2006-3-3 07:19:46 | 显示全部楼层
我觉得 gcc4 比较好。。严格一点不出问题。呵呵。(个人意见。)。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-3 18:49:39 | 显示全部楼层

问题基本解决

问题基本解决

更新了补丁,可能原来的确实有问题,现在用了很麻烦的写法:
  1. -                                *((u_short *)dest)++ = (u_short)(pix);
  2. +                                usdest = (u_short *)dest ;
  3. +                                *usdest++ = (u_short)(pix);
  4. +                                   dest = (u_char *)usdest;
复制代码


Framebuffer问题已解决,可以使用fb了, 不会花屏了. 不过我还是不知道为甚 vga 会花屏.
而 framebuffer 的问题,不是补丁造成的, 是由于 cce 源码内 写死了 framebuffer 设备
#define DEFAULT_FB                  "/dev/fb"
#define DEFAULT_FB_DEVFS        "/dev/fb/0"
没有考虑到现在用的 udev 一般都是 /dev/fb0 .

解决方法是要么改一下 include/fb.h : /dev/fb 改为 /dev/fb0
要么 ln -s fb0 /dev/fb 满足cce的要求, 可以写入启动脚本, 正统的方法应该是改 udev 的 配置, 生成 /dev/fb 这个链接.

现在只有最后一个问题, 鼠标.
已用 -enable-gpm -enable-mouse ,运行时可以看见鼠标光标,可以选择,但不能粘帖, mc 也不能点击. zhcon 一切正常.

cce 已经可用了,我来新开一个帖子吧. 下次解决 gpm 后直接更新.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表