[MacPorts] #47987: djview @4.10 fails to build on PPC 10.5
MacPorts
noreply at macports.org
Mon Jun 8 00:24:56 PDT 2015
#47987: djview @4.10 fails to build on PPC 10.5
------------------------------+---------------------
Reporter: reeskm@… | Owner: nicos@…
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.3.3
Resolution: | Keywords:
Port: djview, qt4-mac |
------------------------------+---------------------
Changes (by ryandesign@…):
* cc: michaelld@… (added)
* port: djview => djview, qt4-mac
Comment:
Thanks, that shows me what I expected to see, which is that the Makefile
is invoking the compiler with the flags "`-arch ppc -arch -o
djview.app/Contents/MacOS/djview`" which is not correct. The second
"`-arch`" shouldn't be there. Alternately, the second "`-arch`" should be
followed by "`ppc`" as the first one is. The question is: why are these
flags being used?
I believe this is a bug in qmake (which is a part of Qt). There are two
problems which together are causing this.
The first problem is that for some reason, every compiler invocation in
your log has the `-arch ppc` flags repeated a second time. I don't know
where this comes from, and I don't see it on my Yosemite system, but there
are of course many differences between an Intel Yosemite system and a
PowerPC Leopard system. Normally, it would be no problem to repeat the
`-arch XXX` flags; the compiler will just ignore the duplicate
architectures.
The second problem is that it seems that qmake tries to be clever and
removes what it considers to be duplicate flags. At least I think that's
the explanation. It evidently has some intelligence to know that `-arch`
flags are special and should not be deduplicated, but somehow if the same
`-arch XXX` flags are specified more than once, then only the first
occurrence of the architecture name is preserved and the subsequent ones
are removed, leaving invalid `-arch` flags. A version of this problem was
reported in [https://bugreports.qt.io/browse/QTBUG-24662 Qt bug 24662]. It
was closed without being fixed and indeed without the developers seeming
to understand the problem in the slightest. (The developer's suggestion
regarding `-Xarch_i386` is completely off-topic.)
I was able to reproduce the problem on my Yosemite system by forcing
MacPorts to use the same `-arch` flags twice: I edited macports.conf and
changed `universal_archs` to `x86_64 x86_64`, then built djview with the
+universal variant. Obviously this is a silly setting that nobody would
really use, but it caused MacPorts to pass `-arch x86_64 -arch x86_64` to
the build system, which caused it to fail the same way for me that it did
for you. Of note: qt4-mac also fails to configure +universal with this
setting, reinforcing the idea that this is a Qt bug.
It seems that qmake is aware to some degree that it will create these
invalid combinations of flags, because after qmake runs and before it
writes it to the Makefile.qmake file, it sends the output through this
transform:
{{{
/opt/local/bin/gsed 's/-arch *-/-/g'
}}}
That is: if there are any occurrences of `-arch` followed by a space and a
dash, then delete the occurrence of `-arch`. This would have fixed the
problem if the literal string "`-arch -o`" had appeared in the file, but
it doesn't: "`-arch ppc -arch`" appears at the end of a line (the line
setting the LFLAGS variable), and then later it invokes:
{{{
$(vLINK)$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
}}}
which is where the `-o` gets placed right after an `-arch`.
The real solution is for qmake to not deduplicate `-arch XXX` flags.
--
Ticket URL: <https://trac.macports.org/ticket/47987#comment:5>
MacPorts <https://www.macports.org/>
Ports system for OS X
More information about the macports-tickets
mailing list