开源是个巨大的坑,谁来帮帮我

最近在试用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:msys1.0postinstall>PATH ..in;C:MinGWin;C:Program FilesSlickEdit Pro
20.0.1win;C:ProgramDataOracleJavajavapath;C:Windowssystem32;C:Windows;C
:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program F
ilesTortoiseSVNin;C:Program FilesMicrosoft SQL Server110ToolsBinn;C:Pr
ogram Files (x86)Microsoft SDKsTypeScript1.0;C:Program FilesMicrosoft SQL
Server120ToolsBinn;C:Program Files (x86)SkypePhone;C:Program Filesfio
;C:Program FilesGitcmd;C:ProgramDatachocolateyin;C:Program FilesGitusr
in;C:Program Filessmartmontoolsin

C:msys1.0postinstall>..insh.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:msys1.0insh.exe: *** Couldn't reserve space for cygwin's heap, Win32 error 0

C:msys1.0postinstall>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 

正所谓

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

原文地址:https://www.cnblogs.com/helloworldspace/p/6800741.html