Harsh Shah
Harsh Shah

Reputation: 307

How to compile 7zip source code in visual studio 2017?

After following tutorial from here. I can not generate executables using from lzma1900 SDK.

Here is the output from powershell.

PS C:\Users\testbench\Downloads\7ZipSDK\CPP> "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat
PS C:\Users\testbench\Downloads\7ZipSDK\CPP> nmake NEW_COMPILER=1 
MY_STATIC_LINK=1 Build.mak

Microsoft (R) Program Maintenance Utility Version 14.16.27030.1 Copyright (C) Microsoft Corporation.  All rights reserved.

    if not exist "o" mkdir "o"
    if not exist "o/asm" mkdir "o/asm"
    link  -nologo -OPT:REF -OPT:ICF /LARGEADDRESSAWARE /FIXED:NO -out:o\   
 oleaut32.lib ole32.lib user32.lib advapi32.lib shell32.lib
LINK : fatal error LNK1104: cannot open file 'o\'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\link.EXE"' 
: return code '0x450'
Stop.

And I'm using this nmake version and ml.exe version:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86

I have also installed windows SDK. why it is not being loaded when I run that bat script.? and How can I compile the latest lzma SDK using visual studio 2017?

Upvotes: 2

Views: 7809

Answers (2)

Harsh Shah
Harsh Shah

Reputation: 307

Posting answer for future reference, in case any one needs to look at it:

There are two source codes provided by 7-Zip's developer.

  1. 7-Zip application.
  2. LZMA algorithm implementation in (C, C++ ,C#, java).

One can generate Executable for windows by using makefile located inside

7z1900-src/CPP/7zip/makefile.

I used MSBUILD commandpromt for 2015.(note: one more way to achieve this by running vcvarsall.bat and then executing "nmake" command

If you want to understand how 7Z works then "Alone.dsw " is what you're looking for. it is inside

7z1900-src/CPP/7zip/Bundles/Alone/Alone.dsw

You will need to change "Debug Information Format" to Program Database /Zi inside Project Property. it is under C/C++ -> General.

I hope it helps.

Upvotes: 5

Chetan Lambole
Chetan Lambole

Reputation: 1

Turn off the Embed Manifest option in Project -> Properties -> Configuration Properties -> Manifest Tool -> Input and Output. Change the value of Embed Manifest to No. Find more

Upvotes: 0

Related Questions