Commit ba8f35dc authored by Aaron Gable's avatar Aaron Gable Committed by Commit Bot

Revert "clang build.py: change LLVM_ENABLE_ZLIB from ON to FORCE_ON"

This reverts commit c00c874f83f6787de5a1b946ffcea9f49637c139.

Reason for revert: Caused compile failures on non-RBE Goma

See o/51853436 for context. See
https://ci.chromium.org/p/chromium/builders/ci/ios-simulator-cronet/103497
for sample failure.

Original change's description:
> clang build.py: change LLVM_ENABLE_ZLIB from ON to FORCE_ON
> 
> This uses the FORCE_ON option to enable zlib to ensure that clang
> actually finds and uses zlib. Also moved this setting out of
> base_cmake_args so that it is only used in the main clang build,
> since there is another 32-bit build that can't use this zlib.
> 
> Also changed to remove and re-download the zlib source on
> every build.
> 
> Change-Id: Ifceabc2ba06e4e4a56464f18de80610a0f043641
> Bug: 1061189
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2118674
> Commit-Queue: Amy Huang <[email protected]>
> Reviewed-by: Nico Weber <[email protected]>
> Cr-Commit-Position: refs/heads/[email protected]{#753301}

[email protected],[email protected],[email protected],[email protected]

Change-Id: I9dad136109c540c0c700d67632573639b2596e5c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1061189
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2121078Reviewed-by: default avatarAaron Gable <[email protected]>
Commit-Queue: Aaron Gable <[email protected]>
Cr-Original-Commit-Position: refs/heads/[email protected]{#753326}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 640977954c3500b17c6cbf67cb48f10e9859d3e3
parent 1f3305e6
......@@ -236,29 +236,31 @@ def AddGnuWinToPath():
def AddZlibToPath():
"""Download and build zlib, and add to PATH."""
zlib_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'zlib-1.2.11')
if os.path.exists(zlib_dir):
RmTree(zlib_dir)
zip_name = 'zlib-1.2.11.tar.gz'
DownloadAndUnpack(CDS_URL + '/tools/' + zip_name, LLVM_BUILD_TOOLS_DIR)
os.chdir(zlib_dir)
zlib_files = [
'adler32', 'compress', 'crc32', 'deflate', 'gzclose', 'gzlib', 'gzread',
'gzwrite', 'inflate', 'infback', 'inftrees', 'inffast', 'trees',
'uncompr', 'zutil'
]
cl_flags = [
'/nologo', '/O2', '/DZLIB_DLL', '/c', '/D_CRT_SECURE_NO_DEPRECATE',
'/D_CRT_NONSTDC_NO_DEPRECATE'
]
RunCommand(
['cl.exe'] + [f + '.c' for f in zlib_files] + cl_flags, msvc_arch='x64')
RunCommand(
['lib.exe'] + [f + '.obj'
for f in zlib_files] + ['/nologo', '/out:zlib.lib'],
msvc_arch='x64')
# Remove the test directory so it isn't found when trying to find
# test.exe.
shutil.rmtree('test')
if not os.path.exists(zlib_dir):
zip_name = 'zlib-1.2.11.tar.gz'
DownloadAndUnpack(CDS_URL + '/tools/' + zip_name, LLVM_BUILD_TOOLS_DIR)
os.chdir(zlib_dir)
zlib_files = [
'adler32', 'compress', 'crc32', 'deflate', 'gzclose', 'gzlib',
'gzread', 'gzwrite', 'inflate', 'infback', 'inftrees', 'inffast',
'trees', 'uncompr', 'zutil'
]
cl_flags = [
'/nologo', '/O2', '/DZLIB_DLL', '/c', '/D_CRT_SECURE_NO_DEPRECATE',
'/D_CRT_NONSTDC_NO_DEPRECATE'
]
try:
RunCommand(['cl.exe'] + [f + '.c' for f in zlib_files] + cl_flags,
msvc_arch='x64')
RunCommand(['lib.exe'] + [f + '.obj' for f in zlib_files] +
['/nologo', '/out:zlib.lib'], msvc_arch='x64')
# Remove the test directory so it isn't found when trying to find
# test.exe.
shutil.rmtree('test')
except Exception as e:
print('Failed to build zlib: ' + str(e))
sys.exit(1)
os.environ['PATH'] = zlib_dir + os.pathsep + os.environ.get('PATH', '')
return zlib_dir
......@@ -485,6 +487,7 @@ def main():
# Require zlib compression.
zlib_dir = AddZlibToPath()
base_cmake_args.append('-DLLVM_ENABLE_ZLIB=ON')
cflags.append('-I' + zlib_dir)
cxxflags.append('-I' + zlib_dir)
ldflags.append('-LIBPATH:' + zlib_dir)
......@@ -748,8 +751,6 @@ def main():
'-DCHROMIUM_TOOLS=%s' % ';'.join(chrome_tools)]
if args.pgo:
cmake_args.append('-DLLVM_PROFDATA_FILE=' + LLVM_PROFDATA_FILE)
if sys.platform == 'win32':
cmake_args.append('-DLLVM_ENABLE_ZLIB=FORCE_ON')
if sys.platform == 'darwin':
cmake_args += ['-DCOMPILER_RT_ENABLE_IOS=ON',
'-DSANITIZER_MIN_OSX_VERSION=10.7']
......@@ -792,7 +793,6 @@ def main():
# The bootstrap compiler produces 64-bit binaries by default.
cflags += ['-m32']
cxxflags += ['-m32']
compiler_rt_args = base_cmake_args + [
'-DCMAKE_C_FLAGS=' + ' '.join(cflags),
'-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags),
......
......@@ -41,7 +41,7 @@ import zipfile
# Reverting problematic clang rolls is safe, though.
CLANG_REVISION = 'a1762f9ceb9549b781b7418c7dbe23fe620648f6'
CLANG_SVN_REVISION = 'n345938'
CLANG_SUB_REVISION = 2
CLANG_SUB_REVISION = 1
PACKAGE_VERSION = '%s-%s-%s' % (CLANG_SVN_REVISION, CLANG_REVISION[:8],
CLANG_SUB_REVISION)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment