Why is one compiler on 10.6 able to generate PPC binaries and not the other?

Mojca Miklavec mojca at macports.org
Fri Mar 11 01:50:37 PST 2016


On 11 March 2016 at 09:35, Jeremy Huddleston Sequoia wrote:
>> On Mar 10, 2016, at 17:20, Mojca Miklavec wrote:
>> On 10 March 2016 at 21:26, Ryan Schmidt wrote:
>>>> On Mar 10, 2016, at 1:00 PM, Mojca Miklavec wrote:
>>>>
>>>> Hi,
>>>>
>>>> While following
>>>>   https://trac.macports.org/wiki/LibcxxOnOlderSystems#Leopardppc
>>>> on 10.6/x86_64 I tried to install clang 3.7 (thinking that version 3.7
>>>> might have an even better support for PPC than 3.6).
>>>>
>>>> The problem is that clang-mp-3.7 doesn't want to produce ppc binaries,
>>>> so I wasn't able to install libcxx. I get:
>>>>
>>>>> clang++-mp-3.7 a.cc -arch ppc
>>>> ld: unknown/unsupported architecture name for: -arch ppc
>>>> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>
> The linker you have installed doesn't support ppc.  You need to install ld64 with the +ld64_127 variant to get the last version of the linker that supported ppc.

Oh, thank you. That explains a lot.

I now did
    sudo port -v -s install ld64 +ld64_127 +universal
and clang 3.7 indeed no longer complains about unsupported architecture.

It is still complaining about:

ld: warning: ignoring file
/opt/local/libexec/llvm-3.7/bin/../lib/clang/3.7.1/lib/darwin/libclang_rt.osx.a,
missing required architecture ppc in file

but it generates the binary as expected.

Now I'm stuck at

ld: symbol dyld_stub_binder not found (normally in libSystem.dylib).
Needed to perform lazy binding to function _abort for architecture ppc
clang: error: linker command failed with exit code 1 (use -v to see invocation)

from compiling libcxxabi:

/opt/local/bin/clang-mp-3.7 -I/opt/mp/10.5/include abort_message.o
cxa_aux_runtime.o cxa_default_handlers.o cxa_demangle.o
cxa_exception.o cxa_exception_storage.o cxa_guard.o cxa_handlers.o
cxa_new_delete.o cxa_personality.o cxa_thread_atexit.o
cxa_unexpected.o cxa_vector.o cxa_virtual.o exception.o
private_typeinfo.o stdexcept.o typeinfo.o -arch ppc -arch i386 -arch
x86_64 -o libc++abi.dylib -dynamiclib -nodefaultlibs -current_version
3.7.0 -compatibility_version 1 -install_name /usr/lib/libc++abi.dylib
-lSystem -std=c++11 -stdlib=libc++ -fstrict-aliasing
-Wstrict-aliasing=2 -Wsign-conversion -Wshadow -Wconversion
-Wunused-variable -Wmissing-field-initializers -Wchar-subscripts
-Wmismatched-tags -Wmissing-braces -Wshorten-64-to-32 -Wsign-compare
-Wstrict-aliasing=2 -Wstrict-overflow=4 -Wunused-parameter
-Wnewline-eof
ld: symbol dyld_stub_binder not found (normally in libSystem.dylib).
Needed to perform lazy binding to function _abort for architecture ppc
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It must have something to do with the fact that I use
    export MACOSX_DEPLOYMENT_TARGET="10.5"
but I didn't yet try to figure out how to modify Portfiles to actually
link against 10.5 SDK.

Before I spend half a day debugging: what's the easiest way to add
    -isysroot /Developer/SDKs/MacOSX10.5.sdk
to the relevant ports and which ports are most likely relevant for
this error? Just libcxxabi?

I will also try to change "if {${os.major} < 10} { ... }" in libcxxabi
to "< 11" just in case.

>>>> At the same time clang++-mp-3.4 works fine even though both clang 3.4
>>>> and 3.7 are x86_64 only.
>
> That's because it's actually just acting a s front-end to gcc for -arch ppc.

Thank you.

>>>> I'm now trying to rebuild everything as +universal (with ppc included
>>>> in the list of universal architectures) and hope that it will work
>>>> afterwards.
>
> Nope.  That has nothing to do with it.  That just means what architectures the clang executable will run on, not which architectures and platforms it will target.

So I guess I can just an well uninstall "clang 3.4 +universal" a it
makes absolutely no sense?

>>>> But I would be grateful for ideas about why clang 3.4
>>>> would be able to create ppc binaries and clang 3.7 not.
>
> 3.4 doesn't.
> 3.7 does, but you didn't have the correct linker.

Thank you.

Mojca


More information about the macports-dev mailing list