From: Denis Ovsienko Date: Mon, 26 Jul 2021 15:27:28 +0000 (+0100) Subject: CI: Make MATRIX_CC loop the outermost. X-Git-Tag: tcpdump-4.99.2~232 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/d1d2537fbbc75b82c9f94599fa16c9697a35f7d2 CI: Make MATRIX_CC loop the outermost. 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. (cherry picked from commit d3312a6438748730f40e4fd3cbd0dfc56ae16c54) --- diff --git a/build_matrix.sh b/build_matrix.sh index 42bbaa99..8d13fcff 100755 --- a/build_matrix.sh +++ b/build_matrix.sh @@ -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"