[smartmontools-support] Compiling smartctl on Windows

Christian Franke Christian.Franke at t-online.de
Wed Apr 27 17:22:56 CEST 2022


Hi Eaton,

Christian Franke wrote:
> Hi Eaton,
>
> Eaton Zveare wrote:
>> ...
>> >> /If you plan to use Linux-like tools more often, I would recommend 
>> to use Cygwin./
>>
>> I think that adds a dependency on a cygwin dll though? If so, that is 
>> not appealing.
>
> Yes and no.
> "./configure" without arguments results in Cygwin binaries which 
> requires some cyg*.dll.
> "./configure --build=$(./config.guess) --host=x86_64-w64-mingw32" 
> results in non-Cygwin binaries.
>
>
>> >> /The make commands for VC16 (VS2019) are now:/
>> >> /make config-vc/
>> >> ...
>>
>> That command works, but Visual Studio still won't compile: 
>> https://i.imgur.com/nmIAy9h.png
>> I should note I am using Visual Studio 2022. Is there a firm 
>> dependency on 2019, or is there something I can change in the project 
>> settings to make it work in 2022?
>
> I don't know and will try with VS 2022 soon and commit the related 
> project files.
>
>

Meantime I found two issues which also affect VS 2015/17/19.

1. Due to changes in recent Windows versions of GNU sed, the 
svnversion.h and config.h files are not properly generated if the 
checkout was done with CR/LF instead of LF line endings.

2. The 64-bit Version of Mingw-w64 supports '__int128', but VS 2022 
still does not, so HAVE___INT128 should be removed from config.h


It would take some time to commit the fixes. Meantime, you could use 
this quick workaround:

In the directory where '../configure' was run, for example "vctmp" as in 
INSTALL file, do:

- Edit svnversion.h and remove the bogus carriage return (^M) in the 
second line if present:

#define SMARTMONTOOLS_SVN_REV  "5363[^M]"

- Convert config.h to unix (LF) format if necessary, for example with:

dos2unix config.h

- Remove the line '#define HAVE___INT128 1' from config.h, for example with:

sed -i.bak '/HAVE___INT128/d' config.h

- recreate the VC16 specific configuration files:

make config-vc

- Open ../os_win32/vc16/smartmontools.sln in VS 2022 and proceed as usual.

Regards,
Christian



More information about the Smartmontools-support mailing list