Monogame: Monogame Pipeline Tool -- freetype6.dll obsolete dependancy on VC++ 2012 Redistributable

Created on 25 May 2017  路  7Comments  路  Source: MonoGame/MonoGame

My project was building before but now with a fresh Windows install, there is a problem cropping up:

I have a fresh Windows 10 Creator's Update install with a fresh Visual Studio 2017 install + MonoGame 3.6

I am getting the same type of error as:
https://github.com/MonoGame/MonoGame/issues/4504

System.DllNotFoundException: Unable to load DLL 'freetype6.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Even though the file freetype6.dll is there (in the same folder as MGCB.exe)

Several solutions (in 2 places online) say this error is solved by installing the VC++ 2012 Redistributable.
However, Microsoft has permanently removed VC++ Redistributable 2012 from their website, which eliminates my ability to fix this error.

It seems that it appears there is a problem with MGCB building with SpriteFonts on a clean Windows 10 Creators Update install (reformat from scratch) with a clean Visual Studio 2017 install (Community Edition). This system is quite clean of VC++ 2012 redistributable files as a result (few software packages installed except latest dev tools). For a long time, a hell lot of developer tools installed the 2012 redistributables. so it did not matter, but now it's 2017, and it appears, for the first time, none of my software packages installed the 2012 redistributables .....and it's also gone from Microsoft's website. As a result, forces me into a Catch-22.

When I try to download Microsoft VC++ 2012 Redistributable:
Or from any microsoft links via Google, Microsoft says:


image

Am I the first 'fresh' Windows 10 Creator Update install (reformat) + VS2017-only install to attempt to build with SpriteFonts?

Most helpful comment

For anyone bumping into this, the official VC++ 2012 Redist link is back up: https://www.microsoft.com/en-us/download/details.aspx?id=30679

All 7 comments

I have tried increasing number of Visual Studio packages to install, and this is how far I am now in Visual Studio 2017 Installer to try to eliminate errors.

image

It did indeed reduce two MGCB.exe errors when I installed the VC++ toolsets, but the freetype6.dll error remains when I try to build with SpriteFont content.

Even a "Hello World" type application fails to compile, if it contains a SpriteFont.

For this clean system, I refuse to download VC++ 2012 from anywhere but official sources (e.g. Microsoft). Can MCGB be recompiled to remove the five-year-old VC++ 2012 dependancy?

Related to #4485. FreeType and some other native libs that MonoGame uses need to be recompiled to statically link against the required MSVC dependencies. How is this a Catch-22?

Catch-22 since it prevents easy new-developer installs on new fresh machines, "download packages only from trusted sources" workflow.

Eureka!
I recompiled FreeType myself and solved this problem.

I only needed to follow a modified version of these instructions:
https://stackoverflow.com/questions/6207176/compiling-freetype-to-dll-as-opposed-to-static-library

  1. Download latest FreeType 2.8 from https://www.freetype.org/download.html
  2. Using VS2015 or VS2017, open freetype.sln from the builds\win32\vc2010 directory
  3. Modify solution to target x64 instead of x86
  4. Modify solution to Configuration Type of DLL instead of LIB
  5. Edit ftoption.h to add two lines at top

    define FT_EXPORT(x) __declspec(dllexport) x

define FT_BASE(x) __declspec(dllexport) x

  1. Change project config to Release
  2. Build.
    You will see warnings, but compile succeeds.
  3. You will have a file "freetype28.dll" (for FreeType 2.8)
  4. Rename this file to "freetype6.dll" and copy to C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools
    (replacing the original freetype6.dll located there)

Statically linked to 2015 or 2017 works fine.

Now my SpriteFonts work!
And no VC Redistributables installed on my system.

Mono maintainers: Affects freetype6.dll in git submodules at https://github.com/MonoGame/MonoGame.Dependencies/tree/master/SharpFont/x32
https://github.com/MonoGame/MonoGame.Dependencies/tree/master/SharpFont/x64
which will need to be replaced with non-VC2012-dependant versions

Thanks @mdrejhon , but we plan to solve this issue via #4485 .

@mdrejhon your solution worked for me on a brand new (Windows 10) machine with Visual Studio 2017.

It is also dependent on having the following components of VS 2017 installed:
Universal CRT SDK
Windows 8.1 SDK

For anyone bumping into this, the official VC++ 2012 Redist link is back up: https://www.microsoft.com/en-us/download/details.aspx?id=30679

Was going through the steps outlined above but found that freetype6.dll was already in the C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools. No idea why the Pipeline Tool was not finding it. Then I noticed the last post, that VC++ 2012 was again available. I installed that and the problem disappeared!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

monsieurmax picture monsieurmax  路  5Comments

Grabiobot picture Grabiobot  路  5Comments

rds1983 picture rds1983  路  5Comments

griseus picture griseus  路  5Comments

SenpaiSharp picture SenpaiSharp  路  3Comments