open-quantum-safe / oqs-demos

PARTIALLY SUPPORTED Instructions for enabling the use of quantum-safe cryptography in assorted software using the OQS suite. CONTRIBUTORS WANTED.
https://openquantumsafe.org/
133 stars 74 forks source link

Building Chromium for Windows x_86 #306

Open ArtinKennedy opened 1 month ago

ArtinKennedy commented 1 month ago

I want to build chromium for window x_86. For this, I build liboqs using this command: cmake .. -DCMAKE_INSTALL_PREFIX=%CHROMIUM_ROOT%/third_party/boringssl/src/oqs -DOQS_USE_OPENSSL=OFF -DCMAKE_BUILD_TYPE=Release -DOQS_DIST_BUILD=OFF -DOQS_OPT_TARGET=generic

and set target_cpu = "x86" in args.gn config file. when start building of chromium, after some minutes this error occured:

[878/30595] LINK chrome_proxy.exe chrome_proxy.exe.pdb FAILED: chrome_proxy.exe chrome_proxy.exe.pdb ....\third_party\llvm-build\Release+Asserts\bin\lld-link.exe "/OUT:./chrome_proxy.exe" /nologo -libpath:....\third_party\llvm-build\Release+Asserts\lib\clang\19\lib\windows "-libpath:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\ATLMFC\lib\x86" "-libpath:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\lib\x86" "-libpath:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x86" "-libpath:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\um\x86" /MACHINE:X86 "/PDB:./chrome_proxy.exe.pdb" "@./chrome_proxy.exe.rsp" lld-link: error: undefined symbol: _OQS_SIG_verify

referenced by obj/third_party/boringssl\boringssl/p_oqs.obj:(_oqs_verify_sig) referenced by obj/third_party/boringssl\boringssl/p_oqs.obj:(_pkey_oqs_verify_message)

lld-link: error: undefined symbol: _OQS_SIG_new

referenced by obj/third_party/boringssl\boringssl/p_oqs.obj:(_dilithium2_pkey_keygen) referenced by obj/third_party/boringssl\boringssl/p_oqs.obj:(_dilithium3_pkey_keygen) referenced by obj/third_party/boringssl\boringssl/p_oqs.obj:(_dilithium5_pkey_keygen) referenced 77 more times

lld-link: error: undefined symbol: _OQS_SIG_keypair

referenced by obj/third_party/boringssl\boringssl/p_oqs.obj:(_dilithium2_pkey_keygen) referenced by obj/third_party/boringssl\boringssl/p_oqs.obj:(_dilithium3_pkey_keygen) referenced by obj/third_party/boringssl\boringssl/p_oqs.obj:(_dilithium5_pkey_keygen) referenced 17 more times

lld-link: error: undefined symbol: _OQS_SIG_sign

referenced by obj/third_party/boringssl\boringssl/p_oqs.obj:(_pkey_oqs_sign_message) [889/30595] CXX obj/third_party/pdfium/core/fpdfapi/page/page/cpdf_meshstream.obj ninja: build stopped: subcommand failed.

How can I resolve this error?

Raytonne commented 1 month ago

Could you share all the commands you used for the build?

The linker didn't link oqs.lib. Did you apply the Windows patch?

pi-314159 commented 1 month ago

There's an issue with the instructions.

In step 3, you have to run cd liboqs before git checkout 9aa2e1481cd0c242658ec8e92776741feabec163

ArtinKennedy commented 1 month ago

Could you share all the commands you used for the build?

The linker didn't link oqs.lib. Did you apply the Windows patch?

Yes. I apply Windows patch. all the commands I'm using for the build are these:

cd %CHROMIUM_ROOT% git checkout tags/124.0.6339.0 gclient sync cd %CHROMIUM_ROOT%/third_party/boringssl/src git remote add oqs-bssl https://github.com/open-quantum-safe/boringssl git fetch oqs-bssl git checkout -b oqs-bssl-master 0599bb559d3be76a98f0940d494411b6a8e0b18e git clone https://github.com/open-quantum-safe/liboqs.git && cd liboqs && git checkout 9aa2e1481cd0c242658ec8e92776741feabec163 mkdir build && cd build cmake .. -DCMAKE_INSTALL_PREFIX=%CHROMIUM_ROOT%/third_party/boringssl/src/oqs -DOQS_USE_OPENSSL=OFF -DCMAKE_BUILD_TYPE=Release msbuild ALL_BUILD.vcxproj msbuild INSTALL.vcxproj

cd %CHROMIUM_ROOT% gn args out/Default autoninja -C out/Default chrome

pi-314159 commented 1 month ago

I didn’t see where you applied the patch from the commands you shared. If you have applied the patch, you shall see libs = [ "//third_party/boringssl/src/oqs/lib/oqs.lib" ] in the file third_party/boringssl/BUILD.gn

ArtinKennedy commented 4 weeks ago

@pi-314159, because by applying patch file error occured, I apply that manually! and now libs = ["//third_party/boringssl/src/oqs/lib/oqs.lib" ] is in the file third_party/boringssl/BUILD.gn.

pi-314159 commented 4 weeks ago

@ArtinKennedy Great! Sometimes whitespace etc can cause the patch to fail. I hope you can build it successfully.

If everything works out, please remember to close this issue!

ArtinKennedy commented 2 weeks ago

@pi-314159 I apply patch file. All the commands I used for the build are:

cd %CHROMIUM_ROOT% git checkout tags/131.0.6769.0 gclient sync cd %CHROMIUM_ROOT%/third_party/boringssl/src git remote add oqs-bssl https://github.com/open-quantum-safe/boringssl git fetch oqs-bssl git checkout -b oqs-bssl-master 0599bb559d3be76a98f0940d494411b6a8e0b18e git clone https://github.com/open-quantum-safe/liboqs.git && cd liboqs && git checkout 9aa2e1481cd0c242658ec8e92776741feabec163 mkdir build && cd build cmake .. -DCMAKE_INSTALL_PREFIX="E:%CHROMIUM_ROOT%\third_party\boringssl\src\oqs" -DOQS_USE_OPENSSL=OFF -DCMAKE_BUILD_TYPE=Release -DOQS_DIST_BUILD=OFF -DOQS_OPT_TARGET=generic msbuild ALL_BUILD.vcxproj msbuild INSTALL.vcxproj git apply oqs-Windows.patch cd %CHROMIUM_ROOT% gn args out/Default append following lines to the configuration file opened in editor:

is_debug = false symbol_level = 0 enable_nacl = false blink_symbol_level = 0 target_cpu = "x86" target_os = "win"

autoninja -C out/Default chrome but errors remain:(( the command used to build liboqs for x86 is true?

pi-314159 commented 1 week ago

Are there any files in %CHROMIUM_ROOT%\third_party\boringssl\src\oqs? Have you applied all the modifications in the patch file?
If both answers are yes, you may want to start over and re-do the entire build process.