Compiling libffi with VS2012 fails with fatal error LNK1281: Unable to generate SAFESEH image

11,219

The main implication of not having SAFESEH is that your application won't be accepted for the Windows 8 store, or for Windows 8 desktop certification. If that's not an issue for you then feel free to use /SAFESEH:NO.

The documentation says:

The most common reason for the linker not to be able to produce an image is because one or more of the input files (modules) to the linker was not compatible with the safe exception handlers feature. A common reason for a module to not be compatible with safe exception handlers is because it was created with a compiler from a previous version of Visual C++.

Is it possible that the project upgrade to VS2012 changed the setting to /SAFESEH:YES. Perhaps you've never been building with SAFESEH.

Share:
11,219
Abhijit
Author by

Abhijit

Updated on June 17, 2022

Comments

  • Abhijit
    Abhijit almost 2 years

    Compiling libffi with VS11 gives the following linker error

    libffi\libffi-3.0.9\ms\Win32\Debug\ffi.dll : fatal error LNK1281: Unable to generate SAFESEH image.
    

    The same project was compiling fine with VS10, but after an auto upgrade with VS2012, it started giving linker error

    The Explanation in MSDN is too cryptic and least helpful

    I might rebuild with /SAFESEH:NO , but I am unsure of the implication.

    Please advise what might go wrong.

  • Abhijit
    Abhijit over 11 years
    Thank you a lot. You are a savior. BTW do you know if this is documented somewhere The main implication of not having SAFESEH is that your application won't be accepted for the Windows 8 store. If that's not an issue for you then you should use /SAFESEH:NO.
  • David Heffernan
    David Heffernan over 11 years
    I don't think you'll find any documentation on that. You can easily find that Windows 8 store requires SafeSEH. But as for it being the main implication, that won't be written anywhere and is largely a point of opinion. SafeSEH has been around for a long time. Many compilers aren't even capable of producing the exception tables that it requires. And of course it's going away because it's only has meaning for 32 bit apps. Write a 64 bit app and your executable has to contain exception tables.
  • cplotts
    cplotts almost 11 years
    Thank you! I love searching and finding a hit on StackOverflow that exactly matches my problem!