[smartmontools-support] Compiling smartctl on Windows

Eaton Zveare eatonzveare at gmail.com
Fri Apr 22 18:10:02 CEST 2022


Hi Christian,

>> *Which compatibility problems did you find under Win11 ?*

None, just the trouble building (:

>> *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.

>> *This removes the debug info:*
>> *strip -s *.exe*
>> *x86_64-mingw32-strip -s *.exe*

The first command worked nicely, thank you! Now the exe is the size I
expect (~1 MB).

>> *make smartctl-nc.exe*

Also worked nicely, thank you.

>> *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?

>> *Note that VC is never used for release and CI
(https://builds.smartmontools.org/ <https://builds.smartmontools.org/>)
binaries for Windows. These are always cross-compiled using a Docker image
with Linux and Mingw-w64.*

Is there any difference between VC, MSYS2/MINGW64 on Windows, and
cross-compiled builds on Linux or is it just a matter of environment
preference?

Thanks for the answers!

On Fri, Apr 22, 2022 at 7:45 AM Christian Franke <
Christian.Franke at t-online.de> wrote:

> Eaton Zveare wrote:
> > Hi, after spending some time getting smartctl compilable on my Windows
> > 11 machine, I have run into problems and must ask for some assistance
> > in getting a proper build environment set up.
>
> Which compatibility problems did you find under Win11 ?
>
>
> >
> > I have read the "Guidelines for Windows" section in the INSTALL file.
> > I installed MSYS2, did their 2-step package update commands, and
> > installed mingw-w64-x86_64-toolchain. In other words, everything under
> > the Installation section here: https://www.msys2.org/
> >
> > I then installed these additional packages via this command: /pacman
> > -S make autoconf autogen automake/
>
> If you plan to use Linux-like tools more often, I would recommend to use
> Cygwin.
>
>
> > /
> > /
> > I then copied the latest smartmontools source (the SVN copy) to here:
> > /C:\msys64\home\Eaton/
> > Start the "MSYS2 MinGW x64" shell and run these commands:
> >
> >  1. /./autogen.sh/
> >  2. /./configure/
> >  3. /make/
> >
> > That gets me a smartctl.exe, but it's 6.4 MB, more than 6x larger than
> > the official build. I suspect it was compiled in debug mode, but it's
> > not clear how to specify release/production mode.
>
> The configure default is CXXFLAGS='-g -O2', so code is optimized for
> release but debug information is still included.
>
>
> > This leads to my questions:
> >
> >  1. How do I compile in release/production mode?
> >
>
> This removes the debug info:
> strip -s *.exe
> x86_64-mingw32-strip -s *.exe
>
>
> >  1. How do I compile the "smartctl-nc" version of the exe?
> >
>
> make smartctl-nc.exe
>
> Both are included in:
> make instdir-win32
>
>
> >  1. I also tried getting this working in Visual Studio, but running
> >     the /config-vc14/ (or vc16) command does not work. It says /No
> >     rule to make target/.
> >
>
> Yes, this info is outdated, sorry. Added to my TODO list.
>
> The make commands for VC16 (VS2019) are now:
> make config-vc
> make clean-vc
> make distclean-vc
> make maintainer-clean-vc
>
> Add "vc=15" to switch to VC15 (VS2017).
>
> Note that VC is never used for release and CI
> (https://builds.smartmontools.org/) binaries for Windows. These are
> always cross-compiled using a Docker image with Linux and Mingw-w64.
>
> Thanks,
> Christian
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://listi.jpberlin.de/pipermail/smartmontools-support/attachments/20220422/ba46d110/attachment.htm>


More information about the Smartmontools-support mailing list