Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#59157 closed defect (fixed)

clang-3.7 @3.7.1_5: cp: build/tools/clang/runtime/compiler-rt/clang_darwin/10.4/libcompiler_rt.a: No such file or directory

Reported by: Ionic (Mihai Moldovan) Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version: 2.6.99
Keywords: Cc: kencu (Ken), fhgwright (Fred Wright)
Port: clang-3.7

Description

On my 10.9 machine, clang-3.7 being pulled in by clang-8.0:

:info:build llvm[3]: Copying runtime library darwin/10.4 to build dir
:info:build llvm[3]: Copying runtime library darwin/eprintf to build dir
:info:build cp /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/tools/clang/runtime/compiler-rt/clang_darwin/10.4/libcompiler_rt.a /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/Release+Debug/lib/clang/3.7.1/lib/darwin/libclang_rt.10.4.a
:info:build cp /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/tools/clang/runtime/compiler-rt/clang_darwin/eprintf/libcompiler_rt.a /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/Release+Debug/lib/clang/3.7.1/lib/darwin/libclang_rt.eprintf.a
:info:build cp: /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/tools/clang/runtime/compiler-rt/clang_darwin/10.4/libcompiler_rt.a: No such file or directory
:info:build make[3]: *** [/opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/Release+Debug/lib/clang/3.7.1/lib/darwin/libclang_rt.10.4.a] Error 1
:info:build make[3]: *** Waiting for unfinished jobs....
:info:build cp: /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/tools/clang/runtime/compiler-rt/clang_darwin/eprintf/libcompiler_rt.a: No such file or directory
:info:build make[3]: *** [/opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/Release+Debug/lib/clang/3.7.1/lib/darwin/libclang_rt.eprintf.a] Error 1
:info:build rm /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/Release+Debug/lib/clang/3.7.1/lib/macho_embedded/.dir /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/Release+Debug/lib/clang/3.7.1/lib/darwin/.dir
:info:build make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/tools/clang/runtime/compiler-rt'
:info:build make[2]: *** [compiler-rt/.makeall] Error 2
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/tools/clang/runtime'
:info:build make[1]: *** [all] Error 1
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/tools/clang'
:info:build make: *** [all] Error 1
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build'
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build" && /usr/bin/make -j2 -w clang-only 
:info:build Exit code: 2

This looks a lot like #47334 or #47241, but seems different still.

Attachments (1)

clang-3.7.main.log (6.7 MB) - added by Ionic (Mihai Moldovan) 5 years ago.
clang-3.7 main.log.

Change History (14)

Changed 5 years ago by Ionic (Mihai Moldovan)

Attachment: clang-3.7.main.log added

clang-3.7 main.log.

comment:1 Changed 5 years ago by Ionic (Mihai Moldovan)

Might be a duplicate of #54836, but also not really. If I understand the problem correctly, stuff like the 10.4 and eprintf subtargets are not built, even if they should have been. The clang_macho_embedded target is fully built though, unlike in the other ticket.

comment:2 Changed 5 years ago by Ionic (Mihai Moldovan)

Look at this:

:info:build /Library/Developer/CommandLineTools/usr/bin/make -C /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/llvm-3.7.1.src/projects/compiler-rt \
:info:build       ProjSrcRoot=/opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/llvm-3.7.1.src/projects/compiler-rt \
:info:build       ProjObjRoot=/opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/tools/clang/runtime/compiler-rt \
:info:build       CC="/opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/Release+Debug/bin/clang" \
:info:build       VERBOSE=1 \
:info:build       clang_darwin clang_macho_embedded
[...]
:info:build make[4]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/llvm-3.7.1.src/projects/compiler-rt'
:info:build make[4]: Nothing to be done for `clang_darwin'.
:info:build   MKDIR:     /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_lang_llvm-3.7/clang-3.7/work/build/tools/clang/runtime/compiler-rt/clang_macho_embedded/soft_static/armv6m/SubDir.lib__builtins

The clang_darwin target indeed is being completely skipped for some reason, because make determines that there is nothing to be done. Obviously wrong. Afterwards, the clang_macho_embedded target is built correctly.

So... the question seems to be why the clang_darwin target is not built correctly/no object files being generated in ProjObjRoot.

comment:3 Changed 5 years ago by Ionic (Mihai Moldovan)

I think I understand what's happening there.

llvm-3.7.1.src/projects/compiler-rt/make/platform/clang_darwin.mk is filtering out configs that don't have matching architectures:

# Remove empty configs if we end up dropping all the requested
# archs for a particular config.
$(foreach config,$(Configs),\
  $(if $(strip $(UniversalArchs.$(config))),,\
        $(call Set,Configs,$(filter-out $(config),$(Configs)))))

This evicts the 10.4 and eprintf configs, because...

UniversalArchs.eprintf := 
UniversalArchs.10.4 :=

(i.e., both are empty)

So far, so bad.

But why are they empty? What value should they have instead?

UniversalArchs.eprintf := $(call CheckArches,i386,eprintf,$(OSX_SDK))
UniversalArchs.10.4 := $(call CheckArches,ppc i386 x86_64,10.4,$(OSX_SDK))

Interesting. It looks like these variables should contain the listed arches if the compiler and requested SDK supports them.

CheckArches is a pretty complicated shell command building a source file and parsing its output, but here's the other thing: it requires an SDK path to be passed as its third list parameter, and...

OSX_SDK := 

Whoops, that's one empty, so the compile step will never be executed - and all arches be dropped.

Again, what SHOULD it be?

OSX_SDK := $(call XCRunSdkPath,macosx)

XCRunSdkPath is also a quite complex shell command, but it generally tries to execute xcrun --sdk $foo.internal --show-sdk-path, xcrun --sdk $foo --show-sdk-path or xcodebuild -sdk $foo -version | sed ... until one of the commands succeeds.

I've tried making make print out the command output, but the result was bleak:

PRINT_XCRUN_INTERNAL := \
  $(shell \
    result="$$(xcrun --sdk macosx.internal --show-sdk-path)"; \
    echo $$result)

PRINT_XCRUN := \
  $(shell \
    result="$$(xcrun --sdk macosx --show-sdk-path)"; \
    echo $$result)

PRINT_XCODEBUILD := \
  $(shell \
    result="$$(xcodebuild -sdk macosx -version)"; \
    echo $$result)

---

PRINT_XCRUN_INTERNAL := 
PRINT_XCRUN := 
PRINT_XCODEBUILD := 

... and all of this is probably caused by

DEVELOPER_DIR='/Library/Developer/CommandLineTools'

This issue seems to be yet another incarnation of #58779.

Check this:

% DEVELOPER_DIR=/Library/Developer/CommandLineTools xcrun --sdk macosx --show-sdk-path

% xcrun --sdk macosx --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk

It looks like we'll have to workaround this issue by setting use_xcode yes in the port for platforms that DO NOT ship SDKs as part of CLT. Otherwise clang and its components will not be able to find the SDK and fail in such a difficult to debug way.

comment:4 Changed 4 years ago by kencu (Ken)

Cc: kencu added

comment:5 Changed 4 years ago by kencu (Ken)

I see a number of ports are doing this on an individual basis -- testing for ${DEVELOPER_DIR}/SDKs and setting use_xcode yes if that directory is not found.

This sure seems like something that should be handled in base instead of on a port-by-port basis, though...

comment:6 Changed 4 years ago by kencu (Ken)

For now, I'm going to leave this ticket as it, as I think the general fix needs to come from base. See 58779 for ideas.

If this lingers on too long with no general solution, I'll start adding that fix individually to all the ports that exhibit this issue that I am a maintainer on.

comment:7 Changed 4 years ago by fhgwright (Fred Wright)

I'm seeing something similar trying to build clang-3.7 @3.7.1_6 on 10.9. I think the the relevant logfile snippet is:

llvm[3]: Copying runtime library darwin/eprintf to build dir
cp /opt/local/var/macports/build/_opt_local_var_macports_sources_MacPro.local_ywg.ca.rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.7/clang-3.7/work/build/tools/clang/runtime/compiler-rt/clang_darwin/eprintf/libcompiler_rt.a /opt/local/var/macports/build/_opt_local_var_macports_sources_MacPro.local_ywg.ca.rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.7/clang-3.7/work/build/Release+Debug/lib/clang/3.7.1/lib/darwin/libclang_rt.eprintf.a
cp: /opt/local/var/macports/build/_opt_local_var_macports_sources_MacPro.local_ywg.ca.rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.7/clang-3.7/work/build/tools/clang/runtime/compiler-rt/clang_darwin/eprintf/libcompiler_rt.a: No such file or directory
make[3]: *** [/opt/local/var/macports/build/_opt_local_var_macports_sources_MacPro.local_ywg.ca.rsync.macports.org_macports_release_tarballs_ports_lang_llvm-3.7/clang-3.7/work/build/Release+Debug/lib/clang/3.7.1/lib/darwin/libclang_rt.eprintf.a] Error 1

Since it was failing to copy something that looked like a build product, I retried it with buildmakejobs=1 in case it was a dependency issue, but that didn't help (it just took much longer to get the same failure). I can attach the non-parallel logfile if you like.

Based on the archives missing from packages.macports.org, it looks like this affects several OS versions.

comment:8 Changed 4 years ago by kencu (Ken)

the use_xcode default in base needs fixing. It's not a clang thing.

comment:9 Changed 4 years ago by fhgwright (Fred Wright)

Cc: fhgwright added

comment:10 in reply to:  6 Changed 4 years ago by fhgwright (Fred Wright)

Replying to kencu:

the use_xcode default in base needs fixing. It's not a clang thing.

Well, OK, but there was: kencu:

If this lingers on too long with no general solution, I'll start adding that fix individually to all the ports that exhibit this issue that I am a maintainer on.

comment:11 Changed 4 years ago by kencu (Ken)

Resolution: fixed
Status: assignedclosed

comment:12 Changed 4 years ago by fhgwright (Fred Wright)

It now builds on 10.9, though it looks like the buildbots need to be poked to fill in the missing archives for 10.9 and 10.11. I presume 10.14 and 10.15 are consistently missing for a different reason.

comment:13 Changed 4 years ago by kencu (Ken)

Jeremy disabled clang-3.7 on the newer systems. I will see if I can jolt the buildbot -- many of these were down due to an SSD crash, and I'm not sure if Ryan has all of them up at present.

Note: See TracTickets for help on using tickets.