How to add static library to firefox build

Discuss building things with or for the Mozilla Platform.
Locked
ParkJB1
Posts: 2
Joined: October 17th, 2021, 10:14 pm

How to add static library to firefox build

Post by ParkJB1 »

Purpose: to use the method of an external library in the source file of mozilla solution

The current OS is Windows 10

Follow the link below to install firefox.

https://firefox-source-docs.mozilla.org ... on-windows

Install MozillaBuild

Run python3 bootstrap.py from start-shell.bat
Select build type 2, Select Yes for everything else

edit mozconfig file :
ac_add_options --enable-debug
ac_add_options --disable-optimize
mk_add_options MOZ_OBJDIR=./objdir-frontend-debug-artifact2

Open D:\mozilla-source\mozilla-unified\objdir-frontend-debug-artifact2\msvc\mozilla.sln created after mach build with Visual Studio 2019

To use openssl 1.1.1 in netwerk_base project in solution do below two tasks
1. header include

C:\Program Files (x86)\OpenSSL1.1.1-Win32\include\openssl folder
Copied to D:\mozilla-source\mozilla-unified\objdir-frontend-debug-artifact2\dist\include

Add openssl header include to nsSocketTransport2.h


2. static library add dependencies
edit D:\mozilla-source\mozilla-unified\netwerk\base\moz.build

https://firefox-source-docs.mozilla.org ... aries.html
Add USE_LIBS to moz.build file by following link above
USE_LIBS += [ 'libcrypto-1_1', 'libssl-1_1',] or
USE_LIBS += [ 'C:\Program Files (x86)\OpenSSL1.1.1-Win32\lib\libcrypto-1_1', 'C:\Program Files (x86)\OpenSSL1.1.1-Win32\lib\libssl-1_1',]

The source of the library name is taken from libcrypto.def and libssl.def in the attachment above.

mach build output when relative path

The error occurred while processing the following file or one of the files it includes:
d:/mozilla-source/mozilla-unified/netwerk/base/moz.build
The error occurred when validating the result of the execution. The reported error is:
USE_LIBS contains "libcrypto-1_1", which does not match any LIBRARY_NAME in the tree.

mach build output when absolute path

The error occurred while processing the following file or one of the files it includes:
d:/mozilla-source/mozilla-unified/netwerk/base/moz.build
The error occurred when validating the result of the execution. The reported error is:
USE_LIBS contains "C:\Program Files (x86)\OpenSSL1.1.1-Win32\lib\libcrypto-1_1", but there is no "libcrypto-1_1" LIBRARY_NAME in C:/Program Files (x86)/OpenSSL1.1.1-Win32/lib.
Locked