[MacPorts] #36026: gcc46 problem after ld64 upgrade
MacPorts
noreply at macports.org
Sat Sep 8 07:23:46 PDT 2012
#36026: gcc46 problem after ld64 upgrade
----------------------------------+-----------------------------------------
Reporter: jwhowse4@… | Owner: macports-tickets@…
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.1.2
Keywords: | Port:
----------------------------------+-----------------------------------------
Comment(by jwhowse4@…):
I found a very simple example which reproduces the problem. However the
problem is not what I thought. Use the following C program.
{{{
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int i;
double x;
for( i = 0; i < 5; i++ )
{
x = sqrt( (double) i );
printf( "%lf\n", x );
}
return 0;
}
}}}
Compile and then link this program using the XCode 4.4.1 linker provided
by Apple. The result is the executable is created and functions properly.
{{{
# Make the linker the xcode 4.4.1 linker in /usr/bin
cp /opt/macports/ld.apple /opt/macports/ld
# Compile the code to an object file
gcc-mp-4.6 -c test.c
# Link the object file to an executable
gcc-mp-4.6 -o TstPrg test.o -lm
# Check existence of executable
ls TstPrg
TstPrg
# Executable DOES EXIST. It also runs properly.
}}}
Compile and then link this program using the linker provided by the
MacPorts package ld64. The result is the executable is NOT created at
all.
{{{
# Make the linker the macports linker in port ld64
cp /opt/macports/ld.macports /opt/macports/ld
# Compile the code to an object file
gcc-mp-4.6 -c test.c
# Link the object file to an executable
gcc-mp-4.6 -o TstPrg test.o -lm
ld: warning: ignoring file test.o, file was built for unsupported file
format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 1
0x 0 0x 0 0x 0 ) which is not the architecture being linked (x86_64):
test.o
ld: file is universal (2 slices) but does not contain a(n) x86_64 slice:
/usr/lib/crt1.10.5.o for architecture x86_64
collect2: ld returned 1 exit status
# Check existence of executable
ls TstPrg
ls: TstPrg: No such file or directory
# Executable DOES NOT EXIST
}}}
The object files test.o created by these two procedures are identical.
The problem apparently is that on my system the MacPorts ld64 linker is
refusing to create executables from object files. I have attached by
object files and the successfully created executable.
--
Ticket URL: <https://trac.macports.org/ticket/36026#comment:9>
MacPorts <http://www.macports.org/>
Ports system for Mac OS
More information about the macports-tickets
mailing list