]> The Tcpdump Group git mirrors - tcpdump/commitdiff
CI: Make MATRIX_CC loop the outermost.
authorDenis Ovsienko <[email protected]>
Mon, 26 Jul 2021 15:27:28 +0000 (16:27 +0100)
committerDenis Ovsienko <[email protected]>
Mon, 26 Jul 2021 15:31:51 +0000 (16:31 +0100)
This way if an iteration includes a local libpcap, the latter is always
compiled with the same CC. This works around odd linking problems on
AIX 7 and Solaris 9 and 10 when one C compiler is GCC and the other is
the vendor's compiler, for example:

* GCC used for libpcap, XL C used for tcpdump:
ld: 0711-317 ERROR: Undefined symbol: .__udivdi3
ld: 0711-317 ERROR: Undefined symbol: .__umoddi3

* GCC used for libpcap, Sun C used for tcpdump:
Undefined                       first referenced
 symbol                             in file
__ctzsi2                            ../libpcap/libpcap.a(optimize.o)
__udivdi3                           ../libpcap/libpcap.a(sf-pcapng.o)
__umoddi3                           ../libpcap/libpcap.a(sf-pcapng.o)
ld: fatal: Symbol referencing errors. No output written to conftest

Similar issues associated with a mix of GCC and Clang had happened on
FreeBSD/AArch64 earlier (addressed in tcpslice commit 75b7771), and
still seem to happen on OpenBSD/AArch64. Hopefully removing the
toolchain mix from the problem space will make it easier to fix other
problems.

build_matrix.sh

index 42bbaa99a71bd2f7147476c76a02d11fca67451d..8d13fcffb688153f66415a9ebf05026b752175bb 100755 (executable)
@@ -26,64 +26,64 @@ fi
 COUNT=0
 
 build_tcpdump() {
-    for CC in $MATRIX_CC; do
-        export CC
-        # Exclude gcc on macOS (it is just an alias for clang).
-        # shellcheck disable=SC2006
-        if [ "$CC" = gcc ] && [ "`uname -s`" = Darwin ]; then
-            echo '(skipped)'
-            continue
-        fi
-        for CMAKE in $MATRIX_CMAKE; do
-            export CMAKE
-            for CRYPTO in $MATRIX_CRYPTO; do
-                export CRYPTO
-                for SMB in $MATRIX_SMB; do
-                    export SMB
-                    # shellcheck disable=SC2006
-                    COUNT=`increment $COUNT`
-                    echo_magenta "===== SETUP $COUNT: BUILD_LIBPCAP=$BUILD_LIBPCAP REMOTE=${REMOTE:-?} CC=$CC CMAKE=$CMAKE CRYPTO=$CRYPTO SMB=$SMB ====="
-                    # Run one build with setup environment variables:
-                    # BUILD_LIBPCAP, REMOTE, CC, CMAKE, CRYPTO and SMB
-                    run_after_echo ./build.sh
-                    echo 'Cleaning...'
-                    if [ "$CMAKE" = yes ]; then
-                        run_after_echo rm -rf build
-                    else
-                        run_after_echo make distclean
-                    fi
-                    run_after_echo rm -rf "$PREFIX"/bin/tcpdump*
-                    run_after_echo git status -suall
-                    # Cancel changes in configure
-                    run_after_echo git checkout configure
-                done
+    for CMAKE in $MATRIX_CMAKE; do
+        export CMAKE
+        for CRYPTO in $MATRIX_CRYPTO; do
+            export CRYPTO
+            for SMB in $MATRIX_SMB; do
+                export SMB
+                # shellcheck disable=SC2006
+                COUNT=`increment $COUNT`
+                echo_magenta "===== SETUP $COUNT: BUILD_LIBPCAP=$BUILD_LIBPCAP REMOTE=${REMOTE:-?} CC=$CC CMAKE=$CMAKE CRYPTO=$CRYPTO SMB=$SMB ====="
+                # Run one build with setup environment variables:
+                # BUILD_LIBPCAP, REMOTE, CC, CMAKE, CRYPTO and SMB
+                run_after_echo ./build.sh
+                echo 'Cleaning...'
+                if [ "$CMAKE" = yes ]; then
+                    run_after_echo rm -rf build
+                else
+                    run_after_echo make distclean
+                fi
+                run_after_echo rm -rf "$PREFIX"/bin/tcpdump*
+                run_after_echo git status -suall
+                # Cancel changes in configure
+                run_after_echo git checkout configure
             done
         done
     done
 }
 
 touch .devel configure
-for BUILD_LIBPCAP in $MATRIX_BUILD_LIBPCAP; do
-    export BUILD_LIBPCAP
-    if [ "$BUILD_LIBPCAP" = yes ]; then
-        for REMOTE in $MATRIX_REMOTE; do
-            export REMOTE
-            # Build libpcap with Autoconf.
-            echo_magenta "Build libpcap (CMAKE=no REMOTE=$REMOTE)"
-            (cd ../libpcap && CMAKE=no ./build.sh)
-            # Set PKG_CONFIG_PATH for configure when building libpcap
-            if [ "$CMAKE" != no ]; then
-                PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig"
-                export PKG_CONFIG_PATH
-            fi
-            build_tcpdump
-        done
-    else
-        echo_magenta 'Use system libpcap'
-        purge_directory "$PREFIX"
-        (cd ../libpcap; make distclean || echo '(Ignoring the make error.)')
-        build_tcpdump
+for CC in $MATRIX_CC; do
+    export CC
+    # Exclude gcc on macOS (it is just an alias for clang).
+    # shellcheck disable=SC2006
+    if [ "$CC" = gcc ] && [ "`uname -s`" = Darwin ]; then
+        echo '(skipped)'
+        continue
     fi
+    for BUILD_LIBPCAP in $MATRIX_BUILD_LIBPCAP; do
+        export BUILD_LIBPCAP
+        if [ "$BUILD_LIBPCAP" = yes ]; then
+            for REMOTE in $MATRIX_REMOTE; do
+                export REMOTE
+                # Build libpcap with Autoconf.
+                echo_magenta "Build libpcap (CMAKE=no REMOTE=$REMOTE)"
+                (cd ../libpcap && CMAKE=no ./build.sh)
+                # Set PKG_CONFIG_PATH for configure when building libpcap
+                if [ "$CMAKE" != no ]; then
+                    PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig"
+                    export PKG_CONFIG_PATH
+                fi
+                build_tcpdump
+            done
+        else
+            echo_magenta 'Use system libpcap'
+            purge_directory "$PREFIX"
+            (cd ../libpcap; make distclean || echo '(Ignoring the make error.)')
+            build_tcpdump
+        fi
+    done
 done
 
 run_after_echo rm -rf "$PREFIX"