Opened 11 years ago

Closed 11 years ago

#38088 closed defect (fixed)

getopt @1.1.5: bad magic number (not a Mach-O file)

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.1.3
Keywords: tiger Cc: ryandesign (Ryan Carsten Schmidt)
Port: getopt

Description

Hello!

The upgrade stops here:

make: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_sysutils_getopt/getopt/work/getopt-1.1.5'
/usr/bin/gcc-4.0 -c -DLIBCGETOPT=0 -DWITHOUT_GETTEXT=0 -DLOCALEDIR=\"/opt/local/share/locale\" -DNOT_UTIL_LINUX -Dprogram_invocation_short_name=\"getopt\"  -Dprogram_version=\"1.1.5\" -I/opt/local/include -I./gnu  -Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wmissing-declarations -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -O3 -fno-strength-reduce -arch ppc getopt.c -o getopt.o
In file included from getopt.c:65:
./gnu/getopt.h:106: warning: function declaration isn’t a prototype
/usr/bin/gcc-4.0 -L/opt/local/lib -lintl -arch ppc -o getopt getopt.o gnu/getopt.o gnu/getopt1.o
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: gnu/getopt.o bad magic number (not a Mach-O file)
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: gnu/getopt1.o bad magic number (not a Mach-O file)
collect2: ld returned 1 exit status
make: *** [getopt] Error 1
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_sysutils_getopt/getopt/work/getopt-1.1.5'

On the command line I get a different report:

pete 274 /\ l /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_sysutils_getopt/getopt/work/getopt-1.1.5/*.o
-rw-r--r--   1 macports  admin  15044 17 Feb 01:02 /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_sysutils_getopt/getopt/work/getopt-1.1.5/getopt.o
pete 275 /\ file /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_sysutils_getopt/getopt/work/getopt-1.1.5/*.o
/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_sysutils_getopt/getopt/work/getopt-1.1.5/getopt.o: Mach-O object ppc

Attachments (1)

main.log (10.4 KB) - added by ballapete (Peter "Pete" Dyballa) 11 years ago.

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

comment:1 Changed 11 years ago by ballapete (Peter "Pete" Dyballa)

Forgot to mention that it happens on PPC Tiger, Mac OS X 10.4.8.

comment:2 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added
Keywords: tiger added
Summary: Build process for getopt 1.1.5 produces "bad magic number (not a Mach-O file)" output?getopt @1.1.5: bad magic number (not a Mach-O file)

Same here on ppc G4 10.4.11.

comment:3 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: newclosed

I note that on Mountain Lion the following message appears:

ld: warning: ignoring file gnu/getopt.o, file was built for unsupported file format ( 0x7f 0x45 0x4c 0x46 0x 2 0x 1 0x 1 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 ) which is not the architecture being linked (x86_64): gnu/getopt.o
ld: warning: ignoring file gnu/getopt1.o, file was built for unsupported file format ( 0x7f 0x45 0x4c 0x46 0x 2 0x 1 0x 1 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 ) which is not the architecture being linked (x86_64): gnu/getopt1.o

Despite the warning, the build succeeds, but I suspect whatever problem ld is warning about here on Mountain Lion is the same problem causing the build to fail on Tiger.

And the problem seems to be that version 1.1.5 was shipped with pre-compiled Linux ELF object files in the distfile:

$ sudo port extract getopt
--->  Fetching distfiles for getopt
--->  Verifying checksum(s) for getopt
--->  Extracting getopt
$ cd $(port work getopt)
$ file getopt-*/gnu/*.o
getopt-1.1.5/gnu/getopt.o:  ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
getopt-1.1.5/gnu/getopt1.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
$

Fixed in r103250. Revision increased to rebuild for everybody, because I'm concerned about the "ignoring file" warnings; I suspect it was not intended for those files to be ignored, so let's rebuild correctly to be sure.

Note: See TracTickets for help on using tickets.