diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index e9e693e57c3..ac3ed0ad0b1 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -23,6 +23,7 @@ jobs: runs-on: macos-14 env: PYTHONWARNINGS: always + ASAN_OPTIONS: detect_leaks=1,detect_odr_violation=1 steps: - name: Info run: | @@ -80,9 +81,34 @@ jobs: $CC --version - name: Create installation directory run: mkdir $HOME/install + - name: Show clang path + shell: micromamba-shell {0} + run: which clang + # llvm-symbolizer, if on path or specified with ASAN_SYMBOLIZER_PATH, + # enhances tracebacks with line numbers instead of addresses + - name: Show llvm-symbolizer + shell: micromamba-shell {0} + run: which llvm-symbolizer + # Commented below are some possible flags to pass to not exit on failures - name: Build and install shell: micromamba-shell {0} - run: source ./.github/workflows/macos_install.sh $HOME/install + run: source ./.github/workflows/macos_install.sh $HOME/install $G_CFLAGS_APPEND + env: + G_CFLAGS_APPEND: >- + -g + -fcolor-diagnostics + -fno-omit-frame-pointer + -fsanitize=address + -Wno-error=deprecated-declarations + -Wdeprecated-declarations +# -fsanitize-recover=address +# -fsanitize-recover=all + G_LDFLAGS_APPEND: >- + -fno-omit-frame-pointer + -fsanitize=address +# -fsanitize-recover=address + ASAN_OPTIONS: detect_leaks=0,detect_odr_violation=1 + DYLD_INSERT_LIBRARIES: /Users/runner/micromamba/envs/grass-env/lib/clang/20/lib/darwin/libclang_rt.asan_osx_dynamic.dylib - name: Add the bin directory to PATH run: echo "$HOME/install/bin" >> $GITHUB_PATH - name: Check installed version diff --git a/.github/workflows/macos_install.sh b/.github/workflows/macos_install.sh index 4f340c73f9e..3e66af6c053 100755 --- a/.github/workflows/macos_install.sh +++ b/.github/workflows/macos_install.sh @@ -63,10 +63,27 @@ export CFLAGS="-O2 -pipe -ffp-contract=off -arch ${CONDA_ARCH} -DGL_SILENCE_DEPR export CXXFLAGS="-O2 -pipe -ffp-contract=off -stdlib=libc++ -arch ${CONDA_ARCH} -Wall -Wextra -Wpedantic" export CPPFLAGS="-isystem${CONDA_PREFIX}/include" -./configure $CONFIGURE_FLAGS +LDFLAGS="$LDFLAGS $G_LDFLAGS_APPEND" ./configure $CONFIGURE_FLAGS EXEMPT="" -make -j$(sysctl -n hw.ncpu) CFLAGS="$CFLAGS -Werror $EXEMPT" \ - CXXFLAGS="$CXXFLAGS -Werror $EXEMPT" +# Adding -Werror to make's CFLAGS is a workaround for configuring with +# an old version of configure, which issues compiler warnings and +# errors out. This may be removed with upgraded configure.in file. +#makecmd="make" +#makecmd="make -j$(sysctl -n hw.ncpu) CFLAGS='$CFLAGS -Werror $EXEMPT' CXXFLAGS='$CXXFLAGS -Werror $EXEMPT' LDFLAGS='$LDFLAGS $G_LDFLAGS_APPEND'" +makecmd="make -j$(sysctl -n hw.ncpu) CFLAGS='$CFLAGS -Werror $EXEMPT' CXXFLAGS='$CXXFLAGS -Werror $EXEMPT'" + +#echo "Running normal make, with flags" +#make -j$(sysctl -n hw.ncpu) CFLAGS="$CFLAGS -Werror $EXEMPT" CXXFLAGS="$CXXFLAGS -Werror $EXEMPT" + +echo "before extra args" +if [[ "$#" -ge 2 ]]; then + ARGS=("$@") + echo "in extra args" + makecmd="make -j$(sysctl -n hw.ncpu) CFLAGS='$CFLAGS -Werror ${ARGS[@]:1} $EXEMPT' CXXFLAGS='$CXXFLAGS -Werror ${ARGS[@]:1} $EXEMPT'" +fi + +echo "The make command is: $makecmd" +eval $makecmd make install diff --git a/python/libgrass_interface_generator/Makefile b/python/libgrass_interface_generator/Makefile index c2aa362db56..4db0c00b978 100644 --- a/python/libgrass_interface_generator/Makefile +++ b/python/libgrass_interface_generator/Makefile @@ -60,7 +60,7 @@ ifneq ($(MINGW),) INTLLIB = -lintl-8 endif -CTYPESGEN = ./run.py +CTYPESGEN = DYLD_INSERT_LIBRARIES=/Users/runner/micromamba/envs/grass-env/lib/clang/20/lib/darwin/libclang_rt.asan_osx_dynamic.dylib ./run.py CTYPESFLAGS = --no-embed-preamble --strip-build-path "$(ARCH_DISTDIR)" \ --cpp "$(CC) -E $(CPPFLAGS) $(LFS_CFLAGS) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(DEFS) $(EXTRA_INC) $(INC) -D__GLIBC_HAVE_LONG_LONG" EXTRA_CLEAN_FILES := $(wildcard ctypesgen/*.pyc) $(wildcard ctypesgen/*/*.pyc)