Skip to content

Commit

Permalink
build: impl build args in bazelrc
Browse files Browse the repository at this point in the history
fix libstdc++ linking issue on centos7 with devtoolset
  • Loading branch information
aceforeverd committed Mar 14, 2024
1 parent 18146d1 commit fa247ff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
12 changes: 11 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,14 @@
# c++1z was used prior to c++17 being standardized, and is therefore more
# widely accepted by compilers. This may lead to strange behavior or compiler
# errors in earlier compilers.
build --cxxopt="-std=c++1z"
build --cxxopt="-std=c++1z" --sandbox_debug --incompatible_linkopts_to_linklibs

# --config=release
build:release -c opt

# --config=static
build:static --dynamic_mode='off' --features=-supports_dynamic_linker

# --config=release-static
# fully static profile
build:release-static --config=release --config=static
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
3.7.2
8 changes: 1 addition & 7 deletions build_zetasql_parser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ set -eE
pushd "$(dirname "$0")"
pushd "$(git rev-parse --show-toplevel)"

if grep -q centos /etc/os-release ; then
# for thoese using rhel devtoolset
export BAZEL_LINKOPTS='-static-libstdc++:-lm'
export BAZEL_LINKLIBS='-l%:libstdc++.a'
fi

if [[ $(arch) = 'aarch64' ]]; then
git checkout .
# need upgrade abseil and bazel to compile on aarch64
Expand All @@ -36,7 +30,7 @@ fi
echo "build with python: $(python -V), python3: $(python3 -V)"

TARGET='//zetasql/parser/...'
BUILD_ARGV=(--features=-supports_dynamic_linker --sandbox_debug)
BUILD_ARGV=(--config=static)

bazel build "$TARGET" "${BUILD_ARGV[@]}"
bazel test "$TARGET" "${BUILD_ARGV[@]}"
Expand Down

0 comments on commit fa247ff

Please sign in to comment.