1. 如果沒有 rebuild uClibc 0.9.26 會發生下列錯誤
arm-elf-g++ -o fluid Fl_Function_Type.o Fl_Menu_Type.o Fl_Group_Type.o Fl_Widget_Type.o Fl_Type.o Fl_Window_Type.o Fluid_Image.o code.o factory.o file.o fluid.o about_panel.o widget_panel.o alignment_panel.o function_panel.o gif.o -L../lib -lfltk -DNANO_X=1 -L/usr/local/lib -L/sigma/armutils_2.8.0.2/build_arm/microwin/src/lib -lnano-X -lm
../lib/libfltk.a(Fl_Valuator.o): In function `Fl_Valuator::step(double)':
Fl_Valuator.o(.text+0x1dc): undefined reference to `rint'
Fl_Valuator.o(.text+0x224): undefined reference to `rint'
../lib/libfltk.a(Fl_Valuator.o): In function `Fl_Valuator::round(double)':
Fl_Valuator.o(.text+0x5f8): undefined reference to `rint'
../lib/libfltk.a(Fl_Valuator.o): In function `Fl_Valuator::increment(double, int)':
Fl_Valuator.o(.text+0x748): undefined reference to `rint'
collect2: ld returned 1 exit status
make[1]: *** [fluid] Error 1
make[1]: Leaving directory `/sigma/flnx/fluid'

2. rebuild uClibc 0.9.26
    a. cd /sigma/armutils_2.8.0.2/build_arm/uClibc-0.9.26
    b. make menuconfig
        --> Target Architecture Features and Options
            *Enable full C99 math library support 打勾
    c. cd /sigma/armutils_2.8.0.2
    d. make uclibc(因為 /sigma/armutils_2.8.0.2/make/uclibc.mk 存在)

3. 結果不行,因為 make uclibc 會把 /sigma/armutils_2.8.0.2/config/production/uClibc-0.9.26.config 覆蓋剛剛設定的 /sigma/armutils_2.8.0.2/build_arm/uClibc-0.9.26/.config。
    a. modify /sigma/armutils_2.8.0.2/config/production/uClibc-0.9.26.config
        -- # DO_C99_MATH is not set
        ++ DO_C99_MATH=y
    b. cd /sigma/armutils_2.8.0.2
    c. make uclibc

4. build flnx
    a.
CC=arm-elf-gcc CXX=arm-elf-g++ AR=arm-elf-ar RANLIB=arm-elf-ranlib LD=arm-elf-ld \
./configure --target=arm-elf-linux --host=x86-pc-linux --disable-shared --enable-static \
--with-microwin=/sigma/armutils_2.8.0.2/build_arm/microwin/src
    b. make
    c. 發生錯誤
Fl_Chart.cxx: In function `void draw_piechart(int, int, int, int, int, FL_CHART_ENTRY *, int, Fl_Color)':
Fl_Chart.cxx:207: `M_PI' undeclared (first use this function)
Fl_Chart.cxx:207: (Each undeclared identifier is reported only once
Fl_Chart.cxx:207: for each function it appears in.)
make[1]: *** [Fl_Chart.o] Error 1
make[1]: Leaving directory `/sigma/flnx/src'

5. include 出問題,找出需要的 include 路徑,加進去。
    a.
CC=arm-elf-gcc CXX=arm-elf-g++ AR=arm-elf-ar RANLIB=arm-elf-ranlib LD=arm-elf-ld \
CXXFLAGS="-I/sigma/armutils_2.8.0.2/build_arm/uClibc-0.9.26/include" \
./configure --target=arm-elf-linux --host=x86-pc-linux --disable-shared --enable-static \
--with-microwin=/sigma/armutils_2.8.0.2/build_arm/microwin/src
    b. make
    c. 發生錯誤
Fluid_Image.cxx: In method `pixmap_image::pixmap_image(const char *, FILE *)':
Fluid_Image.cxx:159: internal error--unrecognizable insn:
(insn 1242 1239 1227 (set (reg:QI 4 r4)
(mem:QI (plus:SI (reg:SI 2 r2)
(const_int -2256 [0xfffff730])) 0)) -1 (nil)
(nil))
make[1]: *** [Fluid_Image.o] Error 1
make[1]: Leaving directory `/sigma/flnx/fluid'

6. 上面的錯誤是當 cross-compiler 在 compile 太複雜的 C++ code 時,會出現的錯誤。解決方法就是換新版的 gcc,或是直接修改 code。檢查發現是 local variable array 的 size 太大。
    a. modify fluid/Fluid_Image.cxx line 100
        -- #define MAXSIZE 2048
        ++ #define MAXSIZE 256
    b. modify fluid/gif.cxx line 210
        -- short int Prefix[4096];
        -- uchar Suffix[4096];
        ++ short int Prefix[100];
        ++ uchar Suffix[100];
    c. make
    d. 發生錯誤
filename_list.cxx: In function `int filename_list(const char *, dirent ***)':
filename_list.cxx:53: converting `int (*)(dirent **, dirent **)' to `int (*)(const void *, const void *)' is a contravariance violation
make[1]: *** [filename_list.o] Error 1
make[1]: Leaving directory `/sigma/flnx/src'

7. 檢查 source,發現上面錯誤是少了一個 #define linux。
    a.
CC=arm-elf-gcc CXX=arm-elf-g++ AR=arm-elf-ar RANLIB=arm-elf-ranlib LD=arm-elf-ld \
CXXFLAGS="-I/sigma/armutils_2.8.0.2/build_arm/uClibc-0.9.26/include -Dlinux" \
./configure --target=arm-elf-linux --host=x86-pc-linux --disable-shared --enable-static \
--with-microwin=/sigma/armutils_2.8.0.2/build_arm/microwin/src
    b. make
    c. 發生錯誤
In file included from keyboard.cxx:40:
keyboard_ui.cxx: In function `class Fl_Window * make_window()':
keyboard_ui.cxx:559: internal error--unrecognizable insn:
(insn 30903 30900 15898 (set (reg:QI 0 r0)
(mem:QI (plus:SI (reg:SI 0 r0)
(const_int -1949 [0xfffff863])) 0)) -1 (nil)
(nil))
make[1]: *** [keyboard] Error 1
make[1]: Leaving directory `/sigma/flnx/test'
make: *** [all] Error 2

8. 檢查 source,應該是 button 過多,刪除全部的 button。
    a. modify flnx/test/keyboard_ui.cxx
        -- kill all button
    b. make
    c. OK

9. 最後在 run test program 出現錯誤,原來少了 -elf2flt。
    a.
CC=arm-elf-gcc CXX=arm-elf-g++ AR=arm-elf-ar RANLIB=arm-elf-ranlib LD=arm-elf-ld \
CXXFLAGS="-I/sigma/armutils_2.8.0.2/build_arm/uClibc-0.9.26/include -Dlinux" \
LDFLAGS="-Wl,-elf2flt=-s32768" \
./configure --target=arm-elf-linux --host=x86-pc-linux --disable-shared --enable-static \
--with-microwin=/sigma/armutils_2.8.0.2/build_arm/microwin/src
    b. make clean
    c. make
    d. OK

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()