您尚未登录。

楼主 #1 2018-04-17 11:45:53

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,238
积分: 9197

step by step 用mingw 编译 xboot

step by step 用mingw 编译 xboot

1. 安装 64bit 编译工具链
sudo apt-get install mingw-w64
sudo apt-get install binutils-mingw-w64

2. 下载编译安装 libiconv:
#wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
#tar xvf libiconv-1.15.tar.gz
#cd libiconv-1.15/
#./configure --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32/
#make
#sudo make install

3. 下载编译libSDL2 (同上)

4. 下载xboot
#git clone https://github.com/xboot/xboot.git

5. 打补丁
# cd src/arch/x64/mach-sandbox/libsandbox/
# wget https://raw.githubusercontent.com/LuaDist/libarchive/master/libarchive/archive_windows.h

6. 修改 src/arch/x64/mach-sandbox/libsandbox/sandbox-file.c
添加

#include "archive_windows.h"

150行附件

flags = fcntl(fd, F_GETFL);

改为

flags = fcntl(fd, F_GETFL, 0);

7. 修改 src/arch/x64/mach-sandbox/libsandbox/sandbox-stdio.c

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
//#include <termios.h>
#include <sandbox.h>

//static struct termios __term_config;

void sandbox_stdio_init(void)
{
#if 0
	struct termios termvi;

	tcgetattr(0, &__term_config);
	termvi = __term_config;
	termvi.c_lflag &= (~ICANON & ~ECHO & ~ISIG);
	termvi.c_iflag &= (~IXON & ~ICRNL);
	termvi.c_oflag |= (ONLCR);
	termvi.c_cc[VMIN] = 1;
	termvi.c_cc[VTIME] = 0;
	tcsetattr(0, TCSANOW, &termvi);
#endif
}

void sandbox_stdio_exit(void)
{
#if 0
	fflush(stdout);
	tcsetattr(0, TCSANOW, &__term_config);
#endif
}

ssize_t sandbox_stdio_read(void * buf, size_t count)
{
	return 0;
#if 0
	return sandbox_file_read_nonblock(fileno(stdin), buf, count);
#endif
}

ssize_t sandbox_stdio_write(void * buf, size_t count)
{
#if 0
	return sandbox_file_write(fileno(stdout), buf, count);
#endif
	return 0;
}

8. 开始编译
#cd xboot
#CROSS_COMPILE=x86_64-w64-mingw32- PLATFORM=sandbox make





离线

楼主 #2 2018-04-17 11:45:59

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,238
积分: 9197

Re: step by step 用mingw 编译 xboot

QQ20180417120142.png

[LD] Linking ../output/xboot
*** Error in `/usr/bin/x86_64-w64-mingw32-ld': free(): invalid pointer: 0x0000000003698818 ***
collect2: error: ld terminated with signal 6 [Aborted], core dumped
make[1]: *** [../output/xboot] Error 1
make[1]: Leaving directory `/disk5/xboot/src'
make: *** [all] Error 2

只有最后一个链接问题, 解决这个问题就可以在windows跑sandbox了





离线

楼主 #3 2018-04-17 11:46:01

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,238
积分: 9197

Re: step by step 用mingw 编译 xboot

占位





离线

楼主 #4 2018-04-17 11:46:02

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,238
积分: 9197

Re: step by step 用mingw 编译 xboot

占位





离线

楼主 #5 2018-04-17 11:46:04

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,238
积分: 9197

Re: step by step 用mingw 编译 xboot

占位





离线

楼主 #6 2018-04-17 11:46:06

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,238
积分: 9197

Re: step by step 用mingw 编译 xboot

占位





离线

楼主 #7 2018-04-17 11:46:08

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,238
积分: 9197

Re: step by step 用mingw 编译 xboot

占位





离线

#8 2018-04-17 13:28:32

kgp0213
会员
注册时间: 2018-01-15
已发帖子: 149
积分: 149

Re: step by step 用mingw 编译 xboot

期待成功~

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn