[smartmontools-support] Compiling smartctl on Windows

Eaton Zveare eatonzveare at gmail.com
Thu Apr 28 18:05:34 CEST 2022


I couldn't figure out why that error occurred, but I decided to go with VC
builds and it all works great. Thanks again for your help, and I hope you
consider making improvements to that section of the INSTALL file.

To help other users who may need help with this in the future, I have
included step-by-step instructions below:





















*First download a source code copy from here:
https://www.smartmontools.org/browser/tags?order=date&desc=1
<https://www.smartmontools.org/browser/tags?order=date&desc=1>Click into
the desired release version and use the "Zip Archive" download link at the
bottom. Extract the contents somewhere.Build Environment Setup1. Download
the installer: https://www.msys2.org/ <https://www.msys2.org/>2. Run the
installer as admin and install using default settings.3. After the
installer is done, run this in the command window that opens: pacman -Syu4.
Set the "MSYS2 MSYS" and "MSYS2 MinGW x64" shortcuts to run as admin.5. Run
this in a "MSYS2 MSYS" command window: pacman -Su6. Run this next (install
all): pacman -S --needed base-devel mingw-w64-x86_64-toolchain7. Run this
next: pacman -S autoconf automakeProject Setup1. Open a "MSYS2 MinGW x64"
command window.2. cd into the smartmontools source folder you downloaded
and extracted, wherever it is.3. Run: ./autogen.sh4. Run: mkdir vctmp && cd
vctmp5. Run: ../configure6. Comment out "HAVE___INT128" in the config.h
file in vctmp.7. Run: make config-vcVisual Studio should now be able to
compile. Builds are reliant on users having the C++ runtime installed. If
that is not desirable, in the project settings (Release configuration),
change C/C++ -> Code Generation -> Runtime Library to "Multi-threaded
(/MT)".*

On Wed, Apr 27, 2022 at 1:50 PM Eaton Zveare <eatonzveare at gmail.com> wrote:

> Oops! That sounds like the issue. Thanks.
>
> I think I am almost in a good state now. I ran into this error with an
> MSYS2 (no Visual Studio) build when running the binary on Windows 7:
> https://i.imgur.com/bu1o8RE.png
> Works fine on Windows 11. Is there something I am missing that needs to be
> specified for older OS versions?
>
> On Wed, Apr 27, 2022 at 1:36 PM Christian Franke <
> Christian.Franke at t-online.de> wrote:
>
>> Eaton Zveare wrote:
>> > Yes, you are right, config.h inside os_win32\vc16 has those defines
>> > commented out.
>> > Despite that, the build fails. It appears VS 2022 is referencing the
>> > config.h from the root folder instead of the one inside vc16.
>> > In the Solution Explorer, the config.h file there is the vc16 version,
>> > so I'm not sure why it's using the other one in the root.
>> > When I replace the root config.h with the vc16 copy, it fixes the
>> > problem right away.
>>
>> Did you possibly run ./configure instead of ../configure? If yes, there
>> is also config.log and a Makefile in the root folder (aka $srcdir).
>>
>> See INSTALL file:
>>    The configure script must be run outside of the source directory to
>>    avoid inclusion of the original config.h.
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://listi.jpberlin.de/pipermail/smartmontools-support/attachments/20220428/c8db1154/attachment.htm>


More information about the Smartmontools-support mailing list