Skip to content

Commit

Permalink
For non-Mariner, use ubuntu-18.04 build pool
Browse files Browse the repository at this point in the history
Otherwise, we end up with clang-14 library dependencies in tblgen
that don't run on our arm cross-compiler Docker images.
  • Loading branch information
BruceForstall committed Aug 8, 2023
1 parent 1116f52 commit b43ddcc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
33 changes: 20 additions & 13 deletions build-coredistools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ LLVMTargetsToBuild="AArch64;ARM;X86"

# Figure out which `strip` to use. Prefer `llvm-strip` if it is available.
# `llvm-strip` is available in CBL-Mariner container; `strip` is available on macOS.
StripTool=$(command -v llvm-strip)
StripTool=$(command -v strip)
if [ -z "$StripTool" ]; then
StripTool=$(command -v strip)
StripTool=$(command -v llvm-strip)
if [ -z "$StripTool" ]; then
echo "Strip tool not found"
exit 1
Expand All @@ -34,7 +34,25 @@ if [ -z "$TblGenTool" ]; then
fi

C_COMPILER=$(command -v clang)
if [ -z "$C_COMPILER" ]; then
C_COMPILER=$(command -v clang-9)
if [ -z "$C_COMPILER" ]; then
echo "C compiler not found"
# Keep going in case cmake can find one?
fi
fi

CXX_COMPILER=$(command -v clang++)
if [ -z "$CXX_COMPILER" ]; then
CXX_COMPILER=$(command -v clang++-9)
if [ -z "$CXX_COMPILER" ]; then
echo "C++ compiler not found"
# Keep going in case cmake can find one?
fi
fi

echo "Using C compiler: $C_COMPILER"
echo "Using C++ compiler: $CXX_COMPILER"

case "$TargetOSArchitecture" in
linux-arm)
Expand All @@ -43,20 +61,12 @@ case "$TargetOSArchitecture" in
LLVMHostTriple=arm-linux-gnueabihf
LLVMTargetsToBuild="ARM"
EnsureCrossRootfsDirectoryExists
if [ $CrossBuildUsingMariner -eq 0 ]; then
C_COMPILER=$(command -v clang-9)
CXX_COMPILER=$(command -v clang++-9)
fi
;;

linux-arm64)
CMakeCrossCompiling=ON
LLVMHostTriple=aarch64-linux-gnu
EnsureCrossRootfsDirectoryExists
if [ $CrossBuildUsingMariner -eq 0 ]; then
C_COMPILER=$(command -v clang-9)
CXX_COMPILER=$(command -v clang++-9)
fi
;;

linux-x64)
Expand Down Expand Up @@ -92,9 +102,6 @@ case "$TargetOSArchitecture" in
exit 1
esac

echo "Using $C_COMPILER"
echo "Using $CXX_COMPILER"

LLVMDefaultTargetTriple=${LLVMDefaultTargetTriple:-$LLVMHostTriple}

RootDirectory="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
Expand Down
10 changes: 4 additions & 6 deletions coredistools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ jobs:
#container: linux_x64

pool:
vmImage: ubuntu-latest
# CBL-Mariner:
# vmImage: ubuntu-latest
vmImage: ubuntu-18.04

workspace:
clean: all
Expand Down Expand Up @@ -156,8 +158,6 @@ jobs:
displayName: Make llvm-tblgen executable
- script: |
ls -lAF $(Pipeline.Workspace)
ls -lAF $(Pipeline.Workspace)/tblgen-linux
echo "##vso[task.prependpath]$(Pipeline.Workspace)/tblgen-linux"
displayName: Add llvm-tblgen to the PATH
Expand All @@ -178,7 +178,7 @@ jobs:
displayName: Build coredistools Linux x64

pool:
vmImage: ubuntu-latest
vmImage: ubuntu-18.04

variables:
TargetOSArchitecture: linux-x64
Expand All @@ -198,8 +198,6 @@ jobs:
displayName: Make llvm-tblgen executable
- script: |
ls -lAF $(Pipeline.Workspace)
ls -lAF $(Pipeline.Workspace)/tblgen-linux
echo "##vso[task.prependpath]$(Pipeline.Workspace)/tblgen-linux"
displayName: Add llvm-tblgen to the PATH
Expand Down

0 comments on commit b43ddcc

Please sign in to comment.