aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar matclab <mathieu.clabaut@gmail.com>2022-07-01 23:29:32 +0200
committerGravatar GitHub <noreply@github.com>2022-07-01 22:29:32 +0100
commita0adeda9e145c69e90cd4a4118bbb13ba0f64926 (patch)
treeca028b153fa57336800377421334d897598cff8f
parent3a99b6403b93d3d62617b9492f7e9d2401fa5b17 (diff)
Fix S2OPC build (#7935)
* s2opc: fix mbedtls download link * s2opc: update mbedtls build commands * s2opc: use newer version of mbedtls * s2opc: add expat to build pubsub fuzzers * s2opc: update libcheck build * s2opc: use find to build the corpora * s2opc: fix error-warning about MBEDTLS_AESNI_C causing spurious error reports with some memory sanitizers Co-authored-by: Pierre-Antoine <brameret@systerel.fr>
-rw-r--r--projects/s2opc/Dockerfile5
-rwxr-xr-xprojects/s2opc/build.sh34
-rw-r--r--projects/s2opc/project.yaml3
3 files changed, 32 insertions, 10 deletions
diff --git a/projects/s2opc/Dockerfile b/projects/s2opc/Dockerfile
index 79d58410..4f81e1ad 100644
--- a/projects/s2opc/Dockerfile
+++ b/projects/s2opc/Dockerfile
@@ -20,8 +20,9 @@ RUN apt-get update && apt-get install -y make cmake git curl
# Sources and dependencies
RUN git clone --depth 1 https://gitlab.com/systerel/S2OPC
RUN git clone --depth 1 https://gitlab.com/systerel/S2OPC-fuzzing-data
-RUN curl -L https://tls.mbed.org/download/mbedtls-2.16.0-apache.tgz -o $SRC/mbedtls.tgz
-RUN curl -L https://github.com/libcheck/check/releases/download/0.12.0/check-0.12.0.tar.gz -o $SRC/check.tgz
+RUN curl -L https://github.com/Mbed-TLS/mbedtls/archive/v2.28.0.tar.gz -o $SRC/mbedtls.tgz
+RUN curl -L https://github.com/libcheck/check/releases/download/0.14.0/check-0.14.0.tar.gz -o $SRC/check.tgz
+RUN curl -L https://github.com/libexpat/libexpat/releases/download/R_2_4_3/expat-2.4.3.tar.gz -o $SRC/expat.tgz
WORKDIR S2OPC
COPY build.sh $SRC/
diff --git a/projects/s2opc/build.sh b/projects/s2opc/build.sh
index db320332..50377580 100755
--- a/projects/s2opc/build.sh
+++ b/projects/s2opc/build.sh
@@ -17,20 +17,42 @@
################################################################################
MBEDTLS_BUILD=$WORK/mbedtls
+EXPAT_BUILD=$WORK/expat
S2OPC_BUILD=$WORK/s2opc
SAMPLES=$SRC/S2OPC-fuzzing-data
# Build the dependencies
+
+## Configure mbedtls to disable support of the AES-NI instructions, known to cause error with some sanitizers
tar xzf $SRC/mbedtls.tgz -C $WORK
+sed 's,#define MBEDTLS_AESNI_C,//#define MBEDTLS_AESNI_C,' -i $WORK/mbedtls-2.*/include/mbedtls/config.h
+
mkdir -p $MBEDTLS_BUILD
cd $MBEDTLS_BUILD
-cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON $WORK/mbedtls-2.*
+cmake -DPYTHON_EXECUTABLE="/usr/bin/python3" \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
+ $WORK/mbedtls-2.*
make -j$(nproc)
make -j$(nproc) install
+## libcheck
tar xzf $SRC/check.tgz -C $WORK
cd $WORK/check-0.*
-./configure --prefix=/usr/local --with-tcltk=no
+cmake -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_POSITION_INDEPENDENT_CODE=1 \
+ $WORK/check-0.*
+make -j$(nproc)
+make -j$(nproc) install
+
+## expat
+tar xzf $SRC/expat.tgz -C $WORK
+mkdir -p $EXPAT_BUILD
+cd $EXPAT_BUILD
+cmake -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
+ -DEXPAT_SHARED_LIBS=OFF \
+ $WORK/expat-2.*
make -j$(nproc)
make -j$(nproc) install
@@ -38,17 +60,15 @@ make -j$(nproc) install
mkdir -p $S2OPC_BUILD
cd $S2OPC_BUILD
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
- -DS2OPC_CLIENTSERVER_ONLY=ON \
-DCMAKE_C_COMPILER="$CC" -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_EXE_LINKER_FLAGS="$CXXFLAGS" \
-DCMAKE_C_LINK_EXECUTABLE="$CXX <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" \
-DWITH_OSS_FUZZ=ON \
$SRC/S2OPC
cmake --build . --target fuzzers
-
-# Copy them and build the corpora
cp bin/* $OUT
+# Build the corpora
cd $SAMPLES
-for dir in $(ls -d */); do
- zip -j $OUT/${dir%/}_fuzzer_seed_corpus.zip ${dir}*
+for dir in $(find -maxdepth 1 -type d -not -name ".*"); do
+ find $dir -exec zip -j $OUT/$(basename $dir)_fuzzer_seed_corpus.zip {} +
done
diff --git a/projects/s2opc/project.yaml b/projects/s2opc/project.yaml
index e0fe4122..770ca63b 100644
--- a/projects/s2opc/project.yaml
+++ b/projects/s2opc/project.yaml
@@ -1,10 +1,11 @@
-homepage: "https://gitlab.com/systerel/S2OPC"
+homepage: "https://s2opc.com/"
language: c++
primary_contact: "pab.systerel@gmail.com"
auto_ccs:
- "mcl.systerel@gmail.com"
- "vla.systerel@gmail.com"
- "vmo.systerel@gmail.com"
+main_repo: "https://gitlab.com/systerel/S2OPC"
sanitizers:
- address
- memory