[MacPorts] #39052: clang-3.2: can't compile a program that writes to stderr on PPC
MacPorts
noreply at macports.org
Sat May 29 21:31:26 UTC 2021
#39052: clang-3.2: can't compile a program that writes to stderr on PPC
------------------------+----------------------
Reporter: tenomoto | Owner: jeremyhu
Type: defect | Status: closed
Priority: Normal | Milestone:
Component: ports | Version: 2.1.3
Resolution: wontfix | Keywords:
Port: clang-3.2 |
------------------------+----------------------
Comment (by kencu):
Some progress over the years -- this is on Tiger PPC:
{{{
$ port -v installed clang-3.4
The following ports are currently installed:
clang-3.4 @3.4.2_14+analyzer (active) platform='darwin 8' archs='ppc'
date='2020-11-22T06:21:40-0800'
$ port -v installed cctools
The following ports are currently installed:
cctools @949.0.1_0 (active) platform='darwin 8' archs='ppc'
date='2021-01-30T12:15:33-0800'
$ port -v installed | grep ld64
ld64 @3_3+ld64_97 (active) platform='darwin 8' archs='ppc'
date='2020-05-01T20:27:38-0700'
ld64-97 @97.17_11 (active) platform='darwin 8' archs='ppc'
date='2019-09-11T19:25:08-0700'
}}}
{{{
$ cat hello.c
#include <stdio.h>
int main()
{
printf("hello, world!\n");
return 0;
}
}}}
{{{
$ clang-mp-3.4 -o hello hello.c
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: /var/tmp/hello-5a28d3.o
has external relocation entries in non-writable section (__TEXT,__text)
for symbols:
_printf$LDBL128
collect2: ld returned 1 exit status
clang: error: linker (via gcc) command failed with exit code 1 (use -v to
see invocation)
}}}
but if we do this:
{{{
sudo port select gcc apple-gcc42
}}}
now the linker works:
{{{
$ clang-mp-3.4 -o hello hello.c
$ ./hello
hello, world!
}}}
and for this example:
{{{
$ cat hello2.c
#include <stdio.h>
int main()
{
fprintf(stderr, "hello, world!\n");
return 0;
}
}}}
we try:
{{{
$ clang-mp-3.4 -o hello2 hello2.c
ld: absolute address to symbol ___sF in a different linkage unit not
supported in _main from /var/tmp/hello2-d3a630.o
collect2: ld returned 1 exit status
clang: error: linker (via gcc) command failed with exit code 1 (use -v to
see invocation)
}}}
but if we add {{{-fpic}}} then we get success:
{{{
$ clang-mp-3.4 -fpic -o hello2 hello2.c
$ ./hello2
hello, world!
}}}
--
Ticket URL: <https://trac.macports.org/ticket/39052#comment:11>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list