Opened 3 years ago
Closed 3 years ago
#63304 closed defect (fixed)
clang 3.4 @3.4.2_15: Build fails (incompatible cpu-subtype) on a G3. Makefile assumes altivec available in llvm-3.4.2.src/tools/clang/lib/Lex/Makefile
Reported by: | evanmiller (Evan Miller) | Owned by: | jeremyhu (Jeremy Huddleston Sequoia) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.7.1 |
Keywords: | ppc | Cc: | larryv (Lawrence Velázquez), kencu (Ken) |
Port: | clang-3.4 |
Description
Log excerpt:
:info:build make/platform/clang_linux.mk:16: *** "unable to infer compiler target triple for /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/clang-3.4/work/build/Release/bin/clang". Stop. :info:build gmake[4]: Leaving directory '/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/clang-3.4/work/llvm-3.4.2.src/projects/compiler-rt' :info:build gmake[3]: *** [Makefile:162: BuildRuntimeLibraries] Error 2 :info:build gmake[3]: Leaving directory '/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/clang-3.4/work/build/tools/clang/runtime/compiler-rt' :info:build gmake[2]: *** [/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/clang-3.4/work/llvm-3.4.2.src/Makefile.rules:911: compiler-rt/.makeall] Error 2 :info:build gmake[2]: Leaving directory '/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/clang-3.4/work/build/tools/clang/runtime' :info:build gmake[1]: *** [/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/clang-3.4/work/llvm-3.4.2.src/Makefile.rules:852: all] Error 1 :info:build gmake[1]: Leaving directory '/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/clang-3.4/work/build/tools/clang' :info:build gmake: *** [/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/clang-3.4/work/llvm-3.4.2.src/Makefile.rules:852: all] Error 1 :info:build gmake: Leaving directory '/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/clang-3.4/work/build' :info:build Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/clang-3.4/work/build" && /opt/local/bin/gmake -j1 -w clang-only :info:build Exit code: 2 :error:build Failed to build clang-3.4: command execution failed :debug:build Error code: CHILDSTATUS 9327 2 :debug:build Backtrace: command execution failed :debug:build while executing :debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring" :debug:build invoked from within :debug:build "command_exec -callback portprogress::target_progress_callback build" :debug:build (procedure "portbuild::build_main" line 8) :debug:build invoked from within :debug:build "$procedure $targetname" :error:build See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/clang-3.4/main.log for details.
Excerpt from the offending makefile:
Description := Static runtime libraries for clang/Linux. ### CC := clang Arch := unknown Configs := # We don't currently have any general purpose way to target architectures other # than the compiler defaults (because there is no generalized way to invoke # cross compilers). For now, we just find the target architecture of the # compiler and only define configurations we know that compiler can generate. CompilerTargetTriple := $(shell \ $(CC) -v 2>&1 | grep 'Target:' | cut -d' ' -f2) ifeq ($(CompilerTargetTriple),) $(error "unable to infer compiler target triple for $(CC)") endif
Running the clang -v
explicitly:
$ ./clang-3.4/work/build/Release/bin/clang -v dyld: incompatible cpu-subtype
Checking it with lipo:
$ lipo -info ./clang-3.4/work/build/Release/bin/clang Non-fat file: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.4/clang-3.4/work/build/Release/bin/clang is architecture: ppc7400
It looks like GCC is emitting ppc7400
on an unsupported G3 machine, similar to #63259. I don't expect the maintainers to take up this issue, but wanted to document my findings for later.
System information:
:debug:sysinfo Mac OS X 10.4.11 (darwin/8.11.0) arch powerpc :debug:sysinfo MacPorts 2.7.1 :debug:sysinfo Xcode 2.5 :debug:sysinfo SDK 10.4 :debug:sysinfo MACOSX_DEPLOYMENT_TARGET: 10.4
Change History (7)
comment:1 Changed 3 years ago by kencu (Ken)
comment:2 Changed 3 years ago by evanmiller (Evan Miller)
Yep there's an -maltivec
indiscriminately added in llvm-3.4.2.src/tools/clang/lib/Lex/Makefile
:
ifeq ($(ARCH),PowerPC) CXX.Flags += -maltivec endif
Currently trying to build with that commented out. If it works we'll likely need another (or broader) discussion about how to handle it, since there didn't seem to be a consensus about variants vs host checking with regard to libjpeg-turbo.
In the clang-3.4 case, it might be possible to pass in -mno-altivec
without patching source – in my testing, this flag will override a prior -maltivec
flag.
comment:3 Changed 3 years ago by kencu (Ken)
gcc will have some logic for handling conflicting flags being passes into it. Usually, that means taking the last flag as the one to obey.
comment:4 Changed 3 years ago by evanmiller (Evan Miller)
Good news - commenting out the CXX.Flags += -maltivec
line does fix the build on the G3. But I'm really not sure how to proceed here – maybe worth opening a separate ticket to discuss the general G3 vs Altivec issue?
comment:5 Changed 3 years ago by kencu (Ken)
FWIW, all versions of clang are unable to build anything useful on PPC, G3, G4, or G5 -- the PPC code generator in LLVM is broken when it comes to the Darwin PPC ABI.
G3 altivec hiccups appear to be a port-by-port issue, like this flag added in clang-3.4 assuming altivec, or the broken cmake system altivec test in libjpeg-turbo. It is not a general MacPorts issue, although no doubt you'll find more ports that assume altivec if they support ppc at all.
comment:6 Changed 3 years ago by kencu (Ken)
Summary: | clang 3.4 @3.4.2_15: Build fails (incompatible cpu-subtype) on a G3 → clang 3.4 @3.4.2_15: Build fails (incompatible cpu-subtype) on a G3. Makefile assumes altivec available in llvm-3.4.2.src/tools/clang/lib/Lex/Makefile |
---|
comment:7 Changed 3 years ago by kencu (Ken)
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
apple-gcc42 usually puts out the right cpu subtype for you, otherwise nothing would run on your machine at all, so this doesn't appear to me to be an inherent error in apple-gcc42.
In fact, usually it puts out all the cpu subtypes, I believe, via cpu_subtype_all being a default setting.
in #63259, it seems gcc is being told to output Altivec code with -maltivec, so it does. That the cpu can't run it in the end seems to be a cmake logic error in libjpeg-turbo, not a gcc problem, although with further testing this might turn out to be an actual gcc error, don't know yet.
here, I dunno if anyone has ever tried to build clang-3.4 on a G3 before....I never have. Obviously somewhere apple-gcc42 is being told to put out ppc7400 code, probably by an -maltivec being thrown in somewhere in the build scripts for clang-3.4.
where exactly that might be, whether it is in multiple places, and whether clang-3.4 can be built without Altivec all remain unknown.