ClangBuiltLinux / tc-build

A set of scripts to build LLVM and binutils
Apache License 2.0
219 stars 179 forks source link

build-binutils.py: don't assume -mtune == -march #255

Closed gregsskyles closed 11 months ago

gregsskyles commented 11 months ago

Ran across this issue and thought I would document it here. Not earth-shattering or anything, just a bit of an annoyance.

Describe the bug If you specify -m ARCH to build-binutils.py, it seems to also set -mtune to the same value. This often works, but not always, e.g., for the x86-64-vN march values.

To Reproduce I ran python build-binutils.py --targets x86_64 --binutils-folder ../binutils --install-folder ../llvm --show-build-commands --march=x86-64-v4

Expected behavior Binutils build completes without error. Maybe not add the -mtune flag? TBH I'm not sure how important using -mtune is here. Or document that both flags are set together and you have to use one that's good for both.

Screenshots Command output configure: error: in `/home/greg/Space/tc-build/build/binutils/x86_64': configure: error: C compiler cannot create executables See `config.log' for more details Traceback (most recent call last): File "/home/greg/Space/tc-build/build-binutils.py", line 125, in <module> builder.build() File "/home/greg/Space/tc-build/tc_build/binutils.py", line 63, in build self.run_cmd(configure_cmd, cwd=self.folders.build) File "/home/greg/Space/tc-build/tc_build/builder.py", line 39, in run_cmd return subprocess.run(cmd, capture_output=capture_output, check=True, cwd=cwd) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/subprocess.py", line 571, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '[PosixPath('/home/greg/Space/binutils/configure'), '--disable-compressed-debug-sections', '--disable-gdb', '--disable-nls', '--disable-werror', '--enable-deterministic-archives', '--enable-new-dtags', '--enable-plugins', '--enable-threads', '--quiet', '--with-system-zlib', '--disable-sim', '--enable-lto', '--enable-relro', '--with-pic', '--prefix=/home/greg/Space/llvm', '--enable-targets=x86_64-pep', 'CC=gcc', 'CXX=g++', 'CFLAGS=-O2 -march=x86-64-v4 -mtune=x86-64-v4', 'CXXFLAGS=-O2 -march=x86-64-v4 -mtune=x86-64-v4']' returned non-zero exit status 77.

From config.log configure:4568: gcc -O2 -march=x86-64-v4 -mtune=x86-64-v4 conftest.c >&5 cc1: error: bad value 'x86-64-v4' for '-mtune=' switch cc1: note: valid arguments to '-mtune=' switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client rocketlake icelake-server cascadelake tigerlake cooperlake sapphirerapids emeraldrapids alderlake raptorlake meteorlake graniterapids graniterapids-d bonnell atom silvermont slm goldmont goldmont-plus tremont sierraforest grandridge knl knm intel x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 lujiazui k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 znver3 znver4 btver1 btver2 generic native; did you mean 'x86-64'?

Environment:

nathanchance commented 11 months ago

Thanks a lot for the report, sorry it took me so long to address it: https://github.com/ClangBuiltLinux/tc-build/pull/256

gregsskyles commented 11 months ago

No worries, as I said, not earth-shattering. I'll give the commit a test.