Opened 12 months ago

Last modified 10 months ago

#67320 new defect

clang-11 @11.1.0_7 +universal fails to build when libxslt -universal is active

Reported by: fhgwright (Fred Wright) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc: jeremyhu (Jeremy Huddleston Sequoia), mascguy (Christopher Nielsen)
Port: clang-11

Description

It appears that clang-11 (and perhaps other versions as well) has some sort of broken opportunistic build such that the presence of an active libxslt port causes it to build something that fails to link when a needed architecture is missing. No dependency on libxslt is shown.

The clang-11 +universal build succeeds if there's either an active libxslt +universal port or no active libxslt port. Oddly enough, the installed content is the same in both cases, so perhaps it's opportunistically building something that it doesn't actually install.

This was observed in 10.11, but the OS version probably doesn't matter.

I captured logs for both the failing case and the successful case with no active libxslt. I neglected to capture the successful case with the active libxslt +universal, and redoing that would be time-consuming.

Attachments (2)

clang-11+universal-MacEC-2.log.xz (236.9 KB) - added by fhgwright (Fred Wright) 12 months ago.
Failed build with active libxslt -universal
clang-11+universal-MacEC-nxs.log.xz (270.4 KB) - added by fhgwright (Fred Wright) 12 months ago.
Successful build with no active libxslt

Download all attachments as: .zip

Change History (12)

comment:1 Changed 12 months ago by fhgwright (Fred Wright)

Unfortunately, both logfiles exceed the 10MB limit. Since the problem is probably reproducible under the conditions stated above, I won't bother trying to break them up unless it's necessary.

comment:2 Changed 12 months ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:3 Changed 12 months ago by jmroot (Joshua Root)

You can compress the logs with bzip2 or whatever to get them under the attachment size limit.

Changed 12 months ago by fhgwright (Fred Wright)

Failed build with active libxslt -universal

Changed 12 months ago by fhgwright (Fred Wright)

Successful build with no active libxslt

comment:4 in reply to:  3 Changed 12 months ago by fhgwright (Fred Wright)

Replying to jmroot:

You can compress the logs with bzip2 or whatever to get them under the attachment size limit.

Done.

comment:5 Changed 12 months ago by ryandesign (Ryan Carsten Schmidt)

This sounds like a linker bug we encountered many years ago already. I know of no solution other than installing the offending libraries universal.

comment:6 Changed 12 months ago by kencu (Ken)

all the years I’ve been building clang, I’ve never seen this…

I can’t as yet find anywhere that the llvm tree tries to link in libxslt

probably have to run the failing link manually with -Wl,-v to get some idea what is going on here

comment:7 in reply to:  6 Changed 12 months ago by fhgwright (Fred Wright)

Replying to ryandesign:

This sounds like a linker bug we encountered many years ago already. I know of no solution other than installing the offending libraries universal.

I don't see how a linker bug would cause it to optionally link against libxslt. Once it does that, it's of course not a bug that it can't link against a library with a missing architecture.

Replying to kencu:

all the years I’ve been building clang, I’ve never seen this…

I can’t as yet find anywhere that the llvm tree tries to link in libxslt

The log shows the command that's doing it, but not why it's doing it.

probably have to run the failing link manually with -Wl,-v to get some idea what is going on here

I neglected to capture .CC_PRINT_OPTIONS, which might be helpful.

comment:8 in reply to:  5 Changed 12 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to ryandesign:

This sounds like a linker bug we encountered many years ago already.

#36438 is the issue I was thinking of. Per comment:ticket:36438:60 "There's not really anything we can do about this. This is how the toolchain works..." See also my summary in comment:ticket:52337:9 and Jeremy's comment:ticket:52337:19: "It is a bug in the linker. That is <rdar://problem/12450551>, which I filed back in 2012." Using trace mode (sudo port -t install ...) may be another workaround.

Last edited 12 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:9 Changed 12 months ago by kencu (Ken)

that is one weird bug… I still don’t quite follow the issue exactly:

“ It's the use of -L/opt/local/lib that is causing ld to resolve the /usr/lib/libstdc++.6.dylib link in an existing library to /opt/local/lib/libstdc++.6.dylib in much the same way that DYLD_LIBRARY_PATH operates at runtime for dyld.”

comment:10 in reply to:  9 Changed 10 months ago by fhgwright (Fred Wright)

Replying to kencu:

that is one weird bug… I still don’t quite follow the issue exactly:

You and me both.

“ It's the use of -L/opt/local/lib that is causing ld to resolve the /usr/lib/libstdc++.6.dylib link in an existing library to /opt/local/lib/libstdc++.6.dylib in much the same way that DYLD_LIBRARY_PATH operates at runtime for dyld.”

I don't see how the linker can be blamed for doing exactly what it's told to do, which is to use /opt/local/lib/libstdc++.6.dylib in preference to /usr/lib/libstdc++.6.dylib, and which expectedly fails when trying to link something universal against a non-universal library. IMO, those tickets were misdiagnosed and prematurely closed as wontfix.

In any case, that's not the same situation as the one here. That one involves expectedly linking against a library which has been overridden by a non-universal build, while this one involves unexepectedly linking against a library which is not considered to need to be universal since it's not an expected dependency.

The question here is why libxslt is being used at all.

Note: See TracTickets for help on using tickets.