Opened 10 years ago

Closed 9 years ago

#20906 closed defect (fixed)

babl opcode errors on OS X 10.6

Reported by: macports@… Owned by: dbevans (David B. Evans)
Priority: Normal Milestone:
Component: ports Version: 1.8.0
Keywords: haspatch Cc: julien.lusson@…, swebster@…
Port: babl gegl

Description (last modified by tobypeterson)

With +universal on OS X 10.6 I get:

--->  Building babl
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_graphics_babl/work/babl-0.1.0" && /usr/bin/make -j2 all " returned error 2
Command output: /usr/bin/make  all-recursive
Making all in babl
Making all in base
make[3]: Nothing to be done for `all'.
/bin/sh ../libtool --tag=CC   --mode=compile /usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I..  -DLIBDIR=\""/opt/local/lib"\" -I.. -I../babl/base -I/opt/local/include  -O2 -arch x86_64 -arch i386 -Wall -Wdeclaration-after-statement -Wmissing-prototypes -Wmissing-declarations -Winit-self -Wpointer-arith -Wold-style-definition -c -o babl-cpuaccel.lo babl-cpuaccel.c
/bin/sh ../libtool --tag=CC   --mode=compile /usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I..  -DLIBDIR=\""/opt/local/lib"\" -I.. -I../babl/base -I/opt/local/include  -O2 -arch x86_64 -arch i386 -Wall -Wdeclaration-after-statement -Wmissing-prototypes -Wmissing-declarations -Winit-self -Wpointer-arith -Wold-style-definition -c -o babl-extension.lo babl-extension.c
 /usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I.. -DLIBDIR=\"/opt/local/lib\" -I.. -I../babl/base -I/opt/local/include -O2 -arch x86_64 -arch i386 -Wall -Wdeclaration-after-statement -Wmissing-prototypes -Wmissing-declarations -Winit-self -Wpointer-arith -Wold-style-definition -c babl-cpuaccel.c  -fno-common -DPIC -o .libs/babl-cpuaccel.o
 /usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I.. -DLIBDIR=\"/opt/local/lib\" -I.. -I../babl/base -I/opt/local/include -O2 -arch x86_64 -arch i386 -Wall -Wdeclaration-after-statement -Wmissing-prototypes -Wmissing-declarations -Winit-self -Wpointer-arith -Wold-style-definition -c babl-extension.c  -fno-common -DPIC -o .libs/babl-extension.o
/var/tmp//cc1XKwYd.s:125:suffix or operands invalid for `pushf'
/var/tmp//cc1XKwYd.s:126:suffix or operands invalid for `pushf'
/var/tmp//cc1XKwYd.s:127:suffix or operands invalid for `pop'
/var/tmp//cc1XKwYd.s:130:suffix or operands invalid for `push'
/var/tmp//cc1XKwYd.s:131:suffix or operands invalid for `popf'
/var/tmp//cc1XKwYd.s:132:suffix or operands invalid for `pushf'
/var/tmp//cc1XKwYd.s:133:suffix or operands invalid for `pop'
/var/tmp//cc1XKwYd.s:134:suffix or operands invalid for `popf'
lipo: can't open input file: /var/tmp//ccViRZey.out (No such file or directory)
make[3]: *** [babl-cpuaccel.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Error: Unable to upgrade port: 1

Attachments (4)

bable-debug.txt (160.8 KB) - added by macports@… 10 years ago.
sudo port -d build babl +universal
error-babl.txt (195.2 KB) - added by julien.lusson@… 10 years ago.
build error babl
babl-x86_64.diff (483 bytes) - added by jmroot (Joshua Root) 9 years ago.
gegl-x86_64.diff (520 bytes) - added by jmroot (Joshua Root) 9 years ago.

Download all attachments as: .zip

Change History (28)

comment:1 Changed 10 years ago by dbevans (David B. Evans)

Owner: changed from macports-tickets@… to devans@…
Status: newassigned

Does it build correctly without +universal on 10.6?

comment:2 Changed 10 years ago by macports@…

I'm not sure. I can't build all my ports without +universal because of #20284 However, since 10.6 is x86_64 I don't think the +universal really matters for this issue.

comment:3 Changed 10 years ago by dbevans (David B. Evans)

Yes, lets consider it a 64 bit issue then. I don't have 10.6 available as yet so if no one else can see an easy fix for this then I will refer it upstream to the babl developers.

comment:4 Changed 10 years ago by tobypeterson

Description: modified (diff)

comment:5 Changed 10 years ago by dbevans (David B. Evans)

I forgot to ask. Please submit the full debug output of your build, that is, the result of

sudo port clean babl
sudo port -d build babl +universal

so we can see the bigger picture of what is going on.

Changed 10 years ago by macports@…

Attachment: bable-debug.txt added

sudo port -d build babl +universal

Changed 10 years ago by julien.lusson@…

Attachment: error-babl.txt added

build error babl

comment:6 Changed 10 years ago by julien.lusson@…

Cc: julien.lusson@… added

Cc Me!

comment:7 Changed 10 years ago by albert.veli@…

Hi! I found a way around this. It's not a fix, but a dirty workaround.

After babl fails, edit the file config.h in the build directory

/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_graphics_babl/work/babl-0.1.0/config.h

Comment out line 107 which looks like this:

#define USE_MMX 1

Remove it or comment it out (with in front of the line). Then build again.

It should also be possible to tell configure to disable mmx by sending it the flag:

--disable-mmx

But I am new to macports and I don't know how to send configure flags to packages.

comment:8 Changed 10 years ago by macports@…

Thanks for the work around. Configure options can be set in the Portfile. Add the following line to /opt/local/var/macports/sources/rsync.macports.org/release/ports/graphics/babl/Portfile

configure.args --disable-mmx 

It builds just fine after that.

comment:9 Changed 10 years ago by dbevans (David B. Evans)

Resolution: fixed
Status: assignedclosed

Changes committed in r56651 to disable MMX support on 10.6 only.

comment:10 Changed 10 years ago by macports@…

Please note that this is a work around, and that a fix from upstream is still needed.

comment:11 Changed 10 years ago by dbevans (David B. Evans)

Obviously since disabling MMX defeats the intended purpose of babl to some extent (accelerated pixel operations).

There are a number of instances now where MMX is broken on 10.6 so we need to understand is causing this and whether this is a configuration issue or whether the code needs to be modified upstream. There is also some possibility that MacPorts 1.8's assertion of -arch is causing the problems.

So this is a work around until the problem is better understood.

comment:12 Changed 10 years ago by albert.veli@…

@devans, yes you are right. Now I got the exact same error with gegl so I put --disable-mmx into the gegl portfile and it compiled. It seems to be some general incompatibility with MMX on Snow Leopard (probably some inline assembly syntax).

If this is fixed in babl a very similar fix should apply to gegl too.

comment:13 Changed 10 years ago by albert.veli@…

I have done some more investigations into this and I traced it to the function arch_get_vendor(), and the following section:

#ifndef ARCH_X86_64
  /* Only need to check this on ia32 */
  __asm__ ("pushfl\n\t"
           "pushfl\n\t"
           "popl %0\n\t"
           "movl %0,%1\n\t"
           "xorl $0x200000,%0\n\t"
           "pushl %0\n\t"
           "popfl\n\t"
           "pushfl\n\t"
           "popl %0\n\t"
           "popfl"
           : "=a" (eax),
             "=c" (ecx)
           :
           : "cc");

  if (eax == ecx)
    return ARCH_X86_VENDOR_NONE;
#endif

This trouble code should not be run if arch is x86_64, but it is run anyway. So I noted configure detects the build system as "i386-apple-darwin10.0.0". This in turn comments out the ARCH_X86_64 define from config.h. So I tried to force it to set ARCH_X86_64 by writing the following into the babl portfile:

configure.args = --build=x86_64-apple-darwin10.0.0

I have no idea if this is a good solution, but at least it works for babl. And it works for gegl too.

comment:14 Changed 10 years ago by dbevans (David B. Evans)

Resolution: fixed
Status: closedreopened

Well, you're on the right path, looks like. However, we need to determine whether we're dealing with a 32 bit or 64 bit processor and only do this if it is 64 bit.

comment:15 Changed 10 years ago by jmroot (Joshua Root)

Port: gegl added

Should just be a matter of something like:

if {${os.platform} == "darwin"} {
    configure.args-append --build=${build_arch}-apple-darwin${os.major}
}

comment:16 Changed 10 years ago by swebster@…

Does this happen when trying to build an i386 (32-bit) version on a 64-bit capable processor? Or only when building an x86_64 version?

comment:17 Changed 10 years ago by swebster@…

Cc: swebster@… added

Cc Me!

comment:18 Changed 10 years ago by macports@…

I have a 64-bit capable processor. How do I an build i386 (32-bit) version on 10.6? Isn't x86_64 the only sane option?

comment:19 Changed 10 years ago by swebster@…

I'm not saying that you want to do this, but I think you could just change your build arch to i386 and install whatever you wanted as 32-bit, since the 64-bit processors can also run 32-bit programs. I think there are a bunch of "sane" reasons for doing this...

But that's probably getting off topic, anyway the reason I was asking is that I'm just trying to understand the problem better. This problem isn't unique to macports and babl/gegl... in fact I'm surprised it's not even MORE of a problem, since it seems that the "usual" way of discovering the processor arch with configure is not working... Maybe upstream needs to parse the output of sysctl to find out what's really going on.

comment:20 Changed 10 years ago by swebster@…

It seems that autoconf fixed this upstream because if you just download the latest babl with git it builds fine. So I think we just need a new babl distfile where the configure scripts etc. have been created with the correct autoconf etc.

comment:21 Changed 10 years ago by swebster@…

I just used the autoconf 2.65 and whatever else is in macports by the way. I'll also point out that Joshua's suggestion above would work too... that's what has been done with the gimp2 port (which is also fixed upstream).

comment:22 Changed 10 years ago by swebster@…

Unfortunately the latest babl and gegl (0.1.2, which is newer than the 0.1.0 in macports) don't have the problem fixed. I downloaded and configured them but it still detects i386.

Changed 9 years ago by jmroot (Joshua Root)

Attachment: babl-x86_64.diff added

Changed 9 years ago by jmroot (Joshua Root)

Attachment: gegl-x86_64.diff added

comment:23 Changed 9 years ago by jmroot (Joshua Root)

Keywords: haspatch added

comment:24 Changed 9 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: reopenedclosed

r74147 (maintainer timeout)

Note: See TracTickets for help on using tickets.