发布MinGW 4.4.5,附交叉编译方法

老邓 2010-10-16 11:24:44
有需要要,就从这里下载吧:http://code.google.com/p/qp-gcc/

编译方法

一、编译gmp
DIR=/home/loaden/AUR/mingw32
ABI=32 ../../src/gmp-5.0.1/configure \
--prefix=$DIR/depends \
--host=i686-mingw32 \
--target=i686-mingw32 \
--build=i686-pc-linux-gnu \
--enable-cxx \
--enable-static \
--disable-shared
make -j2 && make install

二、编译mpfr
DIR=/home/loaden/AUR/mingw32
../../src/mpfr-3.0.0/configure \
--prefix=$DIR/depends \
--host=i686-mingw32 \
--target=i686-mingw32 \
--build=i686-pc-linux-gnu \
--with-gmp=$DIR/depends \
--enable-thread-safe \
--enable-static \
--disable-shared
make -j2 && make install

三、编译iconv
DIR=/home/loaden/AUR/mingw32
../../src/libiconv-1.13.1/configure \
--prefix=$DIR/depends \
--host=i686-mingw32 \
--target=i686-mingw32 \
--build=i686-pc-linux-gnu \
--disable-shared \
--enable-static
make -j2 && make install && i686-mingw32-strip $DIR/depends/bin/iconv.exe

四、编译mpc
DIR=/home/loaden/AUR/mingw32
../../src/mpc-0.8.2/configure \
--prefix=$DIR/depends \
--host=i686-mingw32 \
--target=i686-mingw32 \
--build=i686-pc-linux-gnu \
--with-gmp=$DIR/depends \
--with-mpfr=$DIR/depends \
--enable-static \
--disable-shared
make -j2 && make install

五、编译gcc
# 给GCC源码打上补丁(在源码目录下执行)
for files in ../patches-4.4.5/gcc*; do patch -p0 < $files; done
# 在/mingw内建立链接(在编译目录下执行:可拷贝下列命令后同时执行)
sudo mkdir /mingw
sudo ln -s /usr/i686-mingw32/include/ /mingw/include
sudo ln -s /usr/i686-mingw32/lib/ /mingw/lib
# 定义变量
DIR=/home/loaden/AUR/mingw32
# 配置
../../src/gcc-4.4.5/configure \
--prefix=/mingw \
--host=i686-mingw32 \
--target=i686-mingw32 \
--build=i686-pc-linux-gnu \
--enable-languages=c,c++ \
--enable-static \
--enable-cxx-flags='-fno-function-sections -fno-data-sections' \
--enable-fully-dynamic-string \
--enable-version-specific-runtime-libs \
--enable-threads=win32 \
--enable-libgomp \
--enable-libiconv \
--disable-shared \
--disable-nls \
--disable-werror \
--disable-libstdcxx-pch \
--disable-win32-registry \
--disable-sjlj-exceptions \
--with-dwarf2 \
--with-gmp=$DIR/depends \
--with-mpfr=$DIR/depends \
--with-pkgversion='QP MinGW32' \
--with-bugurl=http://qp-gcc.googlecode.com
make CFLAGS="-I$DIR/depends/include -O2 -D__USE_MINGW_ACCESS" \
BOOT_CFLAGS="-I$DIR/depends/include -O2 -D__USE_MINGW_ACCESS" \
CFLAGS_FOR_TARGET="-I$DIR/depends/include -O2 -D__USE_MINGW_ACCESS" \
CXXFLAGS="-I$DIR/depends/include -mthreads -O2 -D__USE_MINGW_ACCESS" \
BOOT_CXXFLAGS="-I$DIR/depends/include -mthreads -O2 -D__USE_MINGW_ACCESS" \
CXXFLAGS_FOR_TARGET="-I$DIR/depends/include -mthreads -O2 -D__USE_MINGW_ACCESS" \
LDFLAGS="-L$DIR/depends/lib -s" BOOT_LDFLAGS="-L$DIR/depends/lib -s" \
LDFLAGS_FOR_TARGET="-L$DIR/depends/lib -s" \
-j2
# -Wl,...: 告诉GCC传递后面的选项给liker链接器
# 加入--stack=0x2000000把stack设为32MB,解决可能的stack overflow。
rm -f gcc/cc1.exe gcc/cc1plus.exe
make install DESTDIR=~ LDFLAGS="-s -Wl,--stack=0x2000000"
...全文
558 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
zzw_happy 2010-10-19
  • 打赏
  • 举报
回复
good,jf
老邓 2010-10-18
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 hutrade 的回复:]

这个不是在Windows上用的么,咋还得Linux上编译?
[/Quote]
交叉编译
hutrade 2010-10-18
  • 打赏
  • 举报
回复
这个不是在Windows上用的么,咋还得Linux上编译?
redleaves 2010-10-18
  • 打赏
  • 举报
回复
顶 && 求分~~
老邓 2010-10-18
  • 打赏
  • 举报
回复
自顶!
Proteas 2010-10-17
  • 打赏
  • 举报
回复
顶,回头试试。
0x甲鱼 2010-10-17
  • 打赏
  • 举报
回复
收藏,支持老邓
月中蓝 2010-10-17
  • 打赏
  • 举报
回复
好的收藏
mymtom 2010-10-17
  • 打赏
  • 举报
回复
支持Loaden.
某某9 2010-10-17
  • 打赏
  • 举报
回复
支持老邓
老邓辛苦了
老邓 2010-10-16
  • 打赏
  • 举报
回复
gdb增强python支持的stack补丁:
gdb/stack.c

static void
iterate_over_block_locals (struct block *b,
iterate_over_block_arg_local_vars_cb cb,
void *cb_data)
{
struct dict_iterator iter;
struct symbol *sym;
struct frame_info *frame;
struct symtab_and_line sal;
frame = get_selected_frame (NULL) ;
find_frame_sal (frame, &sal);

ALL_BLOCK_SYMBOLS (b, iter, sym)
{
switch (SYMBOL_CLASS (sym))
{
case LOC_LOCAL:
case LOC_REGISTER:
case LOC_STATIC:
case LOC_COMPUTED:
if (SYMBOL_IS_ARGUMENT (sym))
break;
if(sym->line>= sal.line)
break;
(*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data);
break;

default:
/* Ignore symbols which are not locals. */
break;
}
}
}

昵称很不好取 2010-10-16
  • 打赏
  • 举报
回复
不错,下载~~
老邓 2010-10-16
  • 打赏
  • 举报
回复
另附gdb最新交叉编译方法

一、编译iconv
DIR=/home/loaden/AUR/gdb
../../src/libiconv-1.13.1/configure \
--host=i686-mingw32 \
--target=i686-mingw32 \
--build=i686-pc-linux-gnu \
--disable-shared \
--enable-static
make -j2 && make install prefix=$DIR/iconv && i686-mingw32-strip $DIR/iconv/bin/iconv.exe
sudo cp -a -r $DIR/iconv/* /usr/i686-mingw32

二、编译expat
DIR=/home/loaden/AUR/gdb
../../src/expat-2.0.1/configure \
--host=i686-mingw32 \
--target=i686-mingw32 \
--build=i686-pc-linux-gnu \
--disable-shared \
--enable-static
make -j2 && make install prefix=$DIR/depends

三、拷贝python
把python拷贝到/home/loaden/AUR/gdb/depends目录中,特别注意:python的头文件必须放在:/home/loaden/AUR/gdb/depends/include/python2.6下,同时将libpython26.a改名为libpython2.6.a

四、编译gdb
# 配置
PREFIX=/home/loaden/AUR/gdb/depends
../../src/gdb/configure \
--prefix=$PREFIX \
--host=i686-mingw32 \
--target=i686-mingw32 \
--build=i686-pc-linux-gnu \
--with-expat=$PREFIX \
--with-python=$PREFIX \
--with-iconv \
--without-included-gettext \
--enable-static \
--disable-shared
# 编译
make -j2
# 安装
rm -f gdb/gdb.exe gdb/gdbserver/gdbserver.exe
make LDFLAGS="-Wl,--stack=0x2000000"
i686-mingw32-strip --strip-debug --strip-unneeded gdb/gdb.exe gdb/gdbserver/gdbserver.exe
make install prefix=~/gdb

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧