Build script custom options not consistently passed along for all dependencies built


I am trying to build the swift using the build script. I want to build it using a custom clang tool which I have built locally. I figured that there is an option to pass the custom Clang and Clang++ path. Which is what I needed. I have built some version of apple/llvm-project locally and have some of my custom patches in the same binary. So I would need the swift tool chain to be built with the custom llvm's which I have built locally.

  --host-cc PATH        the absolute path to CC, the "clang" compiler for the
                        host platform. Default is auto detected.
  --host-cxx PATH       the absolute path to CXX, the "clang++" compiler for
                        the host platform. Default is auto detected.

I am adding below options to ./utils/build-toolchain-tensorflow file as follows.

./utils/build-script ${DRY_RUN} --preset="${SWIFT_PACKAGE}" \
        --cmake-c-launcher=`which sccache` \
        --cmake-cxx-launcher=`which sccache` \
        host-cc="/home/gl-245/swift_stuff/cherry_pick_ex/my_llvm_fork/build/bin/clang" \
        host-cxx="/home/gl-245/swift_stuff/cherry_pick_ex/my_llvm_fork/build/bin/clang++" \
        install_destdir="${SWIFT_INSTALL_DIR}" \
        installable_package="${SWIFT_INSTALLABLE_PACKAGE}" \
        install_toolchain_dir="${SWIFT_TOOLCHAIN_DIR}" \
        install_symroot="${SWIFT_INSTALL_SYMROOT}" \
        symbols_package="${SYMBOLS_PACKAGE}" \
        darwin_toolchain_bundle_identifier="${BUNDLE_IDENTIFIER}" \
        darwin_toolchain_display_name="${DISPLAY_NAME}" \
        darwin_toolchain_display_name_short="${DISPLAY_NAME_SHORT}" \
        darwin_toolchain_xctoolchain_name="${TOOLCHAIN_NAME}" \
        darwin_toolchain_version="${TOOLCHAIN_VERSION_DATE}" \
        darwin_toolchain_alias="Swift for TensorFlow" \

Notice the hard coded path for host-cc and host-cxx flags in the above snippet.

It is properly picking the set custom clang and clang++ tool for some components as shown below for the first target it is building.

host-cc=/home/gl-245/swift_stuff/cherry_pick_ex/my_llvm_fork/build/bin/clang host-cxx=/home/gl-245/swift_stuff/cherry_pick_ex/my_llvm_fork/build/bin/clang++

Where as for the rest of the targets example swift-stdlib etc. it is picking the clang tool installed in my system i.e in /usr/bin/clang As shown below.

Building the standard library for: swift-stdlib-linux-x86_64
Running Swift tests for: check-swift-all-linux-x86_64 check-swift-all-optimize-linux-x86_64
+ mkdir -p /home/gl-245/swift_stuff/bld_swift_tf_bkup/build/buildbot_linux/cmark-linux-x86_64
+ mkdir -p /home/gl-245/swift_stuff/bld_swift_tf_bkup/build/buildbot_linux/cmark-linux-x86_64/.cmake/api/v1/query
+ touch /home/gl-245/swift_stuff/bld_swift_tf_bkup/build/buildbot_linux/cmark-linux-x86_64/.cmake/api/v1/query/codemodel-v2 /home/gl-245/swift_stuff/bld_swift_tf_bkup/build/buildbot_linux/cmark-linux-x86_64/.cmake/api/v1/query/cache-v2
+ pushd /home/gl-245/swift_stuff/bld_swift_tf_bkup/build/buildbot_linux/cmark-linux-x86_64
~/swift_stuff/bld_swift_tf_bkup/build/buildbot_linux/cmark-linux-x86_64 ~/swift_stuff/bld_swift_tf_bkup/swift
+ env /usr/local/bin/cmake -G Ninja -DCMAKE_C_COMPILER:PATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:PATH=/usr/bin/clang++ -DCMAKE_LIBTOOL:PATH= -DLLVM_VERSION_MAJOR:STRING=10 -DLLVM_VERSION_MINOR:STRING=0 -DLLVM_VERSION_PATCH:STRING=0 -DCLANG_VERSION_MAJOR:STRING=10 -DCLANG_VERSION_MINOR:STRING=0 -DCLANG_VERSION_PATCH:STRING=0 -DCMAKE_MAKE_PROGRAM=/home/gl-245/swift_stuff/bld_swift_tf_bkup/build/buildbot_linux/ninja-build/ninja -DCMAKE_BUILD_TYPE:STRING=Release /home/gl-245/swift_stuff/bld_swift_tf_bkup/cmark

It is picking from

-DCMAKE_C_COMPILER:PATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:PATH=/usr/bin/clang++

Now the question is, I want any dependencies which is built by the script has to use the custom path provided in host-cc and host-cxx. How to achive the same? Is there anything wrong I am doing while setting the parameters? Is there any additional flags needs to be set/added to pass the custom flags to be passed along? Any inputs will be helpful.

Terms of Service

Privacy Policy

Cookie Policy