Fix env vars needed for devtoolset7 binaries

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/19780

Differential Revision: D15091963

Pulled By: pjh5

fbshipit-source-id: 2594395b2313d5c8a37db28965d99b0541a227e3
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 02d65fa..32fa56f 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -673,7 +673,11 @@
         set -ex
         source /env
         if [[ "$DESIRED_DEVTOOLSET" == 'devtoolset7' ]]; then
-          /builder/upgrade_gcc_abi.sh
+          source "/builder/upgrade_gcc_abi.sh"
+
+          # Env variables are not persisted into the next step
+          echo "export PATH=$PATH" > /env
+          echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH" > /env
         else
           echo "Not upgrading gcc version"
         fi
diff --git a/.circleci/verbatim-sources/linux-binary-build-defaults.yml b/.circleci/verbatim-sources/linux-binary-build-defaults.yml
index 71545a1..132f4e6 100644
--- a/.circleci/verbatim-sources/linux-binary-build-defaults.yml
+++ b/.circleci/verbatim-sources/linux-binary-build-defaults.yml
@@ -20,7 +20,11 @@
         set -ex
         source /env
         if [[ "$DESIRED_DEVTOOLSET" == 'devtoolset7' ]]; then
-          /builder/upgrade_gcc_abi.sh
+          source "/builder/upgrade_gcc_abi.sh"
+
+          # Env variables are not persisted into the next step
+          echo "export PATH=$PATH" > /env
+          echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH" > /env
         else
           echo "Not upgrading gcc version"
         fi