2013-12-18 48 views
1

我想創建一個交叉編譯安裝程序,將允許我編譯Linux,Windows,Mac和Android的程序。但目前,我遇到了一個我不知道如何解決的問題,我想現在是時候尋求幫助了。如何交叉編譯與mingw32的gettext gettext

我已經成功地構建libiconv的使用:

./configure --build=x86_64-linux-gnu --host=i586-mingw32msvc --prefix=/opt/crosslibs/windows/ --enable-shared --enable-static 
make 
make install 

當我嘗試gettext的同樣的事情,它配置了一切,但我得到以下時,我儘量讓:

../woe32dll/.libs/c++html-styled-ostream.o: In function `html_styled_ostream(float, long double,...)(...)': 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/html-styled-ostream.oo.c:70: undefined reference to `html_ostream_free(any_ostream_representation*)' 
../woe32dll/.libs/c++html-styled-ostream.o: In function `html_styled_ostream_create': 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/html-styled-ostream.oo.c:143: undefined reference to `ostream_write_mem(any_ostream_representation*, void const*, unsigned int)' 
../woe32dll/.libs/c++html-styled-ostream.o: In function `html_styled_ostream__end_use_class': 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/html-styled-ostream.oo.c:88: undefined reference to `html_ostream_end_span(any_ostream_representation*, char const*)' 
../woe32dll/.libs/c++html-styled-ostream.o: In function `html_styled_ostream__begin_use_class': 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/html-styled-ostream.oo.c:81: undefined reference to `html_ostream_begin_span(any_ostream_representation*, char const*)' 
../woe32dll/.libs/c++html-styled-ostream.o: In function `html_styled_ostream__flush': 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/html-styled-ostream.oo.c:64: undefined reference to `html_ostream_flush(any_ostream_representation*)' 
../woe32dll/.libs/c++html-styled-ostream.o: In function `html_styled_ostream__write_mem': 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/html-styled-ostream.oo.c:58: undefined reference to `html_ostream_write_mem(any_ostream_representation*, void const*, unsigned int)' 
../woe32dll/.libs/c++term-styled-ostream.o: In function `style_compute_color_value': 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/term-styled-ostream.oo.c:308: undefined reference to `term_ostream_rgb_to_color(any_ostream_representation*, int, int, int)' 
../woe32dll/.libs/c++term-styled-ostream.o: In function `term_styled_ostream(float, long double,...)(...)': 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/term-styled-ostream.oo.c:107: undefined reference to `term_ostream_free(any_ostream_representation*)' 
../woe32dll/.libs/c++term-styled-ostream.o: In function `term_styled_ostream__write_mem': 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/term-styled-ostream.oo.c:89: undefined reference to `term_ostream_set_color(any_ostream_representation*, int)' 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/term-styled-ostream.oo.c:90: undefined reference to `term_ostream_set_bgcolor(any_ostream_representation*, int)' 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/term-styled-ostream.oo.c:91: undefined reference to `term_ostream_set_weight(any_ostream_representation*, term_weight_t)' 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/term-styled-ostream.oo.c:92: undefined reference to `term_ostream_set_posture(any_ostream_representation*, term_posture_t)' 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/term-styled-ostream.oo.c:93: undefined reference to `term_ostream_set_underline(any_ostream_representation*, term_underline_t)' 
../woe32dll/.libs/c++term-styled-ostream.o: In function `term_styled_ostream_create': 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/term-styled-ostream.oo.c:615: undefined reference to `term_ostream_free(any_ostream_representation*)' 
../woe32dll/.libs/c++term-styled-ostream.o: In function `term_styled_ostream__flush': 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/term-styled-ostream.oo.c:101: undefined reference to `term_ostream_flush(any_ostream_representation*)' 
../woe32dll/.libs/c++term-styled-ostream.o: In function `term_styled_ostream__write_mem': 
/opt/crosslibs/windows/source/gettext-0.18.3.1/gettext-tools/gnulib-lib/term-styled-ostream.oo.c:95: undefined reference to `term_ostream_write_mem(any_ostream_representation*, void const*, unsigned int)' 
collect2: ld returned 1 exit status 
make[4]: *** [libgettextlib.la] Error 1 
make[3]: *** [all] Error 2 
make[2]: *** [all-recursive] Error 1 
make[1]: *** [all] Error 2 
make: *** [all-recursive] Error 1 

這裏指向gettext庫的configure log file的鏈接。

目標是自己編譯glib,所以我有相同的源代碼用於我想要定位的所有平臺。任何幫助,您可以提供非常感謝。

系統信息:

操作系統:Ubuntu的LTS 12.04。

我已經安裝了mingw32 package

我已經下載了glibgettextlibiconv的源代碼。

我的環境配置設置爲:

CFLAGS="-I/opt/crosslibs/windows/include" 
CPPFLAGS="-I/opt/crosslibs/windows/include" 
LDFLAGS="-L/opt/crosslibs/windows/lib" 
XDG_DATA_DIRS="/opt/crosslibs/windows/share" 

CC=i586-mingw32msvc-gcc 
CXX=i586-mingw32msvc-g++ 
LD=i586-mingw32msvc-ld 
RANLIB=i586-mingw32msvc-ranlib 
AR=i586-mingw32msvc-ar 
AS=i586-mingw32msvc-as 
STRIP=i586-mingw32msvc-strip 

export CFLAGS 
export CPPFLAGS 
export LDFLAGS 
export XDG_DATA_DIRS 

export CC 
export CXX 
export LD 
export RANLIB 
export AR 
export AS 
export STRIP 

回答

1

我想通了。這實際上是由gettext構建的錯誤引起的。這裏是bug report

簡單的解決方法是在配置gettext之前執行以下操作。

export CFLAGS="$CFLAGS -O2" 
export CXXFLAGS="$CXXFLAGS -O2"