开源是个巨大的坑,谁来帮帮我 - smartmontools 虐我记

 

最近在试用smartmontools,感觉还行,于是乎想找来源码改改试试,这下可好,掉坑里了。呜呜呜。。。

 

smartmontools的源码在这里可以看到:https://www.smartmontools.org/browser,svn下载地址http://svn.code.sf.net/p/smartmontools/code/。因为工作环境必须使用Windows(改天试试Linux),smartmontools必须使用MingW gcc at MSYS, 于是想把MingW的环境安装一下。

两个安装参考文档,不知道哪个更合适、简单:1. http://www.cccp-project.net/wiki/index.php?title=Installing_MSYS-MinGW 2. http://www.mingw.org/wiki/MSYS 

唉,摸着石头过河吧。

 

1. 安装MSYS失败

C:\msys\1.0\postinstall>PATH ..\bin;C:\MinGW\bin;C:\Program Files\SlickEdit Pro
20.0.1\win\;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C
:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program F
iles\TortoiseSVN\bin;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Pr
ogram Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL
Server\120\Tools\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\fio\
;C:\Program Files\Git\cmd;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\usr
\bin;C:\Program Files\smartmontools\bin

C:\msys\1.0\postinstall>..\bin\sh.exe pi.sh
0 [main] us 0 init_cheap: VirtualAlloc pointer is null, Win32 error 487
AllocationBase 0x71110000, BaseAddress 0x71110000, RegionSize 0x3000, State 0x1000
C:\msys\1.0\bin\sh.exe: *** Couldn't reserve space for cygwin's heap, Win32 error 0

C:\msys\1.0\postinstall>pause
请按任意键继续. . .

 

WHY.........?

 

 查询方案。。

 http://www.myexception.cn/mobile/631529.html 

http://download.csdn.net/detail/bihaichentian/2634858

貌似这个有用?http://blog.csdn.net/yangyangyang20092010/article/details/46350519 

把之前安装的MinGW,MSYS删除,重新安装试试。还是不行。

好吧,换个Windows环境,我到虚拟机下试试。这次直接按这个步骤来http://blog.csdn.net/yangyangyang20092010/article/details/46350519 。

下载MinGW和MSYS,安装到c:/MinGW/mingw-64下面,msys整个文件夹也拷贝到这里。另外,需要安装一下autoconf, automake, perl。

好了,下面可以试试编译了。

 

2. 打开c:/MinGW/mingw-**/msys/msys.bat, 进入到smartmontools文件夹目录,

 

 先运行autogen.sh

 

然后(参考smartmontools源码里面的 INSTALL 文件)

 mkdir vctmp && cd vctmp
  ../configure [... any MinGW option set from above ...]
  make config-vc10

Configure 结束得到:

然后 make config-vc10:

 

好了,现在Windows需要的三个文件创建好了(config.h,smart*.rc,svnversion.h ),进入os_win32文件夹,用visual studio打开solution文件(*.sln)。分别编译工程,或者编译整个solution。

 

到此,环境搭建问题解决了。

关于如何调试,改天试试再来写。目前来讲,代码可以编辑编译和运行了,来个fake图:

 

 3. 调试

 main函数带参数在Visual Studio下的调试方法  http://blog.csdn.net/qq1987924/article/details/22781331 

 

 

正所谓

路漫漫其修远兮,吾将上下而爬坑。

posted @ 2017-05-03 10:54  平哥的平凡世界  阅读(3949)  评论(0编辑  收藏  举报