compile/opensslFromSource
About
Please read: INSTALL.md
Prepare
Prepare working directory
Possible dependencies
--enable-brotli-dynamic
libbrotli:
apt install libbrotli-dev
--enable-zlib-dynamic
zlib1g:
apt install zlib1g-dev
--enable-zstd-dynamic
libzstd:
apt install libzstd-dev
--enable-jitter
jitterentropy:
Configure
Compile time options - Debian 13 (trixie)
1 % openssl version -a | fold -s
2 OpenSSL 3.4.1 11 Feb 2025 (Library: OpenSSL 3.4.1 11 Feb 2025)
3 built on: Tue Feb 11 20:30:30 2025 UTC
4 platform: debian-amd64
5 options: bn(64,64)
6 compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall
7 -fzero-call-used-regs=used-gpr -Wa,--noexecstack -g -O2
8 -Werror=implicit-function-declaration
9 -ffile-prefix-map=/build/reproducible-path/openssl-3.4.1=.
10 -fstack-protector-strong -fstack-clash-protection -Wformat
11 -Werror=format-security -fcf-protection -DOPENSSL_USE_NODELETE -DL_ENDIAN
12 -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DZLIB -DZSTD -DNDEBUG -Wdate-time
13 -D_FORTIFY_SOURCE=2
14 OPENSSLDIR: "/usr/lib/ssl"
15 ENGINESDIR: "/usr/lib/x86_64-linux-gnu/engines-3"
16 MODULESDIR: "/usr/lib/x86_64-linux-gnu/ossl-modules"
17 Seeding source: os-specific
18 CPUINFO: OPENSSL_ia32cap=0x7ed8320b078bffff:0x209c01a9
Wrapper script
build.sh
1 #!/bin/bash
2
3 PREFIX="$HOME/.local"
4
5 ### C PREPROCESSOR FLAGS
6 CPPFLAGS_ARRAY=(
7 "-DHAVE_CONFIG_H" # Define macro with value 1
8 "-Wdate-time" # Warn when bit-wise-identical reproducible compilations may be disturbed
9 "-D_FORTIFY_SOURCE=2" #Add support for detecting buffer overflows in various functions
10 )
11
12
13 #shellcheck disable=SC2054
14 CFLAGS_ARRAY=(
15 "-fPIC"
16 "-pthread"
17 "-m64"
18 "-Wa,--noexecstack"
19 "-Wall"
20 "-fzero-call-used-regs=used-gpr"
21 "-Wa,--noexecstack"
22 "-g"
23 "-O2"
24 "-Werror=implicit-function-declaration"
25 "-fstack-protector-strong"
26 "-fstack-clash-protection"
27 "-Wformat"
28 "-Werror=format-security"
29 "-fcf-protection"
30 "-DOPENSSL_USE_NODELETE"
31 "-DL_ENDIAN"
32 "-DOPENSSL_PIC"
33 "-DOPENSSL_BUILDING_OPENSSL"
34 "-DZLIB"
35 "-DZSTD"
36 "-DNDEBUG"
37 "-Wdate-time"
38 "-D_FORTIFY_SOURCE=2"
39 )
40
41 ### C++ COMPILER FLAGS
42 CXXFLAGS_ARRAY=(
43 )
44
45 ### LINKER FLAGS
46 LDFLAGS_ARRAY=(
47 "-Wl,-z,relro" # Pass option as an option to the linker
48 )
49
50 ### EXPORTS TO SUB-SHELLS
51 export CPPFLAGS="${CPPFLAGS_ARRAY[*]}"
52 export CFLAGS="${CFLAGS_ARRAY[*]}"
53 export CXXFLAGS="${CXXFLAGS_ARRAY[*]}"
54 export LDFLAGS="${LDFLAGS_ARRAY[*]}"
55
56 CONFIGURE_OPTS=(
57 "--prefix=$PREFIX"
58 "--openssldir=$PREFIX/etc/ssl"
59 "--release"
60 "--with-brotli-include=$PREFIX/include"
61 "--with-brotli-lib=$PREFIX/lib"
62 "--with-zlib-include=$PREFIX/include"
63 "--with-zlib-lib=$PREFIX/lib"
64 "--with-zstd-include=$PREFIX/include"
65 "--with-zstd-lib=$PREFIX/lib"
66 #"--enable-brotli-dynamic" ### REQUIRES CMAKE
67 "--enable-zlib-dynamic"
68 "--enable-zstd-dynamic"
69 )
70
71 echo -e '\nStarting configure'
72 ./Configure "${CONFIGURE_OPTS[@]}"
73
74 echo -e '\nStarting build'
75 make -j "$(nproc)"
76
77 echo -e '\nStarting tests'
78 make -j "$(nproc)" test
79
80 echo -e '\nStarting install'
81 make -j "$(nproc)" install
82
83 #echo -e '\nStarting uninstall'
84 #make -j "$(nproc)" uninstall
85
Show various information about the compile time configuration after Configure