Skip to content

Commit

Permalink
try simplifiying the openssl linux/mman.h hack 1
Browse files Browse the repository at this point in the history
  • Loading branch information
vszakats committed Sep 4, 2023
1 parent 9d19836 commit 13c3b01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
11 changes: 6 additions & 5 deletions _build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -942,16 +942,17 @@ build_single_target() {
fi
fi

if [ "${_CRT}" = 'musl' ] && [ "${_DIST}" = 'debian' ] && [ "${_ENV}" = 'ci' ]; then
if [ "${_CRT}" = 'musl' ] && [ "${_DIST}" = 'debian' ]; then
if [ "${_OPENSSL}" = 'quictls' ] || \
[ "${_OPENSSL}" = 'openssl' ]; then
# Workaround for:
# ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory
# Based on: https://github.com/openssl/openssl/issues/7207#issuecomment-880121450
# FIXME: We'd need something not touching the system.
ln -s "/usr/include/${_machine}-linux-gnu/asm" "/usr/include/${_machine}-linux-musl/asm"
ln -s "/usr/include/asm-generic" "/usr/include/${_machine}-linux-musl/asm-generic"
ln -s "/usr/include/linux" "/usr/include/${_machine}-linux-musl/linux"
_my_incdir='_sys_include'; rm -r -f "${_my_incdir}"; mkdir "${_my_incdir}"; _my_incdir="$(pwd)/${_my_incdir}"
ln -s "/usr/include/${_TRIPLETSH}/asm" "${_my_incdir}/asm"
ln -s "/usr/include/asm-generic" "${_my_incdir}/asm-generic"
ln -s "/usr/include/linux" "${_my_incdir}/linux"
_CPPFLAGS_GLOBAL="${_CPPFLAGS_GLOBAL} -isystem ${_my_incdir}"
fi
fi

Expand Down
15 changes: 0 additions & 15 deletions openssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,6 @@ _VER="$1"
options="${options} no-comp"
fi

# TODO: consider disabling this option for all musl builds.
# Workaround for musl builds missing Linux kernel header (as of OpenSSL v3.1.2):
# ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory
if [ "${_CRT}" = 'musl' ]; then
# Linux cross-builds from other systems are unlikely to feature Linux kernel headers.
# macOS cross-builds for certain do not.
if [ "${_HOSTOS}" != 'linux' ]; then
options="${options} no-secure-memory"
# Debian builds require a hack modifying the system, we do this only on
# throwaway machines, like CI ones.
elif [ "${_DIST}" = 'debian' ] && [ "${_ENV}" != 'ci' ]; then
options="${options} no-secure-memory"
fi
fi

export CC="${_CC_GLOBAL}"

# OpenSSL's ./Configure dumps build flags into object `crypto/cversion.o`
Expand Down

0 comments on commit 13c3b01

Please sign in to comment.