2

I am using EDK2 and Visual Studio 2019. I followed the instruction to set up EDKII build environment on Windows systems. After sending the following command "edksetup.bat Rebuild" on windows command line, I got the following message.

subprocess not exit successfully
Error while execute command 'nmake all' in direcotry C:\edk2\BaseTools\Source\C\BrotliCompress

...

LINK : fatal error LNK1181: Eingabedatei "brotli\c\tools\brotli.obj" kann nicht geffnet werden.
NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\link.exe"": Rckgabe-Code "0x49d"
Stop.
NMAKE : fatal error U1077: "if": Rückgabe-Code "0x1"
Stop.
NMAKE : fatal error U1077: "if": Rückgabe-Code "0x1"
Stop.

Is it because Of Visual Studio 2019 compatibility or is there any problem with "BrotliCompress"? I changed the tag to TOOL_CHAIN_TAG = VS2019x86. But it did not work. What else should I change for VS2019 compatibility? Is anything to do with NMAKE file?

I tested an older version of EDK2 and it works. But the problem is I am using VS2019 and I want to use edk2-stable201911. The older version (edk2-stable201908) can support up to VS2017 only. In tools_de.txt there is no "common path macros" for VS2019. The above error is result of using edk2-stable201911

H Zam
  • 21
  • 1
  • 4
  • You probably want to point out *what* instructions you are following. – unixsmurf Jul 21 '20 at 16:34
  • I used the Tianocore instruction to set up and build. This is the link: https://github.com/tianocore/tianocore.github.io/wiki/Windows-systems – H Zam Jul 22 '20 at 12:24
  • I checked an older version of EDK2 and it works. But the problem is I am using VS2019 and I want to use edk2-stable2019011. The older version (edk2-stable201908) can support up to VS2017 only. In tools_de.txt there is no "common path macros" for VS2019. The above error is result of using edk2-stable2019011. – H Zam Jul 22 '20 at 13:34
  • Does the directory C:\edk2\BaseTools\Source\C\BrotliCompress\brotli\c\tools\ exist in your checkout? If not, you are probably running a later version than you think (there is no edk2-stable2019011, it's called edk2-stable201911). Current upstream has moved to accessing brotli as a git submodule. – unixsmurf Jul 23 '20 at 11:34
  • Sorry, I ment "edk2-stable201911" version (it is not 2019011). I edited the question. There is brotli folder and it is empty. There are only brotli folder, GNUmakefile and Makefile inside BrotliCompress folder. – H Zam Jul 23 '20 at 11:49
  • Yes. Then what you have checked out is *not* edk2-stable201911. In edk2-stable201911, the brotli folder does not exist, and is not referenced. The "brotli" folder was added as the loction for the submodule in April this year. You need to run git submodule init/git submodule update to get the code. – unixsmurf Jul 23 '20 at 19:37

2 Answers2

5

You need to check out (and build) the various submodules.

Run git submodule update --init in your edk2 directory and you should get output similar to this:

Submodule 'BaseTools/Source/C/BrotliCompress/brotli' (https://github.com/google/brotli) registered for path 'BaseTools/Source/C/BrotliCompress/brotli'
Submodule 'CryptoPkg/Library/OpensslLib/openssl' (https://github.com/openssl/openssl) registered for path 'CryptoPkg/Library/OpensslLib/openssl'
Submodule 'MdeModulePkg/Library/BrotliCustomDecompressLib/brotli' (https://github.com/google/brotli) registered for path 'MdeModulePkg/Library/BrotliCustomDecompressLib/brotli'
Submodule 'MdeModulePkg/Universal/RegularExpressionDxe/oniguruma' (https://github.com/kkos/oniguruma) registered for path 'MdeModulePkg/Universal/RegularExpressionDxe/oniguruma'
Submodule 'RedfishPkg/Library/JsonLib/jansson' (https://github.com/akheron/jansson) registered for path 'RedfishPkg/Library/JsonLib/jansson'
Submodule 'UnitTestFrameworkPkg/Library/CmockaLib/cmocka' (https://git.cryptomilk.org/projects/cmocka.git) registered for path 'UnitTestFrameworkPkg/Library/CmockaLib/cmocka'
Cloning into '<path-to-edk2>/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3'...
Cloning into '<path-to-edk2>/BaseTools/Source/C/BrotliCompress/brotli'...
Cloning into '<path-to-edk2>/CryptoPkg/Library/OpensslLib/openssl'...
Cloning into '<path-to-edk2>/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli'...
Cloning into '<path-to-edk2>/MdeModulePkg/Universal/RegularExpressionDxe/oniguruma'...
Cloning into '<path-to-edk2>/RedfishPkg/Library/JsonLib/jansson'...
Cloning into '<path-to-edk2>/UnitTestFrameworkPkg/Library/CmockaLib/cmocka'...
Submodule path 'ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3': checked out 'b64af41c3276f97f0e181920400ee056b9c88037'
Submodule path 'BaseTools/Source/C/BrotliCompress/brotli': checked out '666c3280cc11dc433c303d79a83d4ffbdd12cc8d'
Submodule path 'CryptoPkg/Library/OpensslLib/openssl': checked out 'e2e09d9fba1187f8d6aafaa34d4172f56f1ffb72'
Submodule path 'MdeModulePkg/Library/BrotliCustomDecompressLib/brotli': checked out '666c3280cc11dc433c303d79a83d4ffbdd12cc8d'
Submodule path 'MdeModulePkg/Universal/RegularExpressionDxe/oniguruma': checked out 'abfc8ff81df4067f309032467785e06975678f0d'
Submodule path 'RedfishPkg/Library/JsonLib/jansson': checked out 'e9ebfa7e77a6bee77df44e096b100e7131044059'
Submodule path 'UnitTestFrameworkPkg/Library/CmockaLib/cmocka': checked out '1cc9cde3448cdd2e000886a26acf1caac2db7cf1'

You may also need to compile stuff first; I don't know how to do it on Windows, but make -C <path-to-edk2>/BaseTools/Source/C is the ticket in Linux.

Once both of these are done you should be able to successfully build EDK2!

Doktor J
  • 1,058
  • 1
  • 14
  • 33
  • 1
    On windows, after the submodule update described above, you need to run toolsetup.bat from the BaseTools directory – rneeja Mar 22 '23 at 23:46
0

I started from a different place and had the same problem. After some digging around, it seems the source for the Brotli compression module was removed from the tree and replaced with a submodule about 4 months ago. I'm new to this stuff and don't know how to incorporate a submodule into the master tree so I went low-level.

There are two places where the Brotli code is needed:

  1. <your_edk2root>\BaseTools\Source\C\BrotliCompress\brotli\
  2. <your_edk2root>\MdeModulePkg\Library\BrotliCustomDecompressLib\brotli\ (where <your_edk2root> is where you cloned the EDK2 repository, including drive letter).

The Brotli source is available at https://github.com/google/brotli.

I downloaded the zip file and simply extracted everything from the brotli-master folder to each of the two previous paths (you should end up with a c directory and a docs directory and a bunch of files in each of those paths). Run edksetup.bat Rebuild again from <your_edk2root> and it should compile, link and install.

Haven't tried to build any UEFI yet, but looking forward to it!

Note: for VS2019, the TOOL_CHAIN_TAG should be VS2019, not VS2019x86.

Doktor J
  • 1,058
  • 1
  • 14
  • 33
aturnbul
  • 347
  • 2
  • 12
  • From another answer (or rather, a non-answer) aturnbul posted, "for VS2019, the TOOL_CHAIN_TAG should be VS2019, not VS2019x86." – Doktor J Mar 03 '21 at 19:17