Skip to content

Commit

Permalink
Disable usage of sys_siglist function to workaround issues on alpine (#…
Browse files Browse the repository at this point in the history
…854)

Motivation:

When we try to use our static compiled version on alpine it fails due
missing sys_siglist. We can workaround this by letting apr use its own
implementation.

Modifications:

Use ac_cv_have_decl_sys_siglist=no when compiling APR.

Result:

netty-tcnative-boringssl-static should be useable on alpine. Fixes
#853
  • Loading branch information
normanmaurer committed Feb 28, 2024
1 parent 8c7af41 commit 35e51e0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions docker/Dockerfile.centos6
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ RUN yum install -y \
tar \
unzip \
wget \
which \
zip

RUN mkdir $SOURCE_DIR
Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile.cross_compile_aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN yum install -y http://opensource.wandisco.com/centos/6/git/x86_64/wandisco-g
# Install requirements
RUN set -x && \
yum -y install epel-release && \
yum -y install wget tar git make autoconf automake libtool openssl-devel ninja-build gcc-c++ patch unzip zip
yum -y install wget tar git make autoconf automake libtool openssl-devel ninja-build gcc-c++ patch unzip zip which

# Install Java
RUN yum install -y java-1.8.0-openjdk-devel golang
Expand All @@ -39,7 +39,7 @@ RUN set -x && \
wget --no-check-certificate https://downloads.apache.org//apr/apr-$APR_VERSION.tar.gz && \
tar xvf apr-$APR_VERSION.tar.gz && \
pushd apr-$APR_VERSION && \
CC=aarch64-none-linux-gnu-gcc CFLAGS='-O3 -fno-omit-frame-pointer -fPIC' ./configure --disable-shared --prefix=/opt/apr-$APR_VERSION-static --host=aarch64-none-linux-gnu ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=yes ac_cv_sizeof_struct_iovec=8 && \
CC=aarch64-none-linux-gnu-gcc CFLAGS='-O3 -fno-omit-frame-pointer -fPIC ' ./configure --disable-shared --prefix=/opt/apr-$APR_VERSION-static --host=aarch64-none-linux-gnu ac_cv_have_decl_sys_siglist=no ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=yes ac_cv_sizeof_struct_iovec=8 && \
make || true && \
pushd tools && \
gcc -Wall -O2 -DCROSS_COMPILE gen_test_char.c -s -o gen_test_char && \
Expand All @@ -52,7 +52,7 @@ RUN set -x && \
wget --no-check-certificate https://downloads.apache.org//apr/apr-$APR_VERSION.tar.gz && \
tar xvf apr-$APR_VERSION.tar.gz && \
pushd apr-$APR_VERSION && \
CC=aarch64-none-linux-gnu-gcc CFLAGS='-O3 -fno-omit-frame-pointer -fPIC' ./configure --prefix=/opt/apr-$APR_VERSION-share --host=aarch64-none-linux-gnu ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=yes ac_cv_sizeof_struct_iovec=8 && \
CC=aarch64-none-linux-gnu-gcc CFLAGS='-O3 -fno-omit-frame-pointer -fPIC' ./configure --prefix=/opt/apr-$APR_VERSION-share --host=aarch64-none-linux-gnu ac_cv_have_decl_sys_siglist=no ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=yes ac_cv_sizeof_struct_iovec=8 && \
make || true && \
pushd tools && \
gcc -Wall -O2 -DCROSS_COMPILE gen_test_char.c -s -o gen_test_char && \
Expand Down
10 changes: 7 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
<mkdir dir="${aprHome}" />
<echo message="Patching APR to not link against libcrypt" />
<patch patchfile="../patches/apr_crypt.patch" strip="0" dir="${aprSourceDir}" />

<exec executable="buildconf" failonerror="true" dir="${aprSourceDir}" resolveexecutable="true" />

<if>
Expand All @@ -673,7 +674,7 @@
+ See https://stackoverflow.com/a/1605497/1074097
+ -->
<exec executable="configure" failonerror="true" dir="${aprSourceDir}" resolveexecutable="true">
<arg line="--disable-shared --prefix=${aprHome} CFLAGS='-O3 -fno-omit-frame-pointer -fPIC -target arm64-apple-macos11' --host=aarch64-apple-darwin ${macOsxDeploymentTarget} ac_cv_file__dev_zero=yes apr_cv_process_shared_works=yes apr_cv_mutex_robust_shared=no apr_cv_tcp_nodelay_with_cork=yes ${macOsxDeploymentTarget}" />
<arg line="--disable-shared --prefix=${aprHome} CFLAGS='-O3 -fno-omit-frame-pointer -fPIC -target arm64-apple-macos11' --host=aarch64-apple-darwin ${macOsxDeploymentTarget} ac_cv_have_decl_sys_siglist=no ac_cv_file__dev_zero=yes apr_cv_process_shared_works=yes apr_cv_mutex_robust_shared=no apr_cv_tcp_nodelay_with_cork=yes" />
</exec>
<!--
Make will fail when it tries to use the gen_test_char program.
Expand All @@ -692,15 +693,18 @@
</then>
<else>
<exec executable="configure" failonerror="true" dir="${aprSourceDir}" resolveexecutable="true">
<arg line="--disable-shared --prefix=${aprHome} CFLAGS='-O3 -fno-omit-frame-pointer -fPIC' ${macOsxDeploymentTarget}" />
<!--
Disable the detection of sys_siglist and just use apr's own implementation to workaround problems when trying to use static jars on alpine linux
See https://github.com/netty/netty-tcnative/issues/853
-->
<arg line="--disable-shared --prefix=${aprHome} CFLAGS='-O3 -fno-omit-frame-pointer -fPIC' ${macOsxDeploymentTarget} ac_cv_have_decl_sys_siglist=no" />
</exec>
<exec executable="make" failonerror="true" dir="${aprSourceDir}" resolveexecutable="true" />
<exec executable="make" failonerror="true" dir="${aprSourceDir}" resolveexecutable="true">
<arg line="install" />
</exec>
</else>
</if>

</else>
</if>
</target>
Expand Down

0 comments on commit 35e51e0

Please sign in to comment.