Fix portability issues on macOS with gcc-13 #198
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change logs
This PR solves portability issues causing CBDB failed to compile on macOS using gcc-13:
matrix.c: gcc-12 and newer enhanced-Waddressto warn more always-false bool expressions, which makes one line inmatrix.cto be warned and GPDB is refused to compile using gcc-12 and newer toolchain.log.c: on MacOS,timeval.tv_usecis defined differently which needs to be casted in order to be printed by %ld.sm4.h: type definations conflict with the system header on various different platforms.See: https://gcc.gnu.org/gcc-12/changes.html
How was this patch tested?
Because we currently don't have a gcc-13 nor a macOS pipeline, automated testing is not possible. I manually tested this PR on Intel mac and Apple M2 mac, they all successfully build the binaries though special
configurearguments are required. I've talked to releng team to write a script to make these steps easier.Testing procedure:
brew install gccand make sure yourgcc --versionis a realgccnot something aliased to clang.readmes/README.macOS.bashto install all dependenciesBREWPREFIX=$(brew --prefix); CXXFLAGS="-I $BREWPREFIX/Cellar/xerces-c/3.2.4_1/include" CFLAGS="-ggdb -Og -g3 -fno-omit-frame-pointer -I $BREWPREFIX/include -I $BREWPREFIX/Cellar/xerces-c/3.2.4_1/include" LDFLAGS="-L $BREWPREFIX/Cellar/libevent/2.1.12_1/lib -L $BREWPREFIX/Cellar/xerces-c/3.2.4_1/lib -L $BREWPREFIX/opt/zstd/lib" ./configure --enable-debug --prefix=/home/gpadmin/install/cbdbmake -j12 installMaybe we should modify the
readmes/README.macOS.bashto install the dependencies andlnall Cellar headers and libs to$(brew --predix)/includeand$(brew --predix)/libso that we don't need to specify any special paths in-Iand-L.Caveat
Warning
w/o a CI pipeline to guard against any changes that may break portability, CBDB could soon turns unportable again. Such thing has already happened to GPDB, their repo is entirely incompatible with gcc-13. I suggest we should at least add a small build (not testing, just build) pipeline on gcc-13 on macOS, or gcc-13 on Linux at least.